Refactor order of item to follow alphabetical order.
This commit is contained in:
@@ -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 = 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.
|
||||
@@ -1922,30 +1882,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.
|
||||
@@ -1957,11 +1893,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.
|
||||
@@ -1969,49 +1900,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
|
||||
@@ -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<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();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2111,50 +2039,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.
|
||||
@@ -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<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.
|
||||
@@ -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<any> {
|
||||
return keyring.getKeysForId(keyId);
|
||||
getPrivateKeys(): Array<any> {
|
||||
return keyring.privateKeys && keyring.privateKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2209,15 +2118,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.
|
||||
@@ -2227,6 +2127,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.
|
||||
@@ -2236,6 +2144,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.
|
||||
@@ -2245,15 +2250,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.
|
||||
@@ -2264,9 +2260,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2292,7 +2292,7 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
}
|
||||
|
||||
/** @exports */
|
||||
export { MutablePgpKeyStore, MutableKeyStore };
|
||||
export { MutableKeyStore, MutablePgpKeyStore };
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user