Account.getAuthenticatedAddress()
Get the authenticated account address without fully loading the account.
Type: static
Signature
static getAuthenticatedAddress(apiKey?: string, storage?: SyncStorage): Address | nullParameters
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
Address | null - The account address if authenticated, or null if not authenticated.
Behavior
This is a synchronous method that checks the authentication state stored locally:
- Checks the configured storage (
localStorageby default) for stored authentication state - Returns the address if found and valid
- Returns
nullif not authenticated
This method does not trigger WebAuthn or any network requests.
Example
import { Account } from '@jaw.id/core';
const address = Account.getAuthenticatedAddress('your-api-key');
if (address) {
console.log('Authenticated as:', address);
} else {
console.log('Not authenticated');
}Use Cases
- Check before restore - Verify authentication before calling
Account.get() - Conditional UI - Show different UI based on authentication state
- Quick status check - Get address without full account initialization
Related
- Account.get() - Load the full account instance
- Account.getStoredAccounts() - List all stored accounts
- Account.logout() - Clear authentication state