import type { AuthState } from "@0xmonaco/types"; /** * Save auth state to localStorage * * @security This function stores the session keypair (including the private * key) in localStorage, which is accessible to any JavaScript running on the * page. This is the same XSS exposure as the previous JWT-based scheme — an * attacker who can read localStorage can act as the user until the session * expires either way. * * Security recommendations: * - Implement Content Security Policy (CSP) headers to mitigate XSS risks * - Sanitize all user input to prevent XSS vulnerabilities * - Consider the tradeoffs: localStorage provides persistence across sessions but sacrifices XSS protection * - For higher-security requirements, back the session key with a * non-extractable WebCrypto key (out of scope for this default helper) * * @param authState - The authentication state to persist */ export declare function saveAuthState(authState: AuthState): void; /** * Load auth state from localStorage * @returns The persisted auth state or null if not found/invalid */ export declare function loadAuthState(): AuthState | null; /** * Clear auth state from localStorage */ export declare function clearAuthState(): void; /** * Check if the stored token is expired * @param authState - The auth state to check * @param bufferSeconds - Buffer time before actual expiry (default: 60 seconds) * @returns True if token is expired or will expire within buffer time */ export declare function isTokenExpired(authState: AuthState, bufferSeconds?: number): boolean; /** * Get time until token expiration in seconds * @param authState - The auth state to check * @returns Seconds until expiration (negative if already expired) */ export declare function getTimeUntilExpiry(authState: AuthState): number;