Skip to main content
useSessionKey provides programmatic access to session key lifecycle management: loading, setup, and revocation.

Import

Usage

Return Value

SessionKeyData | null
The current session key data loaded from the device Keychain, or null if no key exists. Loaded automatically on mount.
(walletAddress?: string) => Promise<SessionKeyData>
Triggers the full session key setup flow: generates a keypair, calls onSignTransaction for user approval, and registers the public key with the backend. Returns the created key.
() => Promise<void>
Revokes the current session key on the backend and deletes it from the Keychain.
boolean
true during setupSessionKey or revokeSessionKey operations.
Error | null
Error from the most recent operation.
() => Promise<void>
Re-reads the session key from the Keychain. Useful after external changes.

SessionKeyData


Example