A robust Dart library for managing encrypted databases in the PDBX format. Designed for secure storage of passwords, notes, and other sensitive records with group support.
The PDBX format is a custom binary structure optimized for security, atomicity, and sequential access.
| Field | Type | Offset | Size | Description |
|---|---|---|---|---|
| magic | uint32 | 0x00 | 4B | Constant 0x70646278 (pdbx) |
| version | uint16 | 0x04 | 2B | Format version (Little Endian) |
| index_length | uint32 | 0x06 | 4B | Size of encrypted index block |
| salt | byte[16] | 0x0A | 16B | Random salt for Argon2id KDF |
| index_iv | byte[12] | 0x1A | 12B | IV for index decryption |
| index_block | byte[] | 0x26 | var | Encrypted JSON list of groups and pointers |
| entry_blocks | byte[] | 0x26 + var | var | Sequential encrypted PdbxEntry blocks |
- Binary I/O Layer: Low-level file manipulation via
BinaryReaderandBinaryWriterwith atomic write support. - Security First: Key derivation using Argon2id and authenticated encryption via AES-256-GCM (
CryptoService). - Structured Models: Fully serializable models:
PdbxEntry,PdbxGroup,PdbxIndex, andPdbxEntryPointer. - Vault Management (
PdbxManager):- Initialize and destroy storage files.
- Secure session management (Lock/Unlock).
- Full CRUD operations with lazy loading (fetch details only when needed).
- Automatic Index Stabilization: Recalculates offsets during save/delete to ensure data integrity.
Add pdbx to your pubspec.yaml:
dependencies:
pdbx: ^1.1.0Note: If you modify models, ensure you run
dart run build_runner buildto generate JSON serialization code.
See pdbx_example.dart.
- Binary Layer: Handles byte-level file access and ensures offsets are correctly managed.
- Crypto Layer: Manages key stretching (Argon2id) and encryption/decryption (AES-GCM).
- Data Models: Defines the JSON schema for indices and entries.
- Manager (Facade): The high-level API that coordinates state, synchronization, and storage lifecycle.
See CHANGELOG.
