import type { AithosSession } from "./auth.js"; /** * Pluggable storage backend for the active session. * * Implementations should be **synchronous** : the SDK reads the store on * boot to surface `getCurrentSession()` and async storage would force a * Promise everywhere it's not warranted. Async backends should pre-warm * the cache during the app's bootstrap and then implement the methods * over that cache. * * `set` is called after every successful sign-in / sign-up / Google * callback exchange. `clear` is called on `signOut`. `get` is called by * `getCurrentSession()` and may also be called by the app on boot. */ export interface AithosSessionStore { /** Read the persisted session. Return null if none, or if it's expired. */ get(): AithosSession | null; /** Persist the session. Implementations should not throw — at worst * they should warn and silently no-op (e.g. quota exceeded). */ set(session: AithosSession): void; /** Wipe the persisted session. */ clear(): void; } /** * Storage key used by the bundled stores. Apps that want to coexist with * other Aithos-aware libs (or that want to scope sessions per-tenant) can * pass a custom key via {@link sessionStorageStore} or * {@link localStorageStore}. */ export declare const DEFAULT_SESSION_STORAGE_KEY = "aithos.session.v1"; interface WebStorageStoreOptions { /** Storage key. Defaults to {@link DEFAULT_SESSION_STORAGE_KEY}. */ readonly key?: string; } /** * Default web store : `sessionStorage`. The session lives until the tab * is closed. Cleared on `signOut()`. Use this when reauthenticating each * day is acceptable and reduces blast radius after an XSS. */ export declare function sessionStorageStore(opts?: WebStorageStoreOptions): AithosSessionStore; /** * `localStorage` store. The session persists until the JWT expires or the * user explicitly signs out. Higher convenience, larger XSS blast radius. */ export declare function localStorageStore(opts?: WebStorageStoreOptions): AithosSessionStore; /** * No-op store. `set` and `clear` discard their input ; `get` always * returns null. The default in non-browser contexts (Node, edge runtimes) * — apps running there should pass their own store explicitly. */ export declare function noopStore(): AithosSessionStore; /** * Pick a sensible default : `sessionStorage` if the browser environment * is available, {@link noopStore} otherwise. */ export declare function defaultSessionStore(): AithosSessionStore; export {}; //# sourceMappingURL=session-store.d.ts.map