Python library for the KeePassXC browser extension protocol
Project description
KeePassXC Browser API
Python library for communicating with KeePassXC via the browser extension protocol (NaCl-encrypted JSON over a Unix socket).
Features
- NaCl-encrypted communication with KeePassXC
- One-time association flow (user approves in KeePassXC window)
- Biometric unlock (TouchID / system unlock) via
triggerUnlock - Full browser API support: read entries, write entries, manage groups, TOTP, password generation, lock database
- Cross-platform: macOS and Linux
- Shared config (
~/.keepassxc/browser-api.json) — associate once, use with all tools
Installation
pip install keepassxc-browser-api
Quick start
from keepassxc_browser_api import BrowserClient, BrowserConfig
config = BrowserConfig.load()
client = BrowserClient(config)
# First time: associate with KeePassXC (requires user approval)
if not config.associations:
client.setup()
config.save()
# Ensure DB is unlocked (triggers TouchID/biometrics if locked)
client.ensure_unlocked()
# API methods auto-connect when needed
entries = client.get_logins("https://example.com")
for e in entries:
print(e.name, e.login)
# Clean up when done
client.disconnect()
Or use the context manager for automatic cleanup:
with BrowserClient(config) as client:
entries = client.get_logins("https://example.com")
totp = client.get_totp(entries[0].uuid)
API
BrowserClient
| Method | Description |
|---|---|
setup() |
First-time association (user approves in KeePassXC) |
ensure_unlocked() |
Connect and unlock (triggers TouchID if locked) |
get_logins(url, ...) |
Find entries matching a URL |
set_login(url, username, password, ...) |
Create or update an entry |
get_database_entries() |
Return all entries |
get_database_groups() |
Return all groups (tree) |
create_group(name, parent_uuid) |
Create a new group |
get_totp(uuid) |
Get TOTP code for an entry |
delete_entry(uuid) |
Delete an entry |
lock_database() |
Lock the database |
generate_password() |
Generate a password (uses KeePassXC settings) |
request_autotype(search) |
Trigger KeePassXC global auto-type |
Note:
passkeys-getandpasskeys-registerare not implemented. They require complex WebAuthn/CBOR data structures and are only available in KeePassXC builds compiled withWITH_XC_BROWSER_PASSKEYS.
BrowserConfig
Configuration stored at ~/.keepassxc/browser-api.json (mode 0600).
config = BrowserConfig.load() # Load from default path
config = BrowserConfig.load(path) # Load from custom path
config.save() # Save to default path
config.save(path) # Save to custom path
Protocol documentation
For a detailed description of the KeePassXC browser extension protocol (wire format, encryption, all actions, error codes), see PROTOCOL.md.
Development
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=keepassxc_browser_api
# Lint
ruff check --ignore=E501 --exclude=__init__.py ./keepassxc_browser_api
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file keepassxc_browser_api-0.1.0.tar.gz.
File metadata
- Download URL: keepassxc_browser_api-0.1.0.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da9f2e8678fe32c9bb6dd4a1786df5852772845d4a2672a4bc16e28e5b857b5f
|
|
| MD5 |
01fc0a224bbf3070f809d5bce953e453
|
|
| BLAKE2b-256 |
ae17b1e5603295bf4a31c32d1d0f184b358aa13bf5cf9edcf201ba54533a0581
|
Provenance
The following attestation bundles were made for keepassxc_browser_api-0.1.0.tar.gz:
Publisher:
pypi.yml on mietzen/keepassxc-browser-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keepassxc_browser_api-0.1.0.tar.gz -
Subject digest:
da9f2e8678fe32c9bb6dd4a1786df5852772845d4a2672a4bc16e28e5b857b5f - Sigstore transparency entry: 1280746174
- Sigstore integration time:
-
Permalink:
mietzen/keepassxc-browser-api@e49efb4a71dc63978be51da8580d9721d6ccbbea -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mietzen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@e49efb4a71dc63978be51da8580d9721d6ccbbea -
Trigger Event:
release
-
Statement type:
File details
Details for the file keepassxc_browser_api-0.1.0-py3-none-any.whl.
File metadata
- Download URL: keepassxc_browser_api-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a17aa824a49222462c331be2dcde15e2825ea3a2783e4dc519b2aaebc0ee4e2
|
|
| MD5 |
f733c75b8b7639f07028b0d11312f236
|
|
| BLAKE2b-256 |
4c2c6c77505002d7f022385cb1bb144e8450aee95222d793607685f209208283
|
Provenance
The following attestation bundles were made for keepassxc_browser_api-0.1.0-py3-none-any.whl:
Publisher:
pypi.yml on mietzen/keepassxc-browser-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keepassxc_browser_api-0.1.0-py3-none-any.whl -
Subject digest:
9a17aa824a49222462c331be2dcde15e2825ea3a2783e4dc519b2aaebc0ee4e2 - Sigstore transparency entry: 1280746179
- Sigstore integration time:
-
Permalink:
mietzen/keepassxc-browser-api@e49efb4a71dc63978be51da8580d9721d6ccbbea -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/mietzen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@e49efb4a71dc63978be51da8580d9721d6ccbbea -
Trigger Event:
release
-
Statement type: