Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

SDK

createPasskeyWallet

client.createPasskeyWallet creates a smart-account wallet whose admin authority is a passkey (Face ID, Touch ID, Windows Hello, hardware security key). The private key never leaves the device's secure hardware.

Browser by default (uses navigator.credentials) โ€” or any JavaScript runtime that supplies WebAuthn functions: in React Native, Expo, or Capacitor, pass your native passkey library's functions via the webAuthn option and users get the platform's real Face ID / fingerprint passkeys โ€” see Use the SDK in a mobile app.

import { createClient, BNB } from "@altananetwork/sdk";
 
const client = createClient({ chains: [BNB] });
const wallet = await client.createPasskeyWallet({
  name: "MyApp",
  rpId: "myapp.example",
});
 
// wallet.signer is a PasskeySigner. Use it like any other signer.

Same as createWallet: the wallet is counterfactual until the first execute, which is when the admin (P-256) public key gets registered in Keystore.

Parameters

type ClientCreatePasskeyWalletOptions = {
  /** Label shown in the OS passkey prompt (e.g. "MyApp"). */
  name: string;
  /** Relying-Party ID. Defaults to the current origin's host. */
  rpId?: string;
  /**
   * WebAuthn overrides for runtimes without the browser API. Pass your
   * native passkey library's create/get functions (React Native, Expo,
   * Capacitor). Outside a browser, `rpId` becomes required โ€” use the
   * associated domain your passkey library is configured with. The same
   * `getFn` is used for EVERY later signature, so keep it on the signer
   * (`signerFromPasskey(credential, { webAuthn })` after rehydration).
   * Note: porto requires assertion responses to include `userHandle`.
   */
  webAuthn?: { createFn?: ...; getFn?: ... };
};

The chains the wallet is provisioned on come from the client (createClient({ chains })). For wallet execution, use BNB, ETHEREUM or CELO; BASE is exported for the L2 Keystore cache used by cross-chain verification.

Returns

A standard CreateWalletResult whose signer is a PasskeySigner.

Notes

  • The wallet address is embedded in the passkey's userHandle at creation time. This is what makes recoverFromPasskey work later: the device knows which wallet each saved passkey belongs to.
  • Authorization on the chain side uses P-256 (secp256r1) signatures, matching WebAuthn. Keystore is signature-scheme agnostic, so it stores the P-256 public key the same way it stores secp256k1 keys.
  • The user sees a single biometric prompt per signature. No seed phrases, no extension required.
  • One address on every chain, including a Keystore chain the wallet never executes on. A passkey is P-256 and EIP-7702's setCode authorization needs a secp256k1 signature, so one throwaway secp256k1 key signs the authorization on each chain and is discarded when creation returns, leaving the passkey as the account's only authority. That throwaway's EOA address is the wallet address, and it is reused across chains: a wallet is one address. On a network whose Keystore lives on another chain with a relay (Base Sepolia, rooted in Sepolia), the wallet is provisioned there in the same call, with the same address and the same passkey as admin, because its registry writes go through its own account there and there is no second chance once the throwaway is gone.
  • In Node, tests and servers, createWallet({ signer: createHeadlessPasskey() }) does the same thing without an OS keychain: the P-256 key is held in memory and there is no biometric prompt. It is the same provisioning path, so it also gives one address across the chains the client is configured with. Use createPasskeyWallet for real users, because only it bakes the wallet address into the credential's userHandle, which is what recoverFromPasskey needs.

Example: full passkey app flow

import { createClient, BNB } from "@altananetwork/sdk";
 
const client = createClient({ chains: [BNB] });
 
async function loginOrSignup() {
  try {
    // Returning user: pick from saved passkeys
    return await client.recoverFromPasskey({ rpId: "myapp.example" });
  } catch {
    // New user: create one
    return await client.createPasskeyWallet({
      name: "MyApp",
      rpId: "myapp.example",
    });
  }
}
 
const wallet = await loginOrSignup();
await client.execute({
  wallet,
  signer: wallet.signer,
  calls: { to: "0x...", value: 0n },
});