* Derives a cryptographic key from a password string using PBKDF2.
(password: string)
| 7 | * Derives a cryptographic key from a password string using PBKDF2. |
| 8 | */ |
| 9 | async function getPasswordKey(password: string): Promise<CryptoKey> { |
| 10 | const enc = new TextEncoder(); |
| 11 | return await crypto.subtle.importKey( |
| 12 | "raw", |
| 13 | enc.encode(password), |
| 14 | { name: "PBKDF2" }, |
| 15 | false, |
| 16 | ["deriveBits", "deriveKey"], |
| 17 | ); |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Derives an AES-GCM key using the password key and a random salt. |
no outgoing calls
no test coverage detected