resumeSession
uses localStorage
The session kept from a visit before, if there is one and it still works.
import { configure, oauthSession, SIGNED_IN, signedInHere } from "#codebase/tcmts/registry/session"; import type { RegistrySession } from "#codebase/tcmts/registry/session"; import { getSession } from "@atcute/oauth-browser-client"; export async function resumeSession(): Promise<RegistrySession | undefined> { const did = localStorage.getItem(SIGNED_IN); if (!did) return undefined; await configure(); try { return oauthSession(await getSession(did as `did:${string}:${string}`, { allowStale: true })); } catch { localStorage.removeItem(SIGNED_IN); await signedInHere(undefined); return undefined; } }
uses
- tcmts.registry.session.RegistrySession
- tcmts.registry.session.SIGNED_IN
- tcmts.registry.session.configure
- tcmts.registry.session.oauthSession
- tcmts.registry.session.signedInHere