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

Account.getStoredAccounts()

Get all stored passkey accounts.

Type: static

Signature

static getStoredAccounts(apiKey: string): PasskeyAccount[]

Parameters

apiKey

Type: string

API key for JAW services. Used to scope the storage lookup.

Returns

PasskeyAccount[] - Array of stored passkey accounts.

PasskeyAccount

interface PasskeyAccount {
  /** WebAuthn credential ID */
  credentialId: string;
  /** Public key (hex encoded) */
  publicKey: Hex;
  /** Smart account address */
  address: Address;
  /** Username/display name */
  username: string;
  /** ISO date string when created */
  creationDate: string;
  /** Whether imported from cloud backup */
  isImported: boolean;
}

Behavior

This is a synchronous method that retrieves all passkey accounts stored locally:

  1. Reads from localStorage
  2. Returns all stored accounts regardless of authentication state
  3. Returns an empty array if no accounts are stored

Example

import { Account } from '@jaw.id/core';
 
const accounts = Account.getStoredAccounts('your-api-key');
 
console.log(`Found ${accounts.length} stored accounts:`);
accounts.forEach(acc => {
  console.log(`- ${acc.username}: ${acc.address}`);
});

Use Cases

  • Account selector - Build UI for selecting which account to login with
  • Onboarding flow - Check if user has existing accounts
  • Account management - Display list of all user accounts
  • Pre-fetch account info - Show account details before authentication

Related