Skip to main content

walletkit_db/
lib.rs

1//! Encrypted on-device storage primitives for `WalletKit`.
2//!
3//! The crate provides building blocks shared by `walletkit-core::storage` and
4//! sibling SDKs (e.g. `OrbKit`'s `OrbPcpStore`):
5//!
6//! - [`Connection`], [`Transaction`], [`Statement`], [`cipher`] — encrypted
7//!   `SQLite` (`sqlite3mc`) wrapper with safe Rust types.
8//! - [`Vault`] — encrypted-database wrapper around a caller-supplied schema,
9//!   exposing the underlying [`Connection`].
10//! - [`blobs`] — content-addressed blob storage (`ensure_schema`, `put`,
11//!   `get`), [`ContentId`], and [`compute_content_id`].
12//! - [`init_or_open_envelope_key`] — sealed intermediate key persisted via
13//!   [`AtomicBlobStore`].
14//! - [`Lock`] / [`LockGuard`] — cross-process exclusive lock (`flock` /
15//!   `LockFileEx` native, no-op on WASM).
16//! - [`Keystore`] / [`AtomicBlobStore`] — plain-Rust trait surface for
17//!   consumer-supplied platform integrations. Consumers that need FFI define
18//!   their own annotated traits and adapt to these.
19//!
20//! Consumers own their schemas, FFI surfaces, and storage policy on top of
21//! these primitives.
22
23pub mod blobs;
24
25mod envelope;
26mod error;
27mod lock;
28mod sqlite;
29mod traits;
30mod vault;
31
32pub use blobs::{compute_content_id, ContentId};
33pub use envelope::init_or_open_envelope_key;
34pub use error::{StoreError, StoreResult};
35pub use lock::{Lock, LockGuard};
36pub use sqlite::{
37    cipher, Connection, DbResult, Error as DbError, Row, Statement, StepResult,
38    Transaction, Value,
39};
40pub use traits::{AtomicBlobStore, Keystore};
41pub use vault::Vault;
42
43#[cfg(test)]
44mod test_utils;