]> git.codecow.com Git - libnemo.git/commitdiff
Configure purpose as KeyUsage array from the start instead of packing in function...
authorChris Duncan <chris@zoso.dev>
Tue, 31 Mar 2026 07:47:48 +0000 (00:47 -0700)
committerChris Duncan <chris@zoso.dev>
Tue, 31 Mar 2026 07:47:48 +0000 (00:47 -0700)
src/lib/vault/passkey.ts

index 7a14e1df69d9d73ad448279582604180cee2d25f..97d9e98168ec95b125ef5aae70de21858158fbc6 100644 (file)
@@ -17,7 +17,7 @@ export class Passkey {
 
                        // 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'])
@@ -34,7 +34,7 @@ export class Passkey {
                                                length: 256
                                        }
                                        return crypto.subtle
-                                               .deriveKey(derivationAlgorithm, derivationKey, derivedKeyType, false, [purpose])
+                                               .deriveKey(derivationAlgorithm, derivationKey, derivedKeyType, false, purpose)
                                })
                                .catch(err => {
                                        console.error(err)