Skip to main content

Overview

CredentialManager handles the local lifecycle of WebAuthn credentials - creating, saving, deploying, syncing, and deleting them. Access it via kit.credentials. Credentials start as pending (registered but not yet deployed on-chain). After deployment, they become active and are associated with a smart account contract.
create() / save()  →  pending credential
deploy()           →  connects and deploys the wallet
sync() / syncAll() →  reconcile pending state with on-chain state
delete()           →  remove a pending credential that never deployed

Methods

getAll()

Return all stored credentials (both pending and active).
const all = await kit.credentials.getAll(); // StoredCredential[]

getForWallet()

Return credentials associated with the currently connected wallet.
const creds = await kit.credentials.getForWallet(); // StoredCredential[]

getPending()

Return credentials that are pending deployment.
const pending = await kit.credentials.getPending(); // StoredCredential[]

create()

Register a new WebAuthn passkey and store the credential locally as pending.
const credential = await kit.credentials.create(options?: CreateCredentialOptions);

save()

Save a pre-built credential object to local storage.
await kit.credentials.save(credential: StoredCredential);

deploy()

Deploy a pending credential - moves it through the wallet connection flow and deploys the smart account contract.
const result = await kit.credentials.deploy(
  credentialId: string,
  options?: { autoSubmit?: boolean }
);

sync()

Reconcile a single credential against on-chain state.
await kit.credentials.sync(credentialId: string);

syncAll()

Reconcile all stored credentials against on-chain state. Useful on page load to clean up stale pending state.
await kit.credentials.syncAll();

delete()

Remove a pending credential from local storage. Only use this for credentials that never deployed.
await kit.credentials.delete(credentialId: string);
delete() only removes the local record. If the credential was used on-chain, it remains on the contract. Use kit.signers.remove() to remove an on-chain signer.

Types

import type { StoredCredential, CredentialDeploymentStatus } from 'smart-account-kit';

interface StoredCredential {
  credentialId: string;
  contractId?: string;         // Set once deployed
  publicKey: string;
  status: CredentialDeploymentStatus; // 'pending' | 'failed'
  nickname?: string;
  createdAt: number;
}