import { PolyesterEnvironment } from "../../environment.js"; import { CookieGetter } from "../../utils/cookies.js"; import { AuthCookieLocation } from "./cookie-constants.js"; import { AuthTokenStorage, AuthTokenStorageSetOptions } from "./token-storage.js"; import { ActiveAccountInfo, AuthLoginMethod, ServerSessionSnapshot, SessionData } from "./session.types.js"; //#region src/services/auth/session.d.ts interface SessionCookieOptions { maxAgeSeconds?: number | null; } /** Options for reading browser auth cookies from a server runtime. */ interface ServerSessionCookieOptions { /** Location of the page or request that supplied the cookies. */ cookieLocation?: AuthCookieLocation; /** Base name configured for the browser bearer-token cookie. */ tokenCookieName?: string; } interface CommitLoginSessionParams { accessToken: string; tokenOptions: AuthTokenStorageSetOptions; provider: SessionData["provider"]; loginMethod: AuthLoginMethod | null; primaryWallet: string; smartAccount: string; accountId: string; activeAccount?: ActiveAccountInfo; username?: string; } interface EnsureSessionParams { provider: SessionData["provider"]; loginMethod: AuthLoginMethod | null; primaryWallet: string; smartAccount: string; accountId: string; username?: string; } declare function emptyServerSessionSnapshot(): ServerSessionSnapshot; /** * Parses bearer authentication and display-only session cookies into a server snapshot. */ declare function parseServerSessionSnapshot(cookies: CookieGetter, environment: PolyesterEnvironment, options?: ServerSessionCookieOptions): ServerSessionSnapshot; /** * Owns environment-bound auth session transitions for browser clients. */ declare class AuthSessionStore { #private; constructor({ environmentFingerprint }: { environmentFingerprint: string; }); get(): SessionData | null; getEnvironmentBoundToken(tokenStorage: AuthTokenStorage): string | null; commitLogin(params: CommitLoginSessionParams, tokenStorage: AuthTokenStorage): void; ensureSession(params: EnsureSessionParams, options?: SessionCookieOptions): SessionData; setUsername(username: string | null, options?: SessionCookieOptions): void; setActiveAccount(activeAccount: Omit, options?: SessionCookieOptions): void; clear(): void; } //#endregion export { type ActiveAccountInfo, type AuthLoginMethod, AuthSessionStore, CommitLoginSessionParams, EnsureSessionParams, ServerSessionCookieOptions, type ServerSessionSnapshot, SessionCookieOptions, type SessionData, emptyServerSessionSnapshot, parseServerSessionSnapshot }; //# sourceMappingURL=session.d.ts.map