Refactor order of item to follow alphabetical order.
This commit is contained in:
@@ -200,8 +200,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="154"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:154</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="16"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:16</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -241,8 +241,8 @@
|
||||
|
||||
<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-key-store.ts:64</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="24"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:24</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -288,8 +288,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="93"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:93</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="29"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:29</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -335,8 +335,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="99"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:99</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="35"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:35</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -415,8 +415,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="110"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:110</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="41"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:41</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -495,8 +495,8 @@
|
||||
|
||||
<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-key-store.ts:74</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="46"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:46</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -542,8 +542,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="122"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:122</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="52"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:52</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -622,8 +622,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="104"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:104</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="57"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:57</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -669,8 +669,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="69"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:69</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="62"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:62</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -716,8 +716,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="116"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:116</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="68"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:68</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -796,8 +796,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="128"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:128</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="74"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:74</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -876,8 +876,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="46"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:46</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="79"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:79</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -923,8 +923,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="134"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:134</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="85"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:85</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1003,8 +1003,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="56"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:56</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="90"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:90</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1050,8 +1050,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="51"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:51</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="95"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:95</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1097,8 +1097,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="27"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:27</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="103"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:103</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1194,8 +1194,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="41"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:41</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="110"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:110</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1273,8 +1273,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="34"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:34</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="117"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:117</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1352,8 +1352,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="88"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:88</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="124"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:124</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1432,8 +1432,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="81"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:81</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="131"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:131</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1512,8 +1512,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="19"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:19</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="136"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:136</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1553,8 +1553,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="140"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:140</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="142"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:142</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1633,8 +1633,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="152"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:152</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="148"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:148</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1713,8 +1713,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-key-store.ts:146</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="154"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:154</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1870,48 +1870,8 @@ const keyring = 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<void>;
|
||||
/**
|
||||
* Add public key to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importPublicKey(publicKey: any): Promise<void>;
|
||||
/**
|
||||
* Add private key to keyring.
|
||||
* @async
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importPrivateKey(privateKey: any): Promise<void>;
|
||||
/**
|
||||
* Get all the public keys.
|
||||
* @returns An array of public keys.
|
||||
*/
|
||||
getPublicKeys(): Array<any>;
|
||||
/**
|
||||
* Get all the trusted keys.
|
||||
* @returns An array of trusted keys.
|
||||
*/
|
||||
getTrustedKeys(): Array<any>;
|
||||
/**
|
||||
* Get all the trusted active keys.
|
||||
* @returns An array of trusted active keys.
|
||||
*/
|
||||
getTrustedActiveKeys(): Array<any>;
|
||||
/** Remove all keys from the keyring. */
|
||||
clearKeysInKeyring(): void;
|
||||
/**
|
||||
* Get all the encryption keys.
|
||||
* @returns An array of encryption keys.
|
||||
@@ -1920,30 +1880,6 @@ interface MutableKeyStore extends KeyStore {
|
||||
* This is included to appease the implemented Keystore interface.
|
||||
*/
|
||||
getEncryptKeys(): Array<any>;
|
||||
/**
|
||||
* Get all private keys.
|
||||
* @returns An array of all private keys.
|
||||
*/
|
||||
getPrivateKeys(): Array<any>;
|
||||
/**
|
||||
* 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<boolean>;
|
||||
/**
|
||||
* 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<boolean>;
|
||||
/**
|
||||
* Get the first private key's fingerprint.
|
||||
* @returns The first private key's fingerprint.
|
||||
@@ -1955,11 +1891,6 @@ interface MutableKeyStore extends KeyStore {
|
||||
* @returns The key's keyId.
|
||||
*/
|
||||
getKeyId(key: any): string;
|
||||
/**
|
||||
* Get the first private key's keyID.
|
||||
* @returns The first private key'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.
|
||||
@@ -1967,49 +1898,118 @@ interface MutableKeyStore extends KeyStore {
|
||||
*/
|
||||
getKeysForId(keyId: string): Array<any>;
|
||||
/**
|
||||
* Get a public key from the keyring using it'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'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's keyID.
|
||||
* @returns The first private key's keyId.
|
||||
*/
|
||||
getPrivateKeyId(): string;
|
||||
/**
|
||||
* Get all private keys.
|
||||
* @returns An array of all private keys.
|
||||
*/
|
||||
getPrivateKeys(): Array<any>;
|
||||
/**
|
||||
* Get a public key from the keyring using it'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'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<any>;
|
||||
/**
|
||||
* 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<any>;
|
||||
/**
|
||||
* Get all the trusted active keys.
|
||||
* @returns An array of trusted active keys.
|
||||
*/
|
||||
getTrustedActiveKeys(): Array<any>;
|
||||
/**
|
||||
* Get all the trusted keys.
|
||||
* @returns An array of trusted keys.
|
||||
*/
|
||||
getTrustedKeys(): Array<any>;
|
||||
/**
|
||||
* 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<void>;
|
||||
/**
|
||||
* Add private key to keyring.
|
||||
* @async
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importPrivateKey(privateKey: any): Promise<void>;
|
||||
/**
|
||||
* Add public key to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importPublicKey(publicKey: any): Promise<void>;
|
||||
/**
|
||||
* 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<boolean>;
|
||||
/**
|
||||
* 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<boolean>;
|
||||
/**
|
||||
* Instantiate the keyring in the keystore.
|
||||
* @async
|
||||
*/
|
||||
loadKeyring(): void;
|
||||
/**
|
||||
* Remove a public key from the keyring using it'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<any>;
|
||||
/**
|
||||
* Remove a public key from the keyring using it'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'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
|
||||
@@ -2021,81 +2021,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<void> {
|
||||
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<void> {
|
||||
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<void> {
|
||||
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<void> {
|
||||
try {
|
||||
await keyring.privateKeys.importKey(privateKey);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the public keys.
|
||||
* @returns An array of public keys.
|
||||
*/
|
||||
getPublicKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the trusted keys.
|
||||
* @returns An array of trusted keys.
|
||||
*/
|
||||
getTrustedKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the trusted active keys.
|
||||
* @returns An array of trusted active keys.
|
||||
*/
|
||||
getTrustedActiveKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
/** Remove all keys from the keyring. */
|
||||
clearKeysInKeyring(): void {
|
||||
keyring.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2109,50 +2037,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all private keys.
|
||||
* @returns An array of all private keys.
|
||||
*/
|
||||
getPrivateKeys(): Array<any> {
|
||||
return keyring.privateKeys && keyring.privateKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first private key.
|
||||
* @returns The first private key.
|
||||
*/
|
||||
getPrivateKey(): any {
|
||||
return keyring.privateKeys && 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<boolean> {
|
||||
// There is supposed to be an openpgp.readKey() method but I can't find it?
|
||||
const testKey = 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<boolean> {
|
||||
const imported = await openpgp.key.readArmored(privateKey);
|
||||
for (const key of imported.keys) {
|
||||
if (key.isDecrypted()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first private key's fingerprint.
|
||||
* @returns The first private key's fingerprint.
|
||||
@@ -2176,6 +2060,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<any> {
|
||||
return keyring.getKeysForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first private key.
|
||||
* @returns The first private key.
|
||||
*/
|
||||
getPrivateKey(): any {
|
||||
return keyring.privateKeys && keyring.privateKeys.keys[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a private key from the keyring using it'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 && keyring.privateKeys.getForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first private key's keyID.
|
||||
* @returns The first private key's keyId.
|
||||
@@ -2190,12 +2100,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<any> {
|
||||
return keyring.getKeysForId(keyId);
|
||||
getPrivateKeys(): Array<any> {
|
||||
return keyring.privateKeys && keyring.privateKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2207,15 +2116,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.publicKeys && keyring.publicKeys.getForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a private key from the keyring using it'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 && keyring.privateKeys.getForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a public key from the keyring using it's subkeyId.
|
||||
* @param subkeyId - The subkeyId of the public key to be fetched from the keyring.
|
||||
@@ -2225,6 +2125,14 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.publicKeys && keyring.publicKeys.getForId(subkeyId, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the public keys.
|
||||
* @returns An array of public keys.
|
||||
*/
|
||||
getPublicKeys(): Array<any> {
|
||||
return keyring.publicKeys && 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.
|
||||
@@ -2234,6 +2142,103 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.publicKeys && keyring.publicKeys.getForAddress(address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the trusted active keys.
|
||||
* @returns An array of trusted active keys.
|
||||
*/
|
||||
getTrustedActiveKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the trusted keys.
|
||||
* @returns An array of trusted keys.
|
||||
*/
|
||||
getTrustedKeys(): Array<any> {
|
||||
return keyring.publicKeys && 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<void> {
|
||||
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<void> {
|
||||
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<void> {
|
||||
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<boolean> {
|
||||
const imported = 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<boolean> {
|
||||
// There is supposed to be an openpgp.readKey() method but I can't find it?
|
||||
const testKey = await openpgp.key.readArmored(key);
|
||||
return !testKey.err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate the keyring in the keystore.
|
||||
* @async
|
||||
*/
|
||||
async loadKeyring(): Promise<void> {
|
||||
await keyring.load();
|
||||
await keyring.store();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a public key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the keys to be removed from the keyring.
|
||||
@@ -2243,15 +2248,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.removeKeysForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a public key from the keyring using it'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 && keyring.publicKeys.removeForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a public key from the keyring.
|
||||
* @param publicKey - The public key to be removed from the keyring.
|
||||
@@ -2262,9 +2258,13 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.publicKeys && keyring.publicKeys.removeForId(keyId);
|
||||
}
|
||||
|
||||
/** Remove all keys from the keyring. */
|
||||
clearKeysInKeyring(): void {
|
||||
keyring.clear();
|
||||
/**
|
||||
* Remove a public key from the keyring using it'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 && keyring.publicKeys.removeForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2290,7 +2290,7 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
}
|
||||
|
||||
/** @exports */
|
||||
export { MutablePgpKeyStore, MutableKeyStore };
|
||||
export { MutableKeyStore, MutablePgpKeyStore };
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user