Skip to content

refactor: walletkit-core uses walletkit-secure-store#398

Closed
danielle-tfh wants to merge 1 commit into
add-walletkit-secure-storefrom
refactor-walletkit-core-secure-store
Closed

refactor: walletkit-core uses walletkit-secure-store#398
danielle-tfh wants to merge 1 commit into
add-walletkit-secure-storefrom
refactor-walletkit-core-secure-store

Conversation

@danielle-tfh
Copy link
Copy Markdown
Contributor

Motivation

Stacked on #397. Migrates walletkit-core's storage layer to consume the shared primitives so walletkit-secure-store has its first real consumer and OrbKit can pick it up next.

What changed

  • vault/ uses Vault::open + Blobs::put. blob_objects schema moves to Blobs::ensure_schema; credential-specific tables (credential_records, vault_meta) stay in vault/schema.rs.
  • keys.rs delegates to init_or_open_envelope_key with the existing ACCOUNT_KEYS_FILENAME / ACCOUNT_KEY_ENVELOPE_AD constants.
  • lock.rs collapses to a re-export aliased to StorageLock / StorageLockGuard.
  • envelope.rs deleted (replaced by walletkit_secure_store::KeyEnvelope).
  • traits.rs adds DeviceKeystoreAdapter / AtomicBlobStoreAdapter bridging the uniffi-annotated FFI traits to the new crate's plain-Rust ones. Hosts (Kotlin / Swift) see no change.
  • error.rs adds From<StoreError> for StorageError for ? conversion at the boundary.
  • types.rs drops BlobKind::as_i64 (consumers pass as u8).

On-disk format unchanged — same envelope CBOR, same content_id bytes (SHA-256(prefix || [kind_byte] || plaintext)), same SQL schemas. Existing user databases keep working.

95 walletkit-core lib tests + 17 vault tests pass; clippy clean.

Stacked on the walletkit-secure-store crate. Migrates walletkit-core's
storage layer to consume the shared primitives:

- vault/ uses Vault::open + Blobs::put for SQLCipher open + blob inserts.
  blob_objects table moves to Blobs::ensure_schema; credential-specific
  tables (credential_records, vault_meta) stay in vault/schema.rs.
- keys.rs delegates to init_or_open_envelope_key with the existing
  ACCOUNT_KEYS_FILENAME and ACCOUNT_KEY_ENVELOPE_AD constants.
- lock.rs collapses to a re-export aliased to StorageLock /
  StorageLockGuard for in-tree stability.
- envelope.rs deleted (replaced by walletkit_secure_store::KeyEnvelope).
- traits.rs adds DeviceKeystoreAdapter / AtomicBlobStoreAdapter that
  bridge the uniffi-annotated FFI traits to the new crate's plain-Rust
  Keystore / AtomicBlobStore. Hosts (Kotlin / Swift) see no change.
- error.rs adds From<StoreError> for StorageError so ? converts cleanly
  at the boundary.
- types.rs drops BlobKind::as_i64 (consumers now pass `as u8`).

On-disk format unchanged: same envelope CBOR layout, same content_id
byte layout (SHA-256(prefix || [kind_byte] || plaintext)), same SQL
schemas. Existing user databases keep working without migration.

95 walletkit-core lib tests + 17 vault tests pass; clippy clean.
@danielle-tfh danielle-tfh deleted the refactor-walletkit-core-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