Skip to content

fix(core): add React Native passkey adapter support for Account class#120

Open
anthony23991 wants to merge 13 commits intomainfrom
feat/rn-passkey-account
Open

fix(core): add React Native passkey adapter support for Account class#120
anthony23991 wants to merge 13 commits intomainfrom
feat/rn-passkey-account

Conversation

@anthony23991
Copy link
Copy Markdown
Collaborator

Add optional adapter function parameters so React Native can inject its own passkey implementations. All params are optional — zero breaking changes for existing web consumers.

What changed:

  • Account.create() accepts createFn, nativeCreateFn, getFn via options
  • Account.get() accepts getFn, rpId via new third param
  • Account.import() accepts getFn, rpId via new second param
  • PasskeyManager passes these adapters through to the underlying WebAuthn utils
  • createLocalStorage() falls back to an in-memory Map when localStorage is unavailable
  • PasskeyManager class is now exported from @jaw.id/core

Key design choices:

  • nativeCreateFn bypasses crypto.subtle entirely (for RN), while createFn only replaces navigator.credentials.create
  • Adapter types use any to avoid type conflicts between viem/ox internals and RN passkey libraries
  • Bug fix: storePasskeyAccountForLogin now uses the WebAuthn credential ID param instead of the backend's to prevent encoding mismatches

Usage (future RN app):
const account = await Account.create(config, {
username: 'alice',
nativeCreateFn: rnCreatePasskey,
getFn: rnGetCredential,
});

@anthony23991 anthony23991 requested a review from Ghadi8 February 24, 2026 13:10
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
jaw-docs Ignored Ignored Mar 27, 2026 3:08pm
keys-jaw-id Ignored Ignored Mar 27, 2026 3:08pm
playground Ignored Ignored Mar 27, 2026 3:08pm

Request Review

@linear
Copy link
Copy Markdown

linear bot commented Mar 4, 2026

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.

2 participants