npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@authon/react-native-wallet

v0.6.3

Published

Authon embedded wallet for React Native (Expo native module wrapping the Swift and Kotlin wallet SDKs)

Downloads

637

Readme

@authon/react-native-wallet

The Authon embedded wallet for React Native and Expo: an Expo native module around the Swift (AuthonWallet) and Kotlin (dev.authon.sdk.wallet) wallet implementations.

License Version

It is the same wallet as the web SDK (@authon/js): same wallet row, same /v1/wallet/me/* API, same shares. A user gets the same address in your web app and your mobile app, and the app install appears as one more device in the wallet's device list.

  • The device keeps only its share D, sealed by a Secure Enclave (iOS) or Android Keystore key. Every signature fetches the company share A with a device-key proof, combines the shares in native memory, signs and wipes the key. The full key is never stored.
  • No secret crosses the JS bridge. D, A, the backup share B, the key and the passkey PRF output stay in Swift / Kotlin. JS receives addresses, signatures, wallet status and the device list only.
  • Signing is confirmed with the SDKs' native approval UI (a SwiftUI sheet on iOS, a dialog on Android) when the project requires confirmation (the default, a server-side setting).
  • Passkey backup and restore use the RP ID wallet.authon.dev, so a backup made on the web restores in the app and the other way round.

Requirements

Version 0.6.1 adds XRP NFTokenCancelOffer and Vector256 support. The native approval screen shows the count and full uppercase offer IDs in signing-blob order. Empty, zero or duplicate cancel IDs and malformed vectors are rejected. The consuming app must verify offer existence, ownership and cancellation eligibility on the ledger. The { txBlobHex } → { signature } call is unchanged. Rebuild the native app to include this fix; an OTA JavaScript update is insufficient.

Account recovery introduced in 0.6.0 is described below. Do not assume a published 0.5.x binary or an older server implements it.

  • An Expo development build or a bare React Native app. Expo Go does not contain this native module (calls fail with NOT_CONFIGURED). Expo SDK 53+ / React Native 0.76+.
  • iOS 16+ (iOS 18+ for passkey backup and restore, which need the passkey PRF extension).
  • Android minSdk 28, compileSdk 35+. Passkey backup and restore need Google Play services with a passkey provider that supports PRF (Google Password Manager on Android 9+ with current Play services).
  • Signing: EVM (personal_sign, EIP-712 v4, legacy / EIP-2930 / EIP-1559 transactions), HD accounts m/44'/60'/0'/0/n.
  • Addresses (receive / display) from the same seed: TRON m/44'/195'/n'/0/0, XRP m/44'/144'/n'/0/0, Bitcoin P2WPKH m/84'/0'/n'/0/0 (testnet m/84'/1'/n'/0/0), Solana m/44'/501'/n'/0'. These chains sign through signChainTransaction (the app builds the transaction; fees, balances and broadcast are up to the app). A wallet created before HD wallets has EVM account 0 only (ACCOUNT_UNAVAILABLE for other chains).

Optional account recovery (0.6.0)

Requires a matching Authon API deployment, project opt-in and server recovery key. Confirm capabilities().accountRecovery before enrollment; installing the package alone does not enable recovery or migrate an existing wallet.

This is a separate, custodial recovery method, not a new name for passkey backup. The project must explicitly enable it and the user approves it in native UI. Authon holds encrypted recovery material and can reconstruct an enrolled wallet using its two server keys. A compromised Authon operator or a recently authenticated account can therefore recover that wallet. Local Face ID, fingerprint or device passcode is enforced by the official native SDK, not remotely attested by the API. Neither a passkey nor another device is required for an already-enrolled wallet.

const wallet = createAuthonWallet({
  publishableKey,
  getToken: () => authonClient.getAccessToken(), // @authon/react-native client, real signed-in user
  requireDeviceAuthentication: true,
});

// Call only after your account-recovery disclosure/choice, not automatically on screen render.
const caps = await wallet.capabilities();
if (caps.ready !== 'available' || !caps.accountRecovery) {
  // Show the capability reason. Do not open a passkey UI automatically.
  throw new Error('Account recovery is not available on this device/project');
}
let current = await wallet.get(); // null means no wallet, not an API/network failure
if (!current) current = await wallet.create();
if (current.needsRestore) {
  if (!current.accountRecovery) {
    // Stop: enroll from an existing device with D, or explicitly use the old passkey recovery.
    // Never replace this wallet with a new one.
    throw new Error('This existing wallet has not enrolled account recovery');
  }
  await wallet.restoreAccount();
} else if (!current.accountRecovery) {
  await wallet.enableAccountRecovery();
}
// Signing continues through the ordinary SDK methods and native approval/device authentication.
// On sign-out OR changing user: wallet.dispose(); construct a new instance for the next user.

The example's getToken must use your auth adapter's actual token getter. The SDK's native enableAccountRecovery, restoreAccount and disableAccountRecovery return no shares or seed to JavaScript. For direct Swift/Kotlin consumers the same methods are on AuthonWallet; configure a device authenticator (normally requireDeviceAuthentication: true) and call invalidate() on logout or account changes before replacing the instance.

Each successful recovery method calls native device authentication exactly once, including an idempotent call when already enrolled/restored/disabled. A failed precondition or rejected consent can stop before authentication. Do not prompt again just to finish that same operation. This is not a reusable signing grant: each subsequent signing operation retains its own approval/authentication. create, get and accounts do not prove device authentication. Google/Apple sign-in and provider MFA remain separate from the SDK's device authentication; a JS flag cannot replace either.

| Call / user action | Device authentication in this candidate | Completion meaning | | --- | --- | --- | | capabilities(), get(), create(), accounts() | None | Public state/creation/read; no device-authentication completion guarantee | | enableAccountRecovery() | Once before success, including already enrolled | Native approval/authentication and enrollment completed; RN also refreshed public state | | restoreAccount() | Once before success, including already local | Native approval/authentication and usable local share verified; RN also refreshed public state | | disableAccountRecovery() | Once before success, including already disabled | Native approval/authentication and withdrawal completed; RN also refreshed public state | | Signing with requireDeviceAuthentication: true | Once per signing call, after applicable approval | That specific signing operation completed; no grant for another transaction | | Reopening/unlocking the consuming app | No standalone unlock API | Use the app's native vault/lock mechanism; do not invoke enrollment or recovery merely to unlock |

This table counts calls to the native authenticator, not a guarantee of the exact number of OS screens. Provider MFA and first-use OS permission screens are separate. Direct HTTP API calls do not present any local authentication UI.

In the account-recovery path, native UI is one fixed recovery-consent dialog followed by one device-authenticator call. Both enrollment and restoration require the dialog. The app must not add a second lock screen after success. Normal signing has its own approval dialog when confirmSigning is enabled, followed by its own device authentication.

For an existing local wallet, do not call enrollment or restoration merely to authenticate. Check !wallet.needsRestore, retain the selected recovery policy, and use the application's native vault unlock. If that policy requires enrolled recovery before use, check wallet.accountRecovery === true || wallet.protected === true; recoverable expresses the same condition. These public flags are UI/readiness data, not native signing authorization. Signing must still pass the native wallet's current-device/session/proof checks and transaction authentication.

capabilities().ready describes overall setup, not the current wallet's local-share status. When accountRecovery === true, the SDK omits only passkeyBackup from that overall readiness result. App approval, wallet enablement, hardware storage and device lock remain required. If recovery service availability later changes, do not invalidate a usable local share merely because backup readiness fails: evaluate the individual app/wallet/storage/lock checks for local use, and the selected method's capability for enrollment/restoration. Keep protected passkey-only and make legacy backupUpgradeRecommended an optional passkey-maintenance action, not an automatic gate on the account-recovery login path.

For cancellation, storage/network errors, or a retry after the app resumes, first call get() using the same owner and inspect the existing wallet. If local data is usable, continue that wallet; if needsRestore && accountRecovery, offer explicit restoreAccount(); if recovery is not enrolled, offer an existing recovery method/current-device enrollment. Never call create() to replace an existing wallet. A rejected call does not prove that the server rolled back or that device authentication completed: RN can fail refreshing public state after the native write succeeded. Do not treat a state read or a JS timestamp as an authentication grant. A retry that invokes a recovery method again authenticates again. Re-login is needed only when the authentication API requires it (for example REAUTH_REQUIRED/an actually expired session), not for every storage error; the ten-minute fresh-authentication rule still applies to a later recovery attempt.

  • Existing local D: enrollment verifies wallet-key ownership, leaves D, share generation, address, passkey backup and other devices unchanged. Enrollment is explicit, including for existing wallets.
  • Withdrawal: disableAccountRecovery() from a current local device deletes live recovery snapshots and pending recovery challenges, preserving devices and passkey backup. Project policy disabling alone does not delete snapshots. Historical database backups expire under the operator's retention policy; immediate cryptographic erasure of every backup copy is not promised.
  • New phone/reinstall: restoreAccount adds a fresh hardware-bound device key. It preserves all other devices; revoke a lost device separately. Losing both D and every previously enrolled recovery method is not recoverable. This feature does not recover forgotten Google/Apple accounts.
  • protected remains passkey-only. accountRecovery means enrolled recovery material exists; recoverable = protected || accountRecovery. It does not promise that current project policy, server availability or the account identity will permit recovery right now.
  • REAUTH_REQUIRED: sign in again, complete any MFA, then retry (refresh alone does not qualify). The server requires a verified, non-testing, session-backed login whose original session is at most ten minutes old. It currently accepts all such configured account login methods, not only Google/Apple, and does not attest a provider-specific recent biometric or login ceremony. The current/root sessions must have server-recorded account-authentication provenance. Older sessions without that provenance remain valid for ordinary login but require a new login here.
  • RECOVERY_DISABLED / RECOVERY_UNAVAILABLE: stop and contact the operator; do not silently switch protection modes. RECOVERY_NOT_ENROLLED: use the existing D/old recovery method first. DEVICE_AUTH_REQUIRED: configure device authentication and device lock. USER_CANCELLED: show the unchanged wallet and offer explicit retry; do not open a QR/passkey prompt.
  • Offline/network failure: keep local data, retry online and inspect get() before reporting success. A server write followed by a local storage failure is not atomic: needsRestore may remain true and another restoreAccount() can recover with the same address. A previously sent write may complete after cancellation/disposal. Do not delete the original device record.
  • Passkey backup remains optional and coexists. Web iframe enrollment is not implemented; the web SDK's existing passkey operations retain their current behavior. A web-only D without an enrolled recovery method cannot be migrated by merely calling the mobile SDK.

Install

npx expo install @authon/react-native-wallet expo-build-properties
// app.json
{
  "expo": {
    "ios": {
      "bundleIdentifier": "com.example.app",
      "associatedDomains": ["webcredentials:wallet.authon.dev"]
    },
    "android": { "package": "com.example.app" },
    "plugins": [
      ["expo-build-properties", { "ios": { "deploymentTarget": "16.0" }, "android": { "minSdkVersion": 28 } }]
    ]
  }
}

Then build a development build: npx expo prebuild and npx expo run:ios / npx expo run:android (or EAS Build). Rebuild the app after installing or updating the package.

Register the app in the Authon console

The wallet API only serves apps registered for the project, and passkeys only work for apps an Authon administrator has approved:

  1. Authon console, Project, Wallet, Native apps: add
    • iOS: your Apple Team ID and bundle ID (the app ID is TEAMID.bundleId),
    • Android: the package name and the SHA-256 fingerprint of your release signing certificate (for Play App Signing, the app signing key from Play Console, not the upload key).
  2. Wait for approval. Adding or changing an entry resets it to "not approved". Until it is approved, appConfig().approved is false, and protect(), upgradeBackup() and restore() fail with ORIGIN_NOT_ALLOWED. Signing and accounts work as soon as the app is registered.
  3. After approval, wallet.authon.dev publishes your app in /.well-known/apple-app-site-association (webcredentials) and /.well-known/assetlinks.json (get_login_creds; handle_all_urls as well only for a package and certificate the Authon operator enables separately). The iOS app needs the Associated Domains entitlement webcredentials:wallet.authon.dev (above).

Usage

With @authon/react-native

Inside <AuthonProvider> the hook takes the session token from the provider and follows sign-in and sign-out:

import { AuthonProvider } from '@authon/react-native';
import { useAuthonWallet } from '@authon/react-native-wallet';

function WalletScreen() {
  const { wallet, current, isLoaded, error } = useAuthonWallet({ publishableKey: 'pk_live_...' });

  if (!isLoaded) return <Spinner />;
  if (!current) return <Button title="Create wallet" onPress={() => wallet.ensure()} />;
  return (
    <>
      <Text>{current.address}</Text>
      {!current.protected && <Button title="Back up with a passkey" onPress={() => wallet.protect()} />}
      <Button title="Sign" onPress={() => wallet.signMessage('Hello from Authon')} />
    </>
  );
}

export default function App() {
  return (
    <AuthonProvider publishableKey="pk_live_...">
      <WalletScreen />
    </AuthonProvider>
  );
}

Without the provider

import { createAuthonWallet } from '@authon/react-native-wallet';

const wallet = createAuthonWallet({
  publishableKey: 'pk_live_...',
  getToken: async () => mySession.accessToken, // the Authon session token, refreshed when needed
});

const { address } = await wallet.ensure();
const signature = await wallet.signMessage('Hello');

getToken is called before every wallet call and the token is passed to native code for that call only. The token is the Authon session token, not a wallet secret. Call wallet.dispose() on sign-out.

API

Method names and result shapes follow @authon/js (WalletClient).

| Method | Description | |---|---| | capabilities() | Pre-sign-in check of this device and app (see below). No session, creates nothing, opens no UI. | | appConfig() | App registration and wallet settings: { projectId, allowed, approved, enabled, chainIds, confirmSigning, rpId, minFrameProtocol }. No session needed. | | get() / status() | The signed-in user's wallet { address, protected, needsRestore, backupUpgradeRecommended, devices }, or null when there is none. | | create() | Creates the wallet (or returns the existing one). | | ensure() | get(), then create() when there is no wallet. Concurrent calls share one request. | | isProtected() | True when the wallet has a passkey backup. | | getAccounts({ start, count, chain }) | HD account addresses { index, path, address, chain } (public, no approval). chain: evm (default), tron, xrp, bitcoin, bitcoin-testnet, pearl, pearl-testnet, solana. | | signMessage(message, { account }) | EIP-191 personal_sign; message is text or { raw: '0x...' }. | | signTypedData(typedData, { account }) | EIP-712 v4. | | signChainTransaction({ chain, account, address, payload }) | Signs an app-built transaction: Solana { message } (base64 Message) → { signature } (base58); TRON { rawDataHex } → { txID, signature }; Bitcoin / testnet { psbt } (base64, every input with witness_utxo; only our P2WPKH inputs are signed) → { psbt, txHex? } (txHex when every input is ours); XRP { txBlobHex } (encodeForSigning output with SigningPubKey = getAccounts({ chain: 'xrp' }) publicKey) → { signature } (DER). The approval UI summarizes it; unknown programs are shown as high risk. address must be the account's address on that chain (ADDRESS_MISMATCH otherwise). | | signTransaction(tx, { account }) | Legacy, EIP-2930 or EIP-1559; returns the serialized signed transaction. bigint values are allowed. | | protect() | Creates the passkey backup. Do not let users receive funds before the wallet is protected. | | upgradeBackup() | Replaces a legacy backup (backupUpgradeRecommended) with a verifiable one. | | restore({ resetOtherDevices }) | Restores on this install with the backup passkey; resetOtherDevices: true revokes every other device. | | revokeDevice(deviceId) | Revokes a device. | | onChange(listener) | Called with the wallet after create/protect/restore/revoke, and null on dispose. | | provider(chainId) | Minimal EIP-1193 provider: eth_chainId, eth_accounts, eth_requestAccounts, personal_sign, eth_signTypedData_v4, eth_signTransaction. | | dispose() | Releases the native instance and rejects calls in flight (DISPOSED). The device share stays on the device. |

account (default 0) selects the HD account. For accounts other than 0 the client first reads the account's address and the native wallet refuses to sign when the derived key does not match it.

Options of createAuthonWallet / useAuthonWallet:

| Option | Description | |---|---| | publishableKey | Project publishable key. | | apiUrl | Defaults to https://api.authon.dev. | | getToken | Session token getter (optional with the hook inside <AuthonProvider>). | | appId | TEAMID.bundleId (iOS) / package name (Android), or { ios, android }. Detected when omitted. | | requireDeviceAuthentication | Also ask for Face ID / Touch ID / passcode (iOS) or BiometricPrompt (Android) before each signature. | | testing | Test only, refused outside debug builds: { allowSoftwareKeys, autoApprove } for simulators and emulators (software device keys instead of Secure Enclave / StrongBox, and no approval UI). Never ship it. |

Pearl transfers

Use pearl for mainnet and pearl-testnet for testnet. Account n uses BIP-86 m/86'/808276'/n'/0/0 (m/86'/1'/n'/0/0 on testnet) and returns a Taproot address starting with prl1p or tprl1p. Account lookup needs no approval.

const chain = 'pearl';
const [account] = await wallet.getAccounts({ chain, start: 0, count: 1 });
const result = await wallet.signChainTransaction({
  chain, account: account.index, address: account.address, payload: { psbt },
});

Build a base64 PSBT v0 (up to 100,000 decoded bytes) with a witness_utxo on every input. The SDK always shows an approval with destination addresses, PRL amounts and the network fee. It signs this account's P2TR key-path inputs with SIGHASH_DEFAULT. Result psbt contains the Taproot key signatures; txHex is returned when every input belongs to this account. Other inputs require their owners' signatures and app-side finalization. Recipient outputs can be P2TR or P2MR. Script-path spending and XMSS are outside this contract. The app selects inputs, checks UTXOs and broadcasts to the selected network. Update the native SDK and rebuild both apps, including an Android build with Maven Central dependencies.

Malformed PSBTs, missing witness UTXOs and the wrong network give INVALID_REQUEST. A valid request for an input or account the wallet does not control gives ADDRESS_MISMATCH. Cancelling approval gives USER_CANCELLED; older non-HD wallets give ACCOUNT_UNAVAILABLE for Pearl.

Before sign-in: capabilities()

const caps = await wallet.capabilities();
if (caps.ready === 'unavailable') showWalletUnavailable(caps); // tell the user before sign-in
// 'unknown': continue, but be ready for that feature to fail

{ ready, app, wallet, secureStorage, deviceLock, passkeyBackup, diagnosticId }; each check is { status: 'available' | 'unavailable' | 'unknown', reason }. ready is unavailable if any check is, else unknown if any is, else available. It answers for a release build (the testing options are ignored).

| Check | unavailable reason | unknown reason | |---|---|---| | app | APP_NOT_REGISTERED, APP_SIGNATURE_MISMATCH (Android: the running app's signing certificate differs from the registered one) | APP_NOT_APPROVED (signing works, passkey backup waits for approval), NETWORK_ERROR, API_ERROR | | wallet | WALLET_DISABLED | NETWORK_ERROR | | secureStorage | HARDWARE_KEYSTORE_UNAVAILABLE | SIMULATOR (simulators and emulators never count as hardware protected), CHECK_FAILED | | deviceLock | DEVICE_LOCK_NOT_SET | CHECK_FAILED | | passkeyBackup | OS_UNSUPPORTED (iOS < 18, Android < 9), PASSKEY_API_UNAVAILABLE | PRF_PROVIDER_UNVERIFIED (the provider's PRF support is confirmed on the first protect()) |

Native Sign in with Apple (iOS)

import { useAuthon, AuthonAuthError, AuthonMfaRequiredError } from '@authon/react-native';
import { signInWithAppleNative } from '@authon/react-native-wallet';

const { client } = useAuthon();
try {
  await signInWithAppleNative(client); // system Apple sheet, then the session is the app session
} catch (e) {
  if (e instanceof AuthonMfaRequiredError) return showMfa(e.mfaToken); // then verifyMfa()
  if (e instanceof AuthonAuthError && e.code === 'OAUTH_CANCELLED') return; // show nothing
  throw e;
}

The app needs the "Sign in with Apple" capability (ios.entitlements com.apple.developer.applesignin: ["Default"] in app.json, or expo-apple-authentication) and must be registered and approved in the Authon console (TEAMID.bundleId). JS never receives Apple's identity token, authorization code, nonce or the PKCE verifier. Codes: OAUTH_CANCELLED, OAUTH_REDIRECT_NOT_ALLOWED (serverCode APP_NOT_REGISTERED / APP_NOT_APPROVED), OAUTH_STATE_MISMATCH, OAUTH_EXCHANGE_FAILED, ACCOUNT_LINK_REQUIRED, NETWORK_ERROR, RATE_LIMITED, API_ERROR, with diagnosticId. There is no web fallback. On Android it throws UNSUPPORTED_PLATFORM; use startOAuth('apple') there.

Errors

Every failure is an AuthonWalletError with code, message, diagnosticId (the server's request ID when an API response caused it; log it, never secrets) and retryable. Codes are the web wallet's (NOT_FOUND, NEEDS_RESTORE, NOT_PROTECTED, PRF_UNSUPPORTED, ORIGIN_NOT_ALLOWED, USER_CANCELLED, UNAUTHORIZED, ADDRESS_MISMATCH, STORAGE_UNAVAILABLE, LAST_DEVICE, MESSAGE_TOO_LARGE, FRAME_OUTDATED, BACKUP_KEY_REQUIRED, ALREADY_UPGRADED, ACCOUNT_UNAVAILABLE, ...), reported unchanged by the Swift and Kotlin wallets. The JS layer adds NOT_SIGNED_IN (no token), INVALID_PARAMS, DISPOSED and NOT_CONFIGURED (native module missing).

On Android, Credential Manager failures also carry phase (passkey.create, passkey.get, with .rpValidation when the provider rejected the RP) and, except for a cancel or a missing passkey, clientAttemptId (a random ID made on the device; diagnosticId stays null because no API request was involved). reason is set only when the cause is certain. All three can be null: iOS does not report them yet, older native builds do not either, and most other errors have none. On Android, ORIGIN_NOT_ALLOWED with reason: 'PASSKEY_RP_VALIDATION_FAILED' means the passkey provider could not validate wallet.authon.dev for this app (Digital Asset Links); it is not retryable, so do not loop. Other provider data errors stay INTERNAL with reason: null. message is a fixed sentence and never the provider's text. capabilities() and appConfig().approved reflect Authon's registration and the published assetlinks, not the provider's own Digital Asset Links check, which only the first protect() shows. USER_CANCELLED means the user rejected the approval or closed the passkey sheet: go back without an error message. CONFIRM_WINDOW_BLOCKED means the approval UI could not be shown; nothing was signed.

try {
  await wallet.signMessage(text);
} catch (e) {
  if (e instanceof AuthonWalletError && e.code === 'USER_CANCELLED') return; // rejected in the approval UI
  throw e;
}
try {
  await wallet.protect();
} catch (e) {
  if (e instanceof AuthonWalletError && e.reason === 'PASSKEY_RP_VALIDATION_FAILED') {
    return showPasskeyLinkProblem(e.clientAttemptId); // not retryable; report the attempt ID
  }
  throw e;
}

Trust model

The web wallet runs in a separate origin (wallet.authon.dev), so the page that embeds it can never read the device share or the key. In an app SDK the wallet runs inside your app's process:

| | Web frame | App SDK (this package) | |---|---|---| | Where secrets live | Separate origin frame; the site's code cannot read D or k | Inside the app process; the app's own code could in principle reach D, A and k | | Authon alone | Holds A only, cannot sign | Same | | The app operator alone | Cannot sign | Can reach k at the moment the user signs in this app (the app is inside the trust boundary) | | Revoking a device | Server stops serving A | Same; the key is never stored, so the server really blocks the device |

So the app SDK stays non-custodial with respect to Authon, but not with respect to the developer of the app that embeds it. This is the common limit of every in-app embedded wallet SDK. The bridge keeps secrets out of JS (JS bundles, logs, crash reporters and over-the-air updates never see them), but it does not protect against native code in the same app.

Testing on simulators and emulators

Simulators and emulators have no Secure Enclave / StrongBox and no real passkey PRF. For automated tests, pass testing: { allowSoftwareKeys: true, autoApprove: true } in a debug build only. Passkey protect() / restore() cannot be exercised there; they are covered by the Swift and Kotlin SDKs' tests (software WebAuthn test doubles and the live API tests) and need a real device for acceptance. examples/react-native-wallet contains such a debug smoke app.

How the native code is shared

The module compiles the native SDKs' own sources; there is no separate wallet implementation:

  • ios/vendor/ is generated from swift/Sources/AuthonWallet, swift/Sources/CSecp256k1 and swift/Sources/CKeccak,
  • android/src/vendor/kotlin/ is generated from kotlin/authon/.../dev/authon/sdk/wallet (without AuthonWalletAuth.kt, which needs the Kotlin auth client), plus android/consumer-rules.pro.

node scripts/sync-native-wallet.mjs (run by this package's build) regenerates them, prepublishOnly refuses to publish stale copies, and --check (also part of the test suite) fails on any drift. Do not edit the generated files.

Note for apps that also include the native dev.authon:authon-android artifact: it contains the same dev.authon.sdk.wallet classes, so use one or the other.

License

MIT

Local cleanup after account deletion (0.6.2 candidate, not yet published)

forgetLocalDevice({ projectId, userId, confirm: true }): Promise<void> removes this app's sealed device share record and its device signing/sealing keys for exactly those IDs. It uses no session/token, app-config request, wallet server API, biometric or passkey UI. A missing record is success. It works after sign-out, account deletion and offline. IDs are explicit because a deleted account's token must not be refreshed to discover them. They are local storage selectors, not proof of server authorization; the native app is inside the local-storage trust boundary.

// Before deletion: capture the account being deleted, not a later signed-in account.
const user = await authon.getUser(); // the RN auth client
if (!user) throw new Error('Not signed in');
const userId = user.id;
const { projectId } = await wallet.appConfig();
if (!projectId) throw new Error('Missing project ID');
const cleanup = { projectId, userId, confirm: true as const };

// Stop wallet actions and close pending native approval/passkey UI first.
// This is the @authon/react-native 0.9.6 candidate API; wait for official release.
const result = await authon.deleteAccount({ confirm: true });
// Rejection or ambiguous network failure is NOT confirmation: do not wipe D then.
await wallet.forgetLocalDevice(cleanup);
wallet.dispose();
// Also clear the app's own vault, caches, user data and sessions.
// If !result.localSessionCleared, retry auth secure-storage cleanup as documented.

Keep the public cleanup IDs for retry if the local step fails; never save tokens, keys or shares. STORAGE_UNAVAILABLE means local erasure is incomplete. Unlock the device and retry with the same IDs; a malformed/unreadable record needs storage repair, not a false success message. Native OS keystore/keychain deletion is checked. Keys are deleted before the record so a partial key-deletion failure retains references needed to retry. Custom DeviceStore.delete implementations must implement the same key cleanup and error contract.

This invalidates the wallet client, drops stale JS results and waits for operations already admitted on its native instance before erasing. Cleanup may wait for an existing OS prompt: close/cancel it first. No network call is initiated by cleanup, though already-started operations may finish while it drains. Stop and drain all other native wallet instances for the same project/user before cleanup (await otherClient.disposeAndWait() for RN clients); it is not a cross-process lock. When using the React hook, remount it after cleanup (for example, key the wallet subtree by user ID). Repeated cleanup on the same client/scope is allowed, including after an error. A new client is required for normal wallet operations afterwards. New native code is required on both iOS and Android; OTA JS alone returns NOT_CONFIGURED on older binaries.

This does not delete the server account, revoke registered devices, delete server backups, remove an OS passkey, affect other installs, or erase blockchain assets. Calling it before server deletion can strand an unbacked-up wallet if server deletion fails. dispose() by itself still preserves the device record; it is not a replacement for cleanup.

Native callers can use the same explicit scope after the session is gone:

// Stop other instances first; waits for operations on this instance and invalidates it.
try await wallet.forgetLocalDevice(projectId: projectId, userId: deletedUserId, confirm: true)
wallet.forgetLocalDevice(projectId, deletedUserId, confirm = true)

await wallet.invalidateAndWait() (Swift) / wallet.invalidateAndWait() (Kotlin) invalidates and drains an instance without deleting any data. Use it when coordinating other instances.