Passkey authentication hook for Grid SDKProvides a unified passkey-based authentication flow using WebAuthn for biometric
authentication. Supports both account creation (signup) and authentication (login)
with existing passkeys.Key Features:
Ensure the passkey session is valid and ready for use
checkSupport()
() => Promise<boolean>
-
Check if browser supports passkey authentication
hasLocalPasskeyAccount()
() => boolean
-
Check if user has already created a passkey account on this device Uses localStorage to track created accounts
createAccount()
(params) => Promise<void>
-
Create a new passkey account (signup flow) This method performs the complete passkey account creation: 1. Generates session key for signing 2. Creates passkey session with the API 3. Prompts user for biometric authentication (WebAuthn) 4. Creates both passkey account and smart account 5. Stores account and session data
authenticate()
(params) => Promise<void>
-
Authenticate with an existing passkey (login flow) This method performs passkey authentication: 1. Generates session key for signing 2. Creates authorize session with the API 3. Prompts user for biometric authentication 4. Finds existing passkey account 5. Stores account and session data
logout()
() => void
-
Log out and clear all stored passkey authentication data Clears all browser storage (localStorage and sessionStorage) and disconnects the account from the SDK context. Note: You can also use useAccount().disconnect() directly for the same behavior.