import type { AuthState } from "@0xmonaco/types"; export interface TokenLifecycleConfig { /** Enable automatic token refresh (default: true) */ autoRefresh?: boolean; /** Enable token persistence in localStorage (default: true) */ persistTokens?: boolean; /** Buffer time in seconds before token expiry to trigger refresh (default: 300 = 5 minutes) */ refreshBufferSeconds?: number; /** Callback when token refresh fails */ onRefreshError?: (error: Error) => void; /** Callback when token is refreshed successfully */ onRefreshSuccess?: (authState: AuthState) => void; } export interface UseTokenLifecycleReturn { /** Initialize token lifecycle with auth state */ initializeTokens: (authState: AuthState) => void; /** Clear tokens and stop lifecycle management */ clearTokens: () => void; /** Manually trigger token refresh */ refreshTokens: () => Promise; /** Check if token is expired or near expiry */ isTokenExpired: (authState: AuthState | null) => boolean; }