feat(mobile): secure metadata storage helper - #597
Open
Lazyartist1 wants to merge 1 commit into
Open
Conversation
Persist wallet metadata (credential id, contract address, public key) and the fee-payer secret in the platform secure enclave (iOS Keychain / Android Keystore) rather than plain storage, behind a single helper the rest of the app routes sensitive data through. - lib/storage.ts: wraps expo-secure-store with string and JSON accessors, a centralized SecureKey map, soft-failing reads (return null on a keychain error), and corrupt-JSON tolerance. - lib/walletStore.ts: now delegates every accessor to lib/storage.ts, and gains symmetric setters plus clearWalletStore(); existing signatures are unchanged so current callers keep working. Secure-store values persist across relaunch, so wallet metadata survives, and secrets never touch AsyncStorage or any plaintext store. Closes Miracle656#451
|
@Lazyartist1 is attempting to deploy a commit to the miracle656's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Lazyartist1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
Adds secure metadata storage (backlog item 23): wallet metadata — credential id, contract address, public key — and the fee-payer secret are kept in the platform secure enclave (iOS Keychain / Android Keystore), behind a single helper the rest of the app routes sensitive data through, so secrets never land in unencrypted storage.
Changes
lib/storage.ts(new) — wrapsexpo-secure-storewith:getSecureItem/setSecureItem/deleteSecureItem),getSecureJSON/setSecureJSON) for structured metadata,SecureKeymap so every reader/writer agrees on the keys,null, never crashing a screen) and corrupt-JSON tolerance.lib/walletStore.ts— every accessor now delegates tolib/storage.ts(single source of truth), and it gains symmetric setters (setPasskeyId,setPasskeyPublicKey,setSignerSecret) plusclearWalletStore(). All existing exported signatures are unchanged, so current callers (passkey, walletConnect, ConnectDAppModal) keep working.Acceptance
Notes
expo-secure-storeis already a dependency; no new deps.lib/backupFile.ts(address / public key for assembling an encrypted export) is intentionally left as-is — it touches no secret material, and the secret (veil_signer_secret) is keychain-only.Testing
tsc --noEmitclean (existing walletStore importers still compile)jest lib/__tests__/storage.test.ts— 10/10 passing (string round-trip + persistence, delete, soft-fail on read error, JSON serialise/parse, malformed-JSON → null, walletStore reads/writes the canonical secure keys, clear wipes all)Closes #451