2.0 KiB
2.0 KiB
Project
Goal
Provide a small read-only TypeScript wrapper around KeePass .kdbx databases using a Python bridge powered by pykeepass.
Architecture
- Public API is TypeScript.
src/python/bridge.pyis the runtime backend and usespykeepass.- TypeScript spawns a Python process per request; there is no persistent worker yet.
- JSON is exchanged over stdin/stdout.
- Bridge errors, empty output, invalid JSON, missing files, and backend exceptions are surfaced as TypeScript errors.
Public API
openKeePassDatabase(path, options)KeePassDatabase.listEntries()KeePassDatabase.findEntries(query)KeePassDatabase.listGroups()KeePassDatabase.close()is a no-op.
Types
- Entries expose:
title,username,password,url,notes, optionalgroupPath, optionalotp. - Groups expose:
name,path. - Open options support
passwordand optionalkeyFile. - Find queries support partial matching on
title,username,url, andgroupPath.
Runtime details
- Python path defaults to
.venv/bin/python3. - It can be overridden with
PYTHON_PATH. bun run setup:pythoncreates.venvif needed and installspykeepass.- The bridge also works with an existing project-local virtual environment.
Fixtures and tests
- Bundled fixtures:
tests/fixtures/data.kdbxandtests/fixtures/empty.kdbx. - Companion JSON fixture:
tests/fixtures/data.kdbx.jsonstores the password and expected content. - Unit tests in
tests/unit/mock the child process and validate bridge parsing/error handling. - Integration tests in
tests/integration/usedata.kdbxto verify entries, groups, partial search, and OTP/TOTP output whenpykeepassis installed. - The integration test runner checks for
pykeepassand skips cleanly when it is unavailable.
Main scripts
bun run test/bun testbun run src/example.tsbun run src/test-integration.tsbun run setup:python
Current direction
Keep improving failure-path coverage and keep the API minimal unless a concrete need appears.