export interface AuthConfig { authServiceUrl: string; endpoints?: { login?: string; register?: string; refresh?: string; logout?: string; profile?: string; }; storage?: { type?: 'localStorage' | 'indexedDB'; dbName?: string; dbVersion?: number; storeName?: string; tokenKey?: string; refreshTokenKey?: string; userKey?: string; encryption?: { enabled: boolean; secret?: string; }; }; tokenRefresh?: { enabled?: boolean; /** Milliseconds before expiration to trigger refresh (default: 900_000 = 15 min) */ bufferTime?: number; maxRetries?: number; minimumTokenLifetime?: number; gracePeriod?: number; /** Minimum interval between refreshes in milliseconds (default: 60_000 = 1 min). Within this window, returns cached tokens instead of throwing. */ minRefreshInterval?: number; }; httpClient?: HttpClient; /** * Enable debug mode for verbose logging * @default false */ debug?: boolean; backend?: { type?: 'node-express' | 'laravel-sanctum' | 'jwt-standard' | 'custom'; userSearchPaths?: string[]; fieldMappings?: Record; preserveOriginalData?: boolean; }; sessionValidation?: { enabled?: boolean; validateOnFocus?: boolean; validateOnVisibility?: boolean; maxInactivityTime?: number; autoLogoutOnInvalid?: boolean; validateOnStartup?: boolean; }; interceptors?: { enabled?: boolean; autoInjectToken?: boolean; handleAuthErrors?: boolean; axiosInstance?: any; }; tabSync?: { enabled?: boolean; channelName?: string; /** How long a secondary instance waits for a primary to hand over the session, in ms (default: 5000) */ sessionRequestTimeout?: number; }; /** * Role of this instance when several share the same storage (browser tabs, * or the windows of a desktop app). * * - `'primary'` (default): refreshes tokens and owns the shared storage. * Several primaries coordinate their refreshes with the Web Locks API. * - `'secondary'`: a follower, e.g. an auxiliary window of a desktop app. * It never refreshes and never clears the shared storage on its own: when * its token is missing or expired it asks a primary for the session * (requires `tabSync`). An explicit `logout()` still logs out everywhere. */ instanceRole?: 'primary' | 'secondary'; } export interface HttpClient { post(url: string, data?: any, config?: any): Promise; get(url: string, config?: any): Promise; put(url: string, data?: any, config?: any): Promise; delete(url: string, config?: any): Promise; } export interface AuthTokens { accessToken: string; refreshToken?: string; expiresIn?: number; expiresAt?: string | number; tokenType?: string; _originalTokenResponse?: any; _backendType?: string; _tokenFormat?: 'jwt' | 'opaque' | 'sanctum'; } export interface AuthUser { id: string; email?: string; name?: string; roles?: string[]; firstName?: string; lastName?: string; username?: string; role?: string | string[]; permissions?: string[]; isActive?: boolean; profile?: any; email_verified_at?: string; created_at?: string; updated_at?: string; sucursales?: Array<{ id: number; sucursal: string; sigla: string; rol: string; }>; full_name?: string; lastLogin?: string | Date; createdAt?: string | Date; updatedAt?: string | Date; _id?: string; sub?: string; aud?: string | string[]; iss?: string; exp?: number; iat?: number; _originalUserResponse?: any; _backendType?: string; _extractionMethod?: 'direct' | 'nested' | 'jwt-parsed' | 'scattered'; [key: string]: any; } export interface LoginCredentials { usuario?: string; clave?: string; code?: string; email?: string; password?: string; username?: string; phone?: string; device_name?: string; [key: string]: any; } export interface RegisterData { usuario?: string; clave?: string; code?: string; email: string; password: string; name?: string; firstName?: string; lastName?: string; username?: string; phone?: string; [key: string]: any; } export interface AuthState { isAuthenticated: boolean; user: AuthUser | null; tokens: AuthTokens | null; loading: boolean; error: string | null; isRefreshing?: boolean; lastActivity?: number; sessionExpiry?: number; backendType?: string; capabilities?: { canRefresh: boolean; hasProfile: boolean; supportsOTP: boolean; supportsBiometric: boolean; }; } export interface AuthCallbacks { onAuthStateChanged?: (state: AuthState) => void; onTokenRefresh?: (tokens: AuthTokens) => void; onLogin?: (user: AuthUser, tokens: AuthTokens) => void; onLogout?: () => void; onError?: (error: string) => void; onTokenExpired?: () => void; onSessionRestored?: (user: AuthUser) => void; onRefreshFailed?: (error: string) => void; onUserUpdated?: (user: AuthUser) => void; onBackendDetected?: (backendType: string) => void; onSessionInvalid?: () => void; onSessionValidated?: () => void; } export interface ExtendedSessionInfo { isValid: boolean; user: AuthUser | null; tokens: AuthTokens | null; tokenType: string | null; tokenFormat: 'jwt' | 'opaque' | 'sanctum' | null; expiresIn: number | null; refreshAvailable: boolean; canRefresh: boolean; sessionId: string | null; backendType: string | null; storedAt: number | null; lastRefreshed: number | null; originalResponse: any; } //# sourceMappingURL=index.d.ts.map