Skip to content

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

ts
import { restoreSession } from "@0xcurvy/curvy-sdk/actions";

Usage

ts
await restoreSession();

Signature

ts
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.

ts
await restoreSession({
  config, 
});

Errors

Errors from config resolution and the underlying SDK operation are propagated to the caller.

Source

packages/@0xcurvy/sdk/src/actions/auth/restoreSession.ts