feat: add native KDBX scaffolding and in-memory KeePass API
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { parseKdbxFile } from "../../src/kdbx/format";
|
||||
|
||||
function createBuffer(): Uint8Array {
|
||||
const buffer = new Uint8Array(16);
|
||||
buffer[0] = 0x03;
|
||||
buffer[1] = 0xd9;
|
||||
buffer[2] = 0xa2;
|
||||
buffer[3] = 0x9a;
|
||||
buffer[4] = 0x67;
|
||||
buffer[5] = 0xfb;
|
||||
buffer[6] = 0x4b;
|
||||
buffer[7] = 0xb5;
|
||||
buffer[8] = 0x01;
|
||||
buffer[9] = 0x00;
|
||||
buffer[10] = 0x04;
|
||||
buffer[11] = 0x00;
|
||||
buffer[12] = 0xaa;
|
||||
buffer[13] = 0xbb;
|
||||
buffer[14] = 0xcc;
|
||||
buffer[15] = 0xdd;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
describe("parseKdbxFile", () => {
|
||||
test("extracts header and payload", () => {
|
||||
const file = parseKdbxFile(createBuffer());
|
||||
expect(file.header.version).toEqual({ major: 4, minor: 1 });
|
||||
expect(Array.from(file.payload)).toEqual([0xaa, 0xbb, 0xcc, 0xdd]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user