Account.getAuthenticatedAddress()
Get the authenticated account address without fully loading the account.
Type: static
Signature
static getAuthenticatedAddress(apiKey: string): Address | nullParameters
apiKey
Type: string
API key for JAW services. Used to scope the storage lookup.
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 localStorage 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