Skip to content

Commit 046452a

Browse files
committed
Refactor database creation into dedicated builder module
- Extract _build_kdbx4_structure() to kdbx_parsing/builder.py - Add KDBX3 database creation support - Replace string params with type-safe dataclasses: - Argon2Config with .standard(), .high_security(), .fast() presets - AesKdfConfig with .standard(), .high_security() presets - Cipher and KdfAlgorithm StrEnums - Add 14 new tests for KDBX3 creation and config presets
1 parent 308ec31 commit 046452a

5 files changed

Lines changed: 708 additions & 207 deletions

File tree

pykeepass/__init__.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,23 @@
88
from .attachment import Attachment
99
from .icons import icons
1010
from .version import __version__
11+
from .kdbx_parsing import (
12+
Argon2Config,
13+
AesKdfConfig,
14+
Cipher,
15+
KdfAlgorithm,
16+
)
1117

12-
__all__ = ["__version__", "PyKeePass", "Entry", "Group", "Attachment", "icons", "create_database"]
18+
__all__ = [
19+
"__version__",
20+
"PyKeePass",
21+
"Entry",
22+
"Group",
23+
"Attachment",
24+
"icons",
25+
"create_database",
26+
"Argon2Config",
27+
"AesKdfConfig",
28+
"Cipher",
29+
"KdfAlgorithm",
30+
]

pykeepass/kdbx_parsing/__init__.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
from .kdbx import KDBX
22
from .kdbx4 import kdf_uuids
3+
from .builder import (
4+
build_kdbx_structure,
5+
build_kdbx3_structure,
6+
build_kdbx4_structure,
7+
Argon2Config,
8+
AesKdfConfig,
9+
Cipher,
10+
KdfAlgorithm,
11+
)
312

4-
__all__ = ["KDBX", "kdf_uuids"]
13+
__all__ = [
14+
"KDBX",
15+
"kdf_uuids",
16+
"build_kdbx_structure",
17+
"build_kdbx3_structure",
18+
"build_kdbx4_structure",
19+
"Argon2Config",
20+
"AesKdfConfig",
21+
"Cipher",
22+
"KdfAlgorithm",
23+
]

0 commit comments

Comments
 (0)