Skip to Content
Anuma SDKReactInternalFunctionsrefreshEncryptionKeyIfMatches

refreshEncryptionKeyIfMatches

refreshEncryptionKeyIfMatches(walletAddress: string, probeCiphertext: string, signMessage: SignMessageFn, embeddedWalletSigner?: EmbeddedWalletSignerFn): Promise<boolean>

Defined in: src/react/useEncryption.ts:1041 

Re-derive encryption keys from a fresh signature and commit them only if they successfully decrypt probeCiphertext (a prefixed enc:v2: / enc:v3: value). If they do not, the existing in-memory keys are left untouched.

Concurrent calls for the same wallet share one sign+derive. Each caller then probes its own ciphertext against those candidates, so mixed-era messages in one Promise.all batch can still recover when only the leader’s probe misses (#828 review). Failed candidates are memoized for the session so pagination does not re-prompt on every page when the wallet has changed.

Parameters

ParameterType

walletAddress

string

probeCiphertext

string

signMessage

SignMessageFn

embeddedWalletSigner?

EmbeddedWalletSignerFn

Returns

Promise<boolean>

true when keys were refreshed (probe decrypted); false when the probe failed under the candidate keys (store unchanged) or the probe was not encrypted.

Last updated on