feat: add walletkit-secure-store crate#397
Closed
danielle-tfh wants to merge 1 commit into
Closed
Conversation
Encrypted on-device storage primitives, factored out so other consumers (OrbKit's planned OrbPcpStore, future NFC/Selfie Check packages) can reuse the SQLite vault, content-addressed blob table, and envelope-sealed key init without depending on walletkit-core. Surface: Vault::open (SQLCipher open + integrity + caller-supplied schema callback), Blobs (blob_objects table with per-consumer u8 kind_tag — no shared enum), KeyEnvelope + init_or_open_envelope_key (filename and AD parametrized), Lock / LockGuard (cross-process flock; WASM no-op), Keystore / AtomicBlobStore traits (plain Rust, no uniffi), StoreError, ContentId. Plain Rust crate. Consumers that expose FFI define their own uniffi-annotated traits and adapt — no FFI surface forced on consumers. walletkit-core integration follows in a separate PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
OrbKit (planned,
world-id-protocol/docs/orb-kit/NOTES.md) needs to reusewalletkit-core's encrypted-vault primitives without depending on the credential-specific schema. NFC Credential and Selfie Check will follow the same pattern. This PR adds the shared crate; thewalletkit-corerefactor that consumes it is in #398 (stacked on this one).What it provides
Vault::open(path, key, lock, ensure_schema)—SQLCipheropen, integrity check, caller-supplied schema callback.Blobs::{ensure_schema, put, get, compute_content_id}— content-addressedblob_objectstable.kind_tagis a per-consumeru8constant — no shared enum across consumers.KeyEnvelope+init_or_open_envelope_key(filename, ad)—Keystore-sealed intermediate key,CBOR-encoded, persisted viaAtomicBlobStore. Each consumer passes its own filename + AD namespace.Lock/LockGuard— cross-process exclusive lock (flockon Unix,LockFileExon Windows, no-op on WASM).Keystore/AtomicBlobStoretraits — plain Rust, nouniffi. Consumers exposing FFI define their own annotated traits and adapt.Plain-Rust crate, no
uniffidependency. 4 unit tests pass; clippy clean.