Refactor order of item to follow alphabetical order.

This commit is contained in:
Spencer Ofwiti
2021-05-13 10:13:51 +03:00
parent 948554563d
commit b68404eade
51 changed files with 1718 additions and 1718 deletions

View File

@@ -216,8 +216,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="408"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:408</a></div>
<div class="io-line">Defined in <a href="" data-line="167"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:167</a></div>
</td>
</tr>
@@ -257,8 +257,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="250"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:250</a></div>
<div class="io-line">Defined in <a href="" data-line="178"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:178</a></div>
</td>
</tr>
@@ -304,8 +304,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="302"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:302</a></div>
<div class="io-line">Defined in <a href="" data-line="186"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:186</a></div>
</td>
</tr>
@@ -351,8 +351,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="317"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:317</a></div>
<div class="io-line">Defined in <a href="" data-line="201"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:201</a></div>
</td>
</tr>
@@ -431,8 +431,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="339"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:339</a></div>
<div class="io-line">Defined in <a href="" data-line="210"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:210</a></div>
</td>
</tr>
@@ -511,8 +511,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="266"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:266</a></div>
<div class="io-line">Defined in <a href="" data-line="218"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:218</a></div>
</td>
</tr>
@@ -558,8 +558,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="357"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:357</a></div>
<div class="io-line">Defined in <a href="" data-line="227"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:227</a></div>
</td>
</tr>
@@ -634,8 +634,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="325"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:325</a></div>
<div class="io-line">Defined in <a href="" data-line="235"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:235</a></div>
</td>
</tr>
@@ -681,8 +681,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="258"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:258</a></div>
<div class="io-line">Defined in <a href="" data-line="248"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:248</a></div>
</td>
</tr>
@@ -728,8 +728,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="348"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:348</a></div>
<div class="io-line">Defined in <a href="" data-line="257"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:257</a></div>
</td>
</tr>
@@ -804,8 +804,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="366"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:366</a></div>
<div class="io-line">Defined in <a href="" data-line="266"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:266</a></div>
</td>
</tr>
@@ -880,8 +880,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="223"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:223</a></div>
<div class="io-line">Defined in <a href="" data-line="274"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:274</a></div>
</td>
</tr>
@@ -927,8 +927,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="375"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:375</a></div>
<div class="io-line">Defined in <a href="" data-line="283"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:283</a></div>
</td>
</tr>
@@ -1003,8 +1003,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="239"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:239</a></div>
<div class="io-line">Defined in <a href="" data-line="291"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:291</a></div>
</td>
</tr>
@@ -1050,8 +1050,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="231"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:231</a></div>
<div class="io-line">Defined in <a href="" data-line="299"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:299</a></div>
</td>
</tr>
@@ -1099,8 +1099,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="182"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:182</a></div>
<div class="io-line">Defined in <a href="" data-line="310"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:310</a></div>
</td>
</tr>
@@ -1198,8 +1198,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="211"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:211</a></div>
<div class="io-line">Defined in <a href="" data-line="325"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:325</a></div>
</td>
</tr>
@@ -1279,8 +1279,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="197"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:197</a></div>
<div class="io-line">Defined in <a href="" data-line="339"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:339</a></div>
</td>
</tr>
@@ -1360,8 +1360,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="288"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:288</a></div>
<div class="io-line">Defined in <a href="" data-line="353"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:353</a></div>
</td>
</tr>
@@ -1442,8 +1442,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="276"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:276</a></div>
<div class="io-line">Defined in <a href="" data-line="369"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:369</a></div>
</td>
</tr>
@@ -1520,8 +1520,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="170"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:170</a></div>
<div class="io-line">Defined in <a href="" data-line="379"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:379</a></div>
</td>
</tr>
@@ -1561,8 +1561,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="384"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:384</a></div>
<div class="io-line">Defined in <a href="" data-line="389"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:389</a></div>
</td>
</tr>
@@ -1637,8 +1637,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="402"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:402</a></div>
<div class="io-line">Defined in <a href="" data-line="398"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:398</a></div>
</td>
</tr>
@@ -1717,8 +1717,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="393"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:393</a></div>
<div class="io-line">Defined in <a href="" data-line="408"
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:408</a></div>
</td>
</tr>
@@ -1872,48 +1872,8 @@ const keyring &#x3D; new openpgp.Keyring();
* @extends KeyStore
*/
interface MutableKeyStore extends KeyStore {
/**
* Instantiate the keyring in the keystore.
* @async
*/
loadKeyring(): void;
/**
* Add a key pair to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
importKeyPair(publicKey: any, privateKey: any): Promise&lt;void&gt;;
/**
* Add public key to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @throws Error
*/
importPublicKey(publicKey: any): Promise&lt;void&gt;;
/**
* Add private key to keyring.
* @async
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
importPrivateKey(privateKey: any): Promise&lt;void&gt;;
/**
* Get all the public keys.
* @returns An array of public keys.
*/
getPublicKeys(): Array&lt;any&gt;;
/**
* Get all the trusted keys.
* @returns An array of trusted keys.
*/
getTrustedKeys(): Array&lt;any&gt;;
/**
* Get all the trusted active keys.
* @returns An array of trusted active keys.
*/
getTrustedActiveKeys(): Array&lt;any&gt;;
/** Remove all keys from the keyring. */
clearKeysInKeyring(): void;
/**
* Get all the encryption keys.
* @returns An array of encryption keys.
@@ -1922,30 +1882,6 @@ interface MutableKeyStore extends KeyStore {
* This is included to appease the implemented Keystore interface.
*/
getEncryptKeys(): Array&lt;any&gt;;
/**
* Get all private keys.
* @returns An array of all private keys.
*/
getPrivateKeys(): Array&lt;any&gt;;
/**
* Get the first private key.
* @returns The first private key.
*/
getPrivateKey(): any;
/**
* Test if the input is a valid key.
* @async
* @param key - The input to be validated.
* @returns true - If the input is a valid key.
*/
isValidKey(key: any): Promise&lt;boolean&gt;;
/**
* Verify that a private key is encrypted.
* @async
* @param privateKey - The private key to verify.
* @returns true - If private key is encrypted.
*/
isEncryptedPrivateKey(privateKey: any): Promise&lt;boolean&gt;;
/**
* Get the first private key&#x27;s fingerprint.
* @returns The first private key&#x27;s fingerprint.
@@ -1957,11 +1893,6 @@ interface MutableKeyStore extends KeyStore {
* @returns The key&#x27;s keyId.
*/
getKeyId(key: any): string;
/**
* Get the first private key&#x27;s keyID.
* @returns The first private key&#x27;s keyId.
*/
getPrivateKeyId(): string;
/**
* Get keys from the keyring using their keyId.
* @param keyId - The keyId of the keys to be fetched from the keyring.
@@ -1969,49 +1900,118 @@ interface MutableKeyStore extends KeyStore {
*/
getKeysForId(keyId: string): Array&lt;any&gt;;
/**
* Get a public key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the public key to be fetched from the keyring.
* @returns The public key with that keyId.
* Get the first private key.
* @returns The first private key.
*/
getPublicKeyForId(keyId: string): any;
getPrivateKey(): any;
/**
* Get a private key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the private key to be fetched from the keyring.
* @returns The private key with that keyId.
*/
getPrivateKeyForId(keyId: string): any;
/**
* Get the first private key&#x27;s keyID.
* @returns The first private key&#x27;s keyId.
*/
getPrivateKeyId(): string;
/**
* Get all private keys.
* @returns An array of all private keys.
*/
getPrivateKeys(): Array&lt;any&gt;;
/**
* Get a public key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the public key to be fetched from the keyring.
* @returns The public key with that keyId.
*/
getPublicKeyForId(keyId: string): any;
/**
* Get a public key from the keyring using it&#x27;s subkeyId.
* @param subkeyId - The subkeyId of the public key to be fetched from the keyring.
* @returns The public key with that subkeyId.
*/
getPublicKeyForSubkeyId(subkeyId: string): any;
/**
* Get all the public keys.
* @returns An array of public keys.
*/
getPublicKeys(): Array&lt;any&gt;;
/**
* Get public keys from the keyring using their address.
* @param address - The address of the public keys to be fetched from the keyring.
* @returns An array of the public keys with that address.
*/
getPublicKeysForAddress(address: string): Array&lt;any&gt;;
/**
* Get all the trusted active keys.
* @returns An array of trusted active keys.
*/
getTrustedActiveKeys(): Array&lt;any&gt;;
/**
* Get all the trusted keys.
* @returns An array of trusted keys.
*/
getTrustedKeys(): Array&lt;any&gt;;
/**
* Add a key pair to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
importKeyPair(publicKey: any, privateKey: any): Promise&lt;void&gt;;
/**
* Add private key to keyring.
* @async
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
importPrivateKey(privateKey: any): Promise&lt;void&gt;;
/**
* Add public key to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @throws Error
*/
importPublicKey(publicKey: any): Promise&lt;void&gt;;
/**
* Verify that a private key is encrypted.
* @async
* @param privateKey - The private key to verify.
* @returns true - If private key is encrypted.
*/
isEncryptedPrivateKey(privateKey: any): Promise&lt;boolean&gt;;
/**
* Test if the input is a valid key.
* @async
* @param key - The input to be validated.
* @returns true - If the input is a valid key.
*/
isValidKey(key: any): Promise&lt;boolean&gt;;
/**
* Instantiate the keyring in the keystore.
* @async
*/
loadKeyring(): void;
/**
* Remove a public key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the keys to be removed from the keyring.
* @returns An array of the removed keys.
*/
removeKeysForId(keyId: string): Array&lt;any&gt;;
/**
* Remove a public key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the public key to be removed from the keyring.
* @returns The removed public key.
*/
removePublicKeyForId(keyId: string): any;
/**
* Remove a public key from the keyring.
* @param publicKey - The public key to be removed from the keyring.
* @returns The removed public key.
*/
removePublicKey(publicKey: any): any;
/** Remove all keys from the keyring. */
clearKeysInKeyring(): void;
/**
* Remove a public key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the public key to be removed from the keyring.
* @returns The removed public key.
*/
removePublicKeyForId(keyId: string): any;
/**
* Sign message using private key.
* @async
@@ -2023,81 +2023,9 @@ interface MutableKeyStore extends KeyStore {
/** Provides a keyring for pgp keys. */
class MutablePgpKeyStore implements MutableKeyStore {
/**
* Instantiate the keyring in the keystore.
* @async
*/
async loadKeyring(): Promise&lt;void&gt; {
await keyring.load();
await keyring.store();
}
/**
* Add a key pair to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
async importKeyPair(publicKey: any, privateKey: any): Promise&lt;void&gt; {
try {
await keyring.publicKeys.importKey(publicKey);
await keyring.privateKeys.importKey(privateKey);
} catch (error) {
throw error;
}
}
/**
* Add public key to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @throws Error
*/
async importPublicKey(publicKey: any): Promise&lt;void&gt; {
try {
await keyring.publicKeys.importKey(publicKey);
} catch (error) {
throw error;
}
}
/**
* Add private key to keyring.
* @async
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
async importPrivateKey(privateKey: any): Promise&lt;void&gt; {
try {
await keyring.privateKeys.importKey(privateKey);
} catch (error) {
throw error;
}
}
/**
* Get all the public keys.
* @returns An array of public keys.
*/
getPublicKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.keys;
}
/**
* Get all the trusted keys.
* @returns An array of trusted keys.
*/
getTrustedKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.keys;
}
/**
* Get all the trusted active keys.
* @returns An array of trusted active keys.
*/
getTrustedActiveKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.keys;
/** Remove all keys from the keyring. */
clearKeysInKeyring(): void {
keyring.clear();
}
/**
@@ -2111,50 +2039,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
return [];
}
/**
* Get all private keys.
* @returns An array of all private keys.
*/
getPrivateKeys(): Array&lt;any&gt; {
return keyring.privateKeys &amp;&amp; keyring.privateKeys.keys;
}
/**
* Get the first private key.
* @returns The first private key.
*/
getPrivateKey(): any {
return keyring.privateKeys &amp;&amp; keyring.privateKeys.keys[0];
}
/**
* Test if the input is a valid key.
* @async
* @param key - The input to be validated.
* @returns true - If the input is a valid key.
*/
async isValidKey(key): Promise&lt;boolean&gt; {
// There is supposed to be an openpgp.readKey() method but I can&#x27;t find it?
const testKey &#x3D; await openpgp.key.readArmored(key);
return !testKey.err;
}
/**
* Verify that a private key is encrypted.
* @async
* @param privateKey - The private key to verify.
* @returns true - If private key is encrypted.
*/
async isEncryptedPrivateKey(privateKey: any): Promise&lt;boolean&gt; {
const imported &#x3D; await openpgp.key.readArmored(privateKey);
for (const key of imported.keys) {
if (key.isDecrypted()) {
return false;
}
}
return true;
}
/**
* Get the first private key&#x27;s fingerprint.
* @returns The first private key&#x27;s fingerprint.
@@ -2178,6 +2062,32 @@ class MutablePgpKeyStore implements MutableKeyStore {
return key.getKeyId().toHex();
}
/**
* Get keys from the keyring using their keyId.
* @param keyId - The keyId of the keys to be fetched from the keyring.
* @returns An array of the keys with that keyId.
*/
getKeysForId(keyId: string): Array&lt;any&gt; {
return keyring.getKeysForId(keyId);
}
/**
* Get the first private key.
* @returns The first private key.
*/
getPrivateKey(): any {
return keyring.privateKeys &amp;&amp; keyring.privateKeys.keys[0];
}
/**
* Get a private key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the private key to be fetched from the keyring.
* @returns The private key with that keyId.
*/
getPrivateKeyForId(keyId): any {
return keyring.privateKeys &amp;&amp; keyring.privateKeys.getForId(keyId);
}
/**
* Get the first private key&#x27;s keyID.
* @returns The first private key&#x27;s keyId.
@@ -2192,12 +2102,11 @@ class MutablePgpKeyStore implements MutableKeyStore {
}
/**
* Get keys from the keyring using their keyId.
* @param keyId - The keyId of the keys to be fetched from the keyring.
* @returns An array of the keys with that keyId.
* Get all private keys.
* @returns An array of all private keys.
*/
getKeysForId(keyId: string): Array&lt;any&gt; {
return keyring.getKeysForId(keyId);
getPrivateKeys(): Array&lt;any&gt; {
return keyring.privateKeys &amp;&amp; keyring.privateKeys.keys;
}
/**
@@ -2209,15 +2118,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.getForId(keyId);
}
/**
* Get a private key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the private key to be fetched from the keyring.
* @returns The private key with that keyId.
*/
getPrivateKeyForId(keyId): any {
return keyring.privateKeys &amp;&amp; keyring.privateKeys.getForId(keyId);
}
/**
* Get a public key from the keyring using it&#x27;s subkeyId.
* @param subkeyId - The subkeyId of the public key to be fetched from the keyring.
@@ -2227,6 +2127,14 @@ class MutablePgpKeyStore implements MutableKeyStore {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.getForId(subkeyId, true);
}
/**
* Get all the public keys.
* @returns An array of public keys.
*/
getPublicKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.keys;
}
/**
* Get public keys from the keyring using their address.
* @param address - The address of the public keys to be fetched from the keyring.
@@ -2236,6 +2144,103 @@ class MutablePgpKeyStore implements MutableKeyStore {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.getForAddress(address);
}
/**
* Get all the trusted active keys.
* @returns An array of trusted active keys.
*/
getTrustedActiveKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.keys;
}
/**
* Get all the trusted keys.
* @returns An array of trusted keys.
*/
getTrustedKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.keys;
}
/**
* Add a key pair to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
async importKeyPair(publicKey: any, privateKey: any): Promise&lt;void&gt; {
try {
await keyring.publicKeys.importKey(publicKey);
await keyring.privateKeys.importKey(privateKey);
} catch (error) {
throw error;
}
}
/**
* Add private key to keyring.
* @async
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
async importPrivateKey(privateKey: any): Promise&lt;void&gt; {
try {
await keyring.privateKeys.importKey(privateKey);
} catch (error) {
throw error;
}
}
/**
* Add public key to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @throws Error
*/
async importPublicKey(publicKey: any): Promise&lt;void&gt; {
try {
await keyring.publicKeys.importKey(publicKey);
} catch (error) {
throw error;
}
}
/**
* Verify that a private key is encrypted.
* @async
* @param privateKey - The private key to verify.
* @returns true - If private key is encrypted.
*/
async isEncryptedPrivateKey(privateKey: any): Promise&lt;boolean&gt; {
const imported &#x3D; await openpgp.key.readArmored(privateKey);
for (const key of imported.keys) {
if (key.isDecrypted()) {
return false;
}
}
return true;
}
/**
* Test if the input is a valid key.
* @async
* @param key - The input to be validated.
* @returns true - If the input is a valid key.
*/
async isValidKey(key): Promise&lt;boolean&gt; {
// There is supposed to be an openpgp.readKey() method but I can&#x27;t find it?
const testKey &#x3D; await openpgp.key.readArmored(key);
return !testKey.err;
}
/**
* Instantiate the keyring in the keystore.
* @async
*/
async loadKeyring(): Promise&lt;void&gt; {
await keyring.load();
await keyring.store();
}
/**
* Remove a public key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the keys to be removed from the keyring.
@@ -2245,15 +2250,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
return keyring.removeKeysForId(keyId);
}
/**
* Remove a public key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the public key to be removed from the keyring.
* @returns The removed public key.
*/
removePublicKeyForId(keyId): any {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.removeForId(keyId);
}
/**
* Remove a public key from the keyring.
* @param publicKey - The public key to be removed from the keyring.
@@ -2264,9 +2260,13 @@ class MutablePgpKeyStore implements MutableKeyStore {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.removeForId(keyId);
}
/** Remove all keys from the keyring. */
clearKeysInKeyring(): void {
keyring.clear();
/**
* Remove a public key from the keyring using it&#x27;s keyId.
* @param keyId - The keyId of the public key to be removed from the keyring.
* @returns The removed public key.
*/
removePublicKeyForId(keyId): any {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.removeForId(keyId);
}
/**
@@ -2292,7 +2292,7 @@ class MutablePgpKeyStore implements MutableKeyStore {
}
/** @exports */
export { MutablePgpKeyStore, MutableKeyStore };
export { MutableKeyStore, MutablePgpKeyStore };
</code></pre>
</div>
</div>

View File

@@ -245,7 +245,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="62" class="link-to-prism">src/app/_pgp/pgp-signer.ts:62</a></div>
<div class="io-line">Defined in <a href="" data-line="60" class="link-to-prism">src/app/_pgp/pgp-signer.ts:60</a></div>
</td>
</tr>
@@ -278,7 +278,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="64" class="link-to-prism">src/app/_pgp/pgp-signer.ts:64</a></div>
<div class="io-line">Defined in <a href="" data-line="62" class="link-to-prism">src/app/_pgp/pgp-signer.ts:62</a></div>
</td>
</tr>
@@ -316,7 +316,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="60" class="link-to-prism">src/app/_pgp/pgp-signer.ts:60</a></div>
<div class="io-line">Defined in <a href="" data-line="64" class="link-to-prism">src/app/_pgp/pgp-signer.ts:64</a></div>
</td>
</tr>
@@ -349,7 +349,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="68" class="link-to-prism">src/app/_pgp/pgp-signer.ts:68</a></div>
<div class="io-line">Defined in <a href="" data-line="66" class="link-to-prism">src/app/_pgp/pgp-signer.ts:66</a></div>
</td>
</tr>
@@ -382,7 +382,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="74" class="link-to-prism">src/app/_pgp/pgp-signer.ts:74</a></div>
<div class="io-line">Defined in <a href="" data-line="68" class="link-to-prism">src/app/_pgp/pgp-signer.ts:68</a></div>
</td>
</tr>
@@ -481,7 +481,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="66" class="link-to-prism">src/app/_pgp/pgp-signer.ts:66</a></div>
<div class="io-line">Defined in <a href="" data-line="74" class="link-to-prism">src/app/_pgp/pgp-signer.ts:74</a></div>
</td>
</tr>
@@ -657,8 +657,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="146"
class="link-to-prism">src/app/_pgp/pgp-signer.ts:146</a></div>
<div class="io-line">Defined in <a href="" data-line="109"
class="link-to-prism">src/app/_pgp/pgp-signer.ts:109</a></div>
</td>
</tr>
@@ -738,8 +738,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="109"
class="link-to-prism">src/app/_pgp/pgp-signer.ts:109</a></div>
<div class="io-line">Defined in <a href="" data-line="144"
class="link-to-prism">src/app/_pgp/pgp-signer.ts:144</a></div>
</td>
</tr>
@@ -837,65 +837,65 @@ interface Signable {
/** Signature object interface */
interface Signature {
/** Encryption engine used. */
engine: string;
/** Encryption algorithm used */
algo: string;
/** Data to be signed. */
data: string;
/** Message digest */
digest: string;
/** Encryption engine used. */
engine: string;
}
/** Signer interface */
interface Signer {
/** Event triggered on successful signing of message. */
onsign(signature: Signature): void;
/** Event triggered on successful verification of a signature. */
onverify(flag: boolean): void;
/**
* Get the private key fingerprint.
* @returns A private key fingerprint.
*/
fingerprint(): string;
/** Event triggered on successful signing of message. */
onsign(signature: Signature): void;
/** Event triggered on successful verification of a signature. */
onverify(flag: boolean): void;
/**
* Load the message digest.
* @param material - A signable object.
* @returns true - If digest has been loaded successfully.
*/
prepare(material: Signable): boolean;
/**
* Verify that signature is valid.
* @param digest - The message that was signed.
* @param signature - The generated signature.
*/
verify(digest: string, signature: Signature): void;
/**
* Signs a message using a private key.
* @async
* @param digest - The message to be signed.
*/
sign(digest: string): Promise&lt;void&gt;;
/**
* Verify that signature is valid.
* @param digest - The message that was signed.
* @param signature - The generated signature.
*/
verify(digest: string, signature: Signature): void;
}
/** Provides functionality for signing and verifying signed messages. */
class PGPSigner implements Signer {
/** Encryption engine used. */
engine &#x3D; &#x27;pgp&#x27;;
/** Encryption algorithm used */
algo &#x3D; &#x27;sha256&#x27;;
/** Message digest */
dgst: string;
/** Generated signature */
signature: Signature;
/** Encryption engine used. */
engine &#x3D; &#x27;pgp&#x27;;
/** A keystore holding pgp keys. */
keyStore: MutableKeyStore;
/** A service that provides logging capabilities. */
loggingService: LoggingService;
/** Event triggered on successful signing of message. */
onsign: (signature: Signature) &#x3D;&gt; void;
/** Event triggered on successful verification of a signature. */
onverify: (flag: boolean) &#x3D;&gt; void;
/** A service that provides logging capabilities. */
loggingService: LoggingService;
/** Generated signature */
signature: Signature;
/**
* Initializing the Signer.
@@ -925,6 +925,41 @@ class PGPSigner implements Signer {
return true;
}
/**
* Signs a message using a private key.
* @async
* @param digest - The message to be signed.
*/
public async sign(digest: string): Promise&lt;void&gt; {
const m &#x3D; openpgp.cleartext.fromText(digest);
const pk &#x3D; this.keyStore.getPrivateKey();
if (!pk.isDecrypted()) {
const password &#x3D; window.prompt(&#x27;password&#x27;);
await pk.decrypt(password);
}
const opts &#x3D; {
message: m,
privateKeys: [pk],
detached: true,
};
openpgp
.sign(opts)
.then((s) &#x3D;&gt; {
this.signature &#x3D; {
engine: this.engine,
algo: this.algo,
data: s.signature,
// TODO: fix for browser later
digest,
};
this.onsign(this.signature);
})
.catch((e) &#x3D;&gt; {
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
this.onsign(undefined);
});
}
/**
* Verify that signature is valid.
* @param digest - The message that was signed.
@@ -961,45 +996,10 @@ class PGPSigner implements Signer {
this.onverify(false);
});
}
/**
* Signs a message using a private key.
* @async
* @param digest - The message to be signed.
*/
public async sign(digest: string): Promise&lt;void&gt; {
const m &#x3D; openpgp.cleartext.fromText(digest);
const pk &#x3D; this.keyStore.getPrivateKey();
if (!pk.isDecrypted()) {
const password &#x3D; window.prompt(&#x27;password&#x27;);
await pk.decrypt(password);
}
const opts &#x3D; {
message: m,
privateKeys: [pk],
detached: true,
};
openpgp
.sign(opts)
.then((s) &#x3D;&gt; {
this.signature &#x3D; {
engine: this.engine,
algo: this.algo,
data: s.signature,
// TODO: fix for browser later
digest,
};
this.onsign(this.signature);
})
.catch((e) &#x3D;&gt; {
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
this.onsign(undefined);
});
}
}
/** @exports */
export { Signable, Signature, Signer, PGPSigner };
export { PGPSigner, Signable, Signature, Signer };
</code></pre>
</div>
</div>

View File

@@ -194,7 +194,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="11" class="link-to-prism">src/app/_models/settings.ts:11</a></div>
<div class="io-line">Defined in <a href="" data-line="4" class="link-to-prism">src/app/_models/settings.ts:4</a></div>
</td>
</tr>
@@ -227,7 +227,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="9" class="link-to-prism">src/app/_models/settings.ts:9</a></div>
<div class="io-line">Defined in <a href="" data-line="6" class="link-to-prism">src/app/_models/settings.ts:6</a></div>
</td>
</tr>
@@ -260,7 +260,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="13" class="link-to-prism">src/app/_models/settings.ts:13</a></div>
<div class="io-line">Defined in <a href="" data-line="8" class="link-to-prism">src/app/_models/settings.ts:8</a></div>
</td>
</tr>
@@ -301,7 +301,7 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="4" class="link-to-prism">src/app/_models/settings.ts:4</a></div>
<div class="io-line">Defined in <a href="" data-line="10" class="link-to-prism">src/app/_models/settings.ts:10</a></div>
</td>
</tr>
@@ -327,17 +327,17 @@
<div class="tab-pane fade tab-source-code" id="c-source">
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">class Settings {
/** CIC Registry instance */
registry: any;
/** A resource for searching through blocks on the blockchain network. */
scanFilter: any;
/** Transaction Helper instance */
txHelper: any;
/** Web3 Object */
w3: W3 &#x3D; {
engine: undefined,
provider: undefined,
};
/** A resource for searching through blocks on the blockchain network. */
scanFilter: any;
/** CIC Registry instance */
registry: any;
/** Transaction Helper instance */
txHelper: any;
/**
* Initialize the settings.