feat: add native KDBX scaffolding and in-memory KeePass API

This commit is contained in:
2026-05-10 01:17:53 +02:00
parent 210f7b414b
commit 15332896fe
25 changed files with 437 additions and 713 deletions
+15
View File
@@ -0,0 +1,15 @@
import { createHash, pbkdf2Sync } from "node:crypto";
export function sha256(data: Uint8Array | string): Uint8Array {
const hash = createHash("sha256");
hash.update(data);
return new Uint8Array(hash.digest());
}
export function deriveKey(password: string, salt: Uint8Array, rounds: number, length = 32): Uint8Array {
if (!Number.isFinite(rounds) || rounds <= 0) {
throw new Error("Invalid key derivation rounds");
}
return new Uint8Array(pbkdf2Sync(password, Buffer.from(salt), rounds, length, "sha256"));
}