DOCS / QUICKSTART: PASSKEY

Quickstart: Passkey

Use a passkey to approve an exact message without asking the user to operate a Solana wallet. PairKey’s hosted signers verify the WebAuthn proof and the bound request independently.

When to use a passkey

Choose this source for a consumer application that wants device-native authentication without exposing a seed phrase or requiring a Solana wallet. The verified credential public key, RP ID and origin form the stable identity. A replacement credential is a different identity unless your application performs an explicit migration.

Do not confuse the two keys

The passkey credential remains the user's identity. For each approval, the SDK creates a fresh ephemeral Ed25519 key, asks WebAuthn to bind it to that credential, and uses it to sign the exact PairKey request. The stable PairKey destination key remains unchanged.

passkey credential → binds ephemeral approval key
ephemeral approval key → authorizes one exact request
PairKey threshold key → signs the destination payload

Open the demo → Choose Passkey, create a site-scoped credential, and approve an exact message. The demo keeps only the credential ID and public key in this browser. For your own application, provide a verified WebAuthn registration ceremony and account recovery before using this guide. Live passkey signing still needs end-to-end acceptance on the hosted deployment.

Establish the passkey identity

Register a credential on your application’s HTTPS origin. Verify the registration response in your application, then retain the credential ID, compressed 33-byte P-256 SEC1 public key, RP ID and exact origin. Those public values define the PairKey identity; accepting an unverified caller-supplied public key would let the caller choose a different namespace. Changing the credential, RP ID or origin changes the identity and derived keys.

Credential registration with your application is distinct from PairKey namespace registration. Hosted v2 obtains public namespace metadata without a Solana registration transaction. Pin the PairKey deployment and signer identities when you integrate.

Approve a message or transaction

The SDK creates a short-lived Ed25519 binding before it prepares the request. WebAuthn signs the binding challenge; the bound ephemeral key signs the exact PairKey approval. A new binding is used for each approval. Install @pairkey/sdk and @solana/web3.js; the import below uses the released package.

import * as web3 from '@solana/web3.js';
import {PairKeyClient} from '@pairkey/sdk';

// Obtained from your verified WebAuthn registration ceremony.
const identity = {Passkey: {
  public_key: compressedP256PublicKey, // 33 bytes
  rp_id: 'app.example', origin: 'https://app.example'
}};
const pairkey = new PairKeyClient({web3, storage: localStorage});
await pairkey.connect({
  source: 'passkey', identity, credentialId,
  namespace: 'user/alice/treasury'
});
await pairkey.key({chain: 'solana', path: [0]});
const signed = await pairkey.signMessage({
  chain: 'solana', path: [0], message: 'Approve this exact message.'
});

// The same fresh passkey-bound approval can authorize a typed transaction.
const sent = await pairkey.signAndSend({
  chain: 'solana', path: [0], transaction, connection
});

Read the browser SDK source on GitHub. Each signer checks the assertion challenge, RP ID, origin, user presence and user verification, then verifies the ephemeral signature and current rules. Neither the assertion nor the ephemeral private key is written to the public recovery record.

Set optional rules

No saved policy is required for the first message, but every message still needs a fresh passkey-bound approval. Optional rules can restrict destinations, paths and canonical payload bytes. A policy edit uses a new WebAuthn assertion directly over the exact policy-update challenge. Solana verifies that P-256 proof; a separate fee payer funds the transaction and cannot change rules without the passkey proof.

The released PairKeyClient does not expose standard-rule edits or passkeyAssertion. For a custom policy integration, follow the low-level implementation: prepare the next rules revision, request an assertion over that update's challenge, check the returned instructions, and submit the fee-payer transaction. Policy creation can require rent and a transaction fee; same-size edits reuse the policy account. Ordinary off-chain message approvals do not broadcast a Solana authorization transaction. See Passkey and OIDC/OAuth policy for the update model.

Verify and recover

The SDK saves the public recovery record before prompting the passkey. After a timeout, recover(jobId) reads that same job without another assertion or signing attempt. For a destination RPC timeout, recoverAndSend(jobId, ...) can rebroadcast the exact saved transaction bytes. Verify the signature, key certificate and both signer receipts with the offline Rust verifier.