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

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 only. Uses navigator.credentials.

import { createPasskeyWallet } from "@functornetwork/agentic-wallet";
 
const wallet = await createPasskeyWallet({
  rpId: "myapp.example",
  user: {
    name: "alice@example.com",
    displayName: "Alice",
  },
});
 
// 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 CreatePasskeyWalletOptions = {
  /** Relying-Party ID. Usually your domain. Stored on the credential. */
  rpId?: string;
  /** Display info shown in the OS prompt. */
  user: {
    name: string;
    displayName: string;
  };
  /** Override the default network (Sepolia). */
  network?: NetworkConfig;
  skipFaucet?: boolean;
};

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.

Example: full passkey app flow

import {
  createPasskeyWallet,
  recoverFromPasskey,
  execute,
} from "@functornetwork/agentic-wallet";
 
async function loginOrSignup() {
  try {
    // Returning user: pick from saved passkeys
    return await recoverFromPasskey({ rpId: "myapp.example" });
  } catch {
    // New user: create one
    return await createPasskeyWallet({
      rpId: "myapp.example",
      user: { name: "alice@example.com", displayName: "Alice" },
    });
  }
}
 
const wallet = await loginOrSignup();
await execute(wallet, wallet.signer, { to: "0x...", value: 0n });