// Only unlocking should decrypt the vault; other sensitive actions should
// throw if the vault is still locked and encrypted
- const purpose = action === 'unlock' ? 'decrypt' : 'encrypt'
+ const purpose: KeyUsage[] = action === 'unlock' ? ['decrypt'] : ['encrypt']
return crypto.subtle
.importKey('raw', password, 'PBKDF2', false, ['deriveKey'])
length: 256
}
return crypto.subtle
- .deriveKey(derivationAlgorithm, derivationKey, derivedKeyType, false, [purpose])
+ .deriveKey(derivationAlgorithm, derivationKey, derivedKeyType, false, purpose)
})
.catch(err => {
console.error(err)