Account.getStoredAccounts()
Get all stored passkey accounts.
Type: static
Signature
static getStoredAccounts(apiKey?: string, storage?: SyncStorage): PasskeyAccount[]Parameters
apiKey
Type: string | undefined
API key for JAW services. This method only reads local storage, so the key is optional here.
storage
Type: SyncStorage | undefined
Optional custom storage. Defaults to localStorage in the browser and to an in-memory store elsewhere. Pass a persistent store in React Native.
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:
- Reads from the configured storage (
localStorageby default) - Returns all stored accounts regardless of authentication state
- 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
- Account.get() - Login with a specific account
- Account.getAuthenticatedAddress() - Get current authenticated address
- Account.create() - Create a new account
- Account.import() - Import account from cloud backup