Wallet Picker

pickWallet() discovers installed credential wallets and lets the user choose one. Three usage tiers cover every integration style.

Three Tiers

Tier 1 — Headless

No UI at all. You get a list of announced wallets and render the chooser yourself.

TypeScript
 import { pickWallet } from '@attestto/id-wallet-adapter'

const wallet = await pickWallet({
  render: 'headless',
  timeoutMs: 3000,
}) 

Tier 2 — Built-in Modal

The adapter injects a styled modal into the page. Zero UI code on your side.

TypeScript
 const wallet = await pickWallet({
  render: 'modal',
  requiredProtocols: ['chapi'],
  requiredGoals: ['authentication'],
}) 

Tier 3 — Custom Renderer

Provide your own render function. You receive the list of WalletAnnouncement objects and return the user's selection.

TypeScript
 const wallet = await pickWallet({
  render: (wallets) => {
    // Show your own UI, return the chosen wallet
    return myCustomPicker(wallets)
  },
  timeoutMs: 5000,
}) 

PickWalletOptions

PropertyTypeDescription
timeoutMsnumberHow long to wait for wallet announcements (default 3000)
requiredProtocolsstring[]Filter wallets by supported wire protocol ('chapi', 'oid4vp', 'didcomm-v2', 'waci')
requiredGoalsstring[]Filter by declared goal ('authentication', 'issuance', 'signing')
qrFallbackbooleanShow a QR code if no wallets are discovered (for mobile)
render'headless' | 'modal' | FunctionUI mode — headless, built-in modal, or custom renderer

WalletAnnouncement

Each wallet that responds to the discovery event provides:

TypeScript
 interface WalletAnnouncement {
  did: string           // Wallet's DID
  name: string          // Display name
  icon: string          // Data URI or URL
  version: string       // Semver version
  protocols: string[]   // Supported wire protocols
  goals: string[]       // What the wallet can do
  maintainer: string    // Publisher DID or URL
} 

Late-arriving Wallets

💡

Extensions may load after your page script runs. The adapter listens for wallet-announce CustomEvents throughout the timeout window. Wallets that arrive after the picker is shown are appended to the list in real time.

QR Fallback for Mobile

When qrFallback: true and no desktop extension responds, the picker displays a QR code containing a didcomm-v2 out-of-band invitation. Mobile wallets scan it to begin the interaction.