diff --git a/features/keychain/module/__tests__/lock-private-keys.test.js b/features/keychain/module/__tests__/lock-private-keys.test.js index 24d80baa..441db0b2 100644 --- a/features/keychain/module/__tests__/lock-private-keys.test.js +++ b/features/keychain/module/__tests__/lock-private-keys.test.js @@ -43,6 +43,20 @@ describe('lockPrivateKeys', () => { keychain.removeAllSeeds() }) + it('should allow usage when locked after removeAllSeeds and re-adding seeds', async () => { + const keychain = createKeychain({ seed }) + keychain.lockPrivateKeys() + keychain.removeAllSeeds() + keychain.addSeed(seed) + + const keyId = createKeyIdentifierForExodus({ exoType: 'FUSION' }) + await keychain.exportKey({ + seedId, + keyId, + exportPrivate: true, + }) + }) + it('should allow exportKey for public keys when locked', async () => { const keychain = createKeychain({ seed }) keychain.lockPrivateKeys() diff --git a/features/keychain/module/keychain.js b/features/keychain/module/keychain.js index bd2bade5..4ef332b7 100644 --- a/features/keychain/module/keychain.js +++ b/features/keychain/module/keychain.js @@ -85,6 +85,7 @@ export class Keychain { removeAllSeeds() { this.#masters = Object.create(null) + this.#privateKeysAreLocked = false } #getPrivateHDKey = ({ seedId, keyId, getPrivateHDKeySymbol }) => {