feat: add native KDBX scaffolding and in-memory KeePass API
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { openKeePassDatabase } from "./keepass";
|
||||
|
||||
async function main() {
|
||||
const { password } = JSON.parse(await readFile("tests/fixtures/data.kdbx.json", "utf8")) as { password: string };
|
||||
|
||||
const db = openKeePassDatabase("tests/fixtures/data.kdbx", { password });
|
||||
const entries = await db.listEntries();
|
||||
|
||||
console.log(JSON.stringify({ ok: true, count: entries.length }, null, 2));
|
||||
const db = openKeePassDatabase("memory.kdbx", { password: "demo" });
|
||||
await db.createGroup({ name: "Folder1" });
|
||||
await db.createEntry({ title: "Entry", username: "user", password: "secret" });
|
||||
console.log(JSON.stringify({ ok: true, entries: await db.listEntries(), groups: await db.listGroups() }, null, 2));
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user