Skip to content

feat: add walletkit-secure-store crate#397

Closed
danielle-tfh wants to merge 1 commit into
mainfrom
add-walletkit-secure-store
Closed

feat: add walletkit-secure-store crate#397
danielle-tfh wants to merge 1 commit into
mainfrom
add-walletkit-secure-store

Conversation

@danielle-tfh
Copy link
Copy Markdown
Contributor

@danielle-tfh danielle-tfh commented May 5, 2026

Motivation

OrbKit (planned, world-id-protocol/docs/orb-kit/NOTES.md) needs to reuse walletkit-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; the walletkit-core refactor that consumes it is in #398 (stacked on this one).

What it provides

  • Vault::open(path, key, lock, ensure_schema)SQLCipher open, integrity check, caller-supplied schema callback.
  • Blobs::{ensure_schema, put, get, compute_content_id} — content-addressed blob_objects table. kind_tag is a per-consumer u8 constant — no shared enum across consumers.
  • KeyEnvelope + init_or_open_envelope_key(filename, ad)Keystore-sealed intermediate key, CBOR-encoded, persisted via AtomicBlobStore. Each consumer passes its own filename + AD namespace.
  • Lock / LockGuard — cross-process exclusive lock (flock on Unix, LockFileEx on Windows, no-op on WASM).
  • Keystore / AtomicBlobStore traits — plain Rust, no uniffi. Consumers exposing FFI define their own annotated traits and adapt.

Plain-Rust crate, no uniffi dependency. 4 unit tests pass; clippy clean.

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.
@danielle-tfh danielle-tfh deleted the add-walletkit-secure-store branch May 6, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant