Skip to content
LogoLogo

Account.getAuthenticatedAddress()

Get the authenticated account address without fully loading the account.

Type: static

Signature

static getAuthenticatedAddress(apiKey?: string, storage?: SyncStorage): Address | null

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

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:

  1. Checks the configured storage (localStorage by default) for stored authentication state
  2. Returns the address if found and valid
  3. Returns null if 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