feat: add write support for KeePass entries and groups
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
# kdbx-lib
|
||||
|
||||
TypeScript wrapper around `pykeepass` for reading KeePass `.kdbx` files.
|
||||
TypeScript wrapper around `pykeepass` for reading and modifying KeePass `.kdbx` files.
|
||||
|
||||
## Overview
|
||||
|
||||
This project uses:
|
||||
- TypeScript as the public API
|
||||
- Python as the runtime backend
|
||||
- `pykeepass` to read KeePass databases
|
||||
- `pykeepass` to read and update KeePass databases
|
||||
|
||||
The TypeScript layer launches a Python bridge per request and exchanges JSON through stdin/stdout.
|
||||
|
||||
@@ -74,6 +74,27 @@ Finds entries by partial match and returns the full entry objects.
|
||||
### `listGroups()`
|
||||
Returns all groups, including their names and paths.
|
||||
|
||||
### `createEntry(entry)`
|
||||
Creates a new entry in the target database and persists it immediately.
|
||||
|
||||
#### Entry input
|
||||
- `title`: entry title
|
||||
- `username`: optional username
|
||||
- `password`: optional password
|
||||
- `url`: optional URL
|
||||
- `notes`: optional notes
|
||||
- `groupPath`: optional target group path
|
||||
|
||||
### `createGroup(group)`
|
||||
Creates a new group and persists it immediately.
|
||||
|
||||
#### Group input
|
||||
- `name`: group name
|
||||
- `path`: optional parent group path
|
||||
|
||||
### `save()`
|
||||
Persists the current database state.
|
||||
|
||||
### `close()`
|
||||
No-op for now.
|
||||
|
||||
@@ -83,5 +104,6 @@ No-op for now.
|
||||
- This is simple and robust for a first version.
|
||||
- Errors from the Python bridge are propagated to the TypeScript API, including invalid or empty output.
|
||||
- A persistent Python process can be added later if needed.
|
||||
- Write operations currently open, modify, and save the database per command.
|
||||
- Bundled fixtures include `tests/fixtures/data.kdbx` and `tests/fixtures/empty.kdbx`; the companion JSON file stores the password and expected content for tests/examples.
|
||||
- Integration tests validate the bundled `data.kdbx` entry-by-entry and group-by-group against `tests/fixtures/data.kdbx.json`, and may skip cleanly when `pykeepass` is unavailable.
|
||||
|
||||
Reference in New Issue
Block a user