import { WebSessionManager } from './web-session-manager'; /** * The shared static shape of both client session managers. WebSessionManager * (localStorage) and ReactNativeSessionManager (pluggable StorageAdapter) expose * an identical static API over the SAME storage key, so either one is a drop-in * for the other. */ export type ClientSessionManager = typeof WebSessionManager; /** * Return the active CLIENT session manager for the current runtime. * * This is the single source of truth for "which store holds the session token" * and MUST be used everywhere the client reads/writes the session (login, * restore, logout, and — critically — the per-request auth-header path in * utils.ts). Previously this decision was made ad-hoc with * `typeof window !== 'undefined' ? WebSessionManager : ReactNativeSessionManager`, * which is wrong on React Native: RN defines a global `window`, so that test * picked WebSessionManager and then hit a non-existent `localStorage` — the * session was silently dropped (or threw), so every authenticated request 403'd. * * Decision rule: if a consumer configured the React Native session manager * (ReactNativeSessionManager.configure(), which RN apps call once at startup and * web/Node never do), we're on RN — use it. Otherwise use the localStorage-backed * WebSessionManager (which itself no-ops gracefully in Node/SSR where there is no * `window`). This changes ONLY React Native behavior; web and Node are unchanged. * * NOTE: this intentionally does NOT cover the SERVER (keypair) path — callers that * branch on `isServer` keep using ServerSessionManager and only fall through to * getActiveSessionManager() for the browser/RN client case. */ export declare function getActiveSessionManager(): ClientSessionManager;