MCPcopy Create free account
hub / github.com/Lakr233/AssppWeb / getPasswordKey

Function getPasswordKey

frontend/src/utils/crypto.ts:9–18  ·  view source on GitHub ↗

* Derives a cryptographic key from a password string using PBKDF2.

(password: string)

Source from the content-addressed store, hash-verified

7 * Derives a cryptographic key from a password string using PBKDF2.
8 */
9async 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.

Callers 2

encryptDataFunction · 0.85
decryptDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected