The dual-key architecture stores the wallet’s private key encrypted twice:Documentation Index
Fetch the complete documentation index at: https://docs.chipipay.com/llms.txt
Use this file to discover all available pages before exploring further.
- Primary (
encryptedPrivateKey) — encrypted with a passkey-derived key, unlocked by a WebAuthn ceremony. - Backup (
encryptedPrivateKeyBackup) — encrypted with a user-chosen PIN, unlocked by typing it.
WebAuthn / passkey ceremonies happen in the browser — outside the scope of
@chipi-stack/backend. Use the React or Expo packages on the client to derive encryptKey from a passkey, then call this server-side flow with the derived value. The PIN backup half is fully server-driven.Create a wallet with both keys
Pass bothencryptKey (the passkey-derived primary) and encryptKeyBackup (the PIN), plus the auth metadata that lets your client know which credential to use later.
GetWalletResponse shape — store wallet.publicKey and both wallet.encryptedPrivateKey and wallet.encryptedPrivateKeyBackup against your user record.
Look up the wallet later
getWallet returns both ciphertexts plus the auth metadata, so the client knows which credential to prompt for.
encryptedPrivateKeyBackup, authMethod, credentialId, and prfSupported are null.
Get the credential metadata before sign-in
Sometimes you need just the WebAuthn credential ID to start a passkey ceremony, without exposing the encrypted private keys. UsegetCredentialRecovery:
Sign with whichever key the user has
Both keys produce the same private key, so transfer / contract calls work the same way no matter which side you decrypt from. The only thing that changes is thewallet payload + encryptKey you pass:
Verify a wallet locally (debugging)
You can decrypt either ciphertext yourself to confirm the user’s keys produce a valid private key. Useful for migrations or debugging — not for production hot paths.Migrate a legacy PIN-only wallet to passkey + PIN
For wallets created before passkey support, use the PIN rotation flow to add a passkey-derived backup. (Dedicated docs page coming next.)✅ Verified bystaging-integration/staging-passkey-default.test.tsat commit630f645(2026-04-01). Runs in CI on every PR fromstaging→mainagainst live staging — covers wallet creation with both keys, the credential-recovery endpoint (including the legacy-wallet null-fields case and the 404 path), decryption with each key, equivalence of the two private keys, and a real on-chain transfer using the PIN backup.
