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
+18
View File
@@ -0,0 +1,18 @@
import { describe, expect, test } from "bun:test";
import { deriveKey, sha256 } from "../../src/kdbx/crypto";
describe("kdbx crypto helpers", () => {
test("sha256 hashes data deterministically", () => {
const digest = sha256("abc");
expect(Array.from(digest)).toHaveLength(32);
});
test("deriveKey rejects invalid rounds", () => {
expect(() => deriveKey("secret", new Uint8Array([1, 2, 3]), 0)).toThrow("Invalid key derivation rounds");
});
test("deriveKey produces a 32-byte key", () => {
const key = deriveKey("secret", new Uint8Array([1, 2, 3]), 1000);
expect(Array.from(key)).toHaveLength(32);
});
});