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:
- Reads from localStorage
- 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