@orangecheck/auth-client / OcSessionState
Interface: OcSessionState
Defined in: types.ts:137
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
<a id="property-account"></a> account | OcAccount | null | - | types.ts:139 |
<a id="property-addaccounturl"></a> addAccountUrl | (returnTo?: string) => string | Multi-account · open the sign-in flow in "add" mode — the new account joins the current browser's roster instead of replacing it. Returns the URL to navigate to (so callers can mount it in a popup or hard-navigate as they prefer); pass returnTo to route back to a specific page after the add completes. | types.ts:181 |
<a id="property-error"></a> error | Error | null | null while loading; an Error instance when status === 'error'. | types.ts:157 |
<a id="property-refresh"></a> refresh | () => Promise<void> | Re-fetch the session. Useful after sign-in/sign-out happens elsewhere. | types.ts:159 |
<a id="property-roster"></a> roster | OcAccountSummary[] | Multi-account · other accounts the user has signed into in this browser. [] for single-account sessions and for tokens minted before multi-account shipped. The active account (account above) is NOT included — these are the switch targets. | types.ts:146 |
<a id="property-setdisplayidentity"></a> setDisplayIdentity | (kind: "email" | "btc" | "did" | "nostr") => Promise<void> | Promote a linked identity to be the account-badge label across every .ochk.io site. PATCHes the auth host, which re-mints the session cookie with the new display_identity claim, then refresh()es this session. Rejects if the chosen kind is not a verified identity on the account (btc / email / nostr must actually be linked; did is always valid). | types.ts:190 |
<a id="property-signinurl"></a> signInUrl | string | URL to navigate to for sign-in on the auth host. | types.ts:192 |
<a id="property-signout"></a> signOut | (opts?: { scope?: OcSignOutScope; }) => Promise<void> | Trigger a sign-out. By default signs out of EVERY account in the roster (back-compat); pass { scope: 'current' } to sign out of just the active account and stay logged into the next peer. | types.ts:165 |
<a id="property-status"></a> status | OcSessionStatus | - | types.ts:138 |
<a id="property-switchaccount"></a> switchAccount | (didOc: string) => Promise<void> | Multi-account · flip the active session to a different account in the roster. Resolves once the new cookie has been set and the session has been re-fetched. Throws if the target did_oc isn't in the current roster (the user must add it via addAccount first) or if the auth host is unreachable. | types.ts:173 |
<a id="property-tabpinned"></a> tabPinned | boolean | Per-tab pinning · true when this tab holds its own session token (sessionStorage) and operates as account independently of the shared .ochk.io cookie — i.e. switching accounts in another tab will NOT change this tab's identity. false on hosts that predate /api/auth/tab, in privacy modes without sessionStorage, and while anonymous. | types.ts:155 |