requestEncryptionKey
requestEncryptionKey(
walletAddress:string,signMessage:SignMessageFn,embeddedWalletSigner?:EmbeddedWalletSignerFn,options?:RequestEncryptionKeyOptions):Promise<boolean>
Defined in: src/react/useEncryption.ts:910Â
Requests the user to sign a message to generate an encryption key. If a key already exists in memory for the given wallet, resolves immediately unless RequestEncryptionKeyOptions.force is set.
Note: Keys are stored in memory only and do not persist across page reloads. This is a security feature - users must sign once per session to derive their key.
When a seeded/pinned store already has keys and the fresh derive does not
match any of them, the store is left unchanged and this resolves to false
(without firing onKeyAvailable). Callers that need write readiness
should check the return value or hasEncryptionKey before encrypting
so they can surface a re-unlock UI instead of failing downstream (#828).
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
|
The wallet address to generate the key for |
|
|
Function to sign a message (returns signature hex string) | |
|
|
Optional function for silent signing with embedded wallets | |
|
|
Optional flags (e.g. force re-derive) |
Returns
Promise<boolean>
true when keys are available after the call; false when a
divergent derive left the store unchanged (or the session was torn down
mid-flight).