Skip to content

Commit

Permalink
fix: privateKeysAreLocked should be false when seeds removed (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejborstnik authored Apr 8, 2024
1 parent 9753ae9 commit ad22118
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions features/keychain/module/__tests__/lock-private-keys.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions features/keychain/module/keychain.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export class Keychain {

removeAllSeeds() {
this.#masters = Object.create(null)
this.#privateKeysAreLocked = false
}

#getPrivateHDKey = ({ seedId, keyId, getPrivateHDKeySymbol }) => {
Expand Down

0 comments on commit ad22118

Please sign in to comment.