Coverage for src / kdbxtool / __init__.py: 100%
10 statements
« prev ^ index » next coverage.py v7.12.0, created at 2025-12-19 21:22 +0000
« prev ^ index » next coverage.py v7.12.0, created at 2025-12-19 21:22 +0000
1"""kdbxtool - A modern, secure Python library for KeePass KDBX databases.
3This library provides a clean, type-safe API for reading and writing KeePass
4database files (KDBX format). It prioritizes security with:
5- Secure memory handling (zeroization of sensitive data)
6- Constant-time comparisons for authentication
7- Modern cryptographic defaults (Argon2d, ChaCha20)
9Example:
10 from kdbxtool import Database
12 db = Database.open("vault.kdbx", password="secret")
13 entry = db.find_entries(title="Gmail")[0]
14 print(entry.username)
16 # Create new entry
17 db.root_group.create_entry(
18 title="New Site",
19 username="user",
20 password="pass123",
21 )
22 db.save()
23"""
25__version__ = "0.1.0"
27from .database import Database, DatabaseSettings
28from .exceptions import (
29 AuthenticationError,
30 CorruptedDataError,
31 CredentialError,
32 CryptoError,
33 DatabaseError,
34 DecryptionError,
35 EntryNotFoundError,
36 FormatError,
37 GroupNotFoundError,
38 InvalidKeyFileError,
39 InvalidPasswordError,
40 InvalidSignatureError,
41 InvalidXmlError,
42 Kdbx3UpgradeRequired,
43 KdbxError,
44 KdfError,
45 MergeError,
46 MissingCredentialsError,
47 TwofishNotAvailableError,
48 UnknownCipherError,
49 UnsupportedVersionError,
50 YubiKeyError,
51 YubiKeyNotAvailableError,
52 YubiKeyNotFoundError,
53 YubiKeySlotError,
54 YubiKeyTimeoutError,
55)
56from .merge import DeletedObject, MergeMode, MergeResult
57from .models import Attachment, Entry, Group, HistoryEntry, Times
58from .security import AesKdfConfig, Argon2Config, Cipher, KdfType
59from .security.keyfile import (
60 KeyFileVersion,
61 create_keyfile,
62 create_keyfile_bytes,
63 parse_keyfile,
64)
65from .security.yubikey import (
66 YubiKeyConfig,
67 check_slot_configured,
68 list_yubikeys,
69)
70from .templates import EntryTemplate, IconId, Templates
72__all__ = [
73 # Core classes
74 "AesKdfConfig",
75 "Argon2Config",
76 "Attachment",
77 "Database",
78 "DatabaseSettings",
79 "Entry",
80 "Group",
81 "HistoryEntry",
82 "Times",
83 "Cipher",
84 "KdfType",
85 # Merge support
86 "MergeMode",
87 "MergeResult",
88 "DeletedObject",
89 # Entry templates
90 "EntryTemplate",
91 "IconId",
92 "Templates",
93 # Keyfile support
94 "KeyFileVersion",
95 "create_keyfile",
96 "create_keyfile_bytes",
97 "parse_keyfile",
98 # YubiKey support
99 "YubiKeyConfig",
100 "check_slot_configured",
101 "list_yubikeys",
102 # Exceptions
103 "KdbxError",
104 "FormatError",
105 "InvalidSignatureError",
106 "UnsupportedVersionError",
107 "CorruptedDataError",
108 "CryptoError",
109 "DecryptionError",
110 "AuthenticationError",
111 "KdfError",
112 "TwofishNotAvailableError",
113 "UnknownCipherError",
114 "CredentialError",
115 "InvalidPasswordError",
116 "InvalidKeyFileError",
117 "MergeError",
118 "MissingCredentialsError",
119 "DatabaseError",
120 "EntryNotFoundError",
121 "GroupNotFoundError",
122 "InvalidXmlError",
123 "Kdbx3UpgradeRequired",
124 "YubiKeyError",
125 "YubiKeyNotAvailableError",
126 "YubiKeyNotFoundError",
127 "YubiKeySlotError",
128 "YubiKeyTimeoutError",
129]