Add method for removing keys from keyring.

This commit is contained in:
Spencer Ofwiti 2021-02-16 16:30:02 +03:00
parent 1718ae01ba
commit a6a602938e
2 changed files with 8 additions and 3 deletions

View File

@ -19,7 +19,8 @@ interface MutableKeyStore{
getPublicKeyForSubkeyId: (subkeyId: string) => any;
getPublicKeysForAddress: (address: string) => Array<any>;
removeKeysForId: (keyId: string) => Array<any>;
removePublicKeysForId: (keyId: string) => any;
removePublicKeyForId: (keyId: string) => any;
removePublicKey: (publicKey: any) => any;
clearKeysInKeyring: () => void;
// revokeKey: (publicKey) => void;
}
@ -105,7 +106,12 @@ class MutablePgpKeyStore implements MutableKeyStore{
return keyring.removeKeysForId(keyId);
}
removePublicKeysForId(keyId): any {
removePublicKeyForId(keyId): any {
return keyring.publicKeys.removeForId(keyId);
}
removePublicKey(publicKey: any): any {
const keyId = publicKey.getKeyId().toHex();
return keyring.publicKeys.removeForId(keyId);
}

View File

@ -4,7 +4,6 @@ import { hobaParseChallengeHeader } from '@src/assets/js/hoba.js';
import { signChallenge } from '@src/assets/js/hoba-pgp.js';
import {environment} from '@src/environments/environment';
import {HttpClient} from '@angular/common/http';
const openpgp = require('openpgp');
const origin = 'http://localhost:4444';
const pgpKeyStore = new UnsafeKeyStore();