restoreSession
Rehydrate accounts from the browser keystore after a page refresh.
If the keystore holds entries, the persisted JWT (under __jwt__) is restored first so adding accounts can skip the re-auth round trip (TOTP sign + POST /auth). Each remaining key is an account whose keypairs come from the keystore and whose metadata comes from storage; they are rebuilt into a CurvyAccount and added. Per-account failures (missing metadata, corrupt data) are swallowed — the user can re-authenticate to re-derive keypairs.
No-op in Node (config.keystore is null).
Import
import { restoreSession } from "@0xcurvy/curvy-sdk/actions";Usage
await restoreSession();Signature
function restoreSession(parameters?: WithConfig): Promise<void>Returns
Promise<void>
The action resolves or returns the value shown in the signature.
Parameters
config
- Type:
CurvyConfig - Required: no
Curvy config to use. Defaults to the ambient config.
await restoreSession({
config,
});Errors
Errors from config resolution and the underlying SDK operation are propagated to the caller.
Related
- Authentication guide
login— Log in (add an existing account) from an account signature.loginWithPasskey— Log in via a passkey PRF output.loginWithPrivateKeys— Log in from raw spending/viewing private keys.logout— Remove an account and re-point (or clear) the active account.