UNPKG

sdk-simple-auth

Version:

Universal JavaScript/TypeScript authentication SDK with multi-backend support, automatic token refresh, and React integration

41 lines 1.47 kB
import { AuthSDK } from '../core/AuthSDK'; import { LoginCredentials, RegisterData, AuthTokens } from '../types'; /** * Enhanced useAuth hook with better error handling and loading states */ export declare function useAuth(authSDK: AuthSDK): { sessionInfo: { isValid: boolean; refreshAvailable: boolean; sessionId: string | null; } | null; login: (credentials: LoginCredentials) => Promise<import("../types").AuthUser>; register: (userData: RegisterData) => Promise<import("../types").AuthUser>; logout: () => Promise<void>; refreshTokens: () => Promise<AuthTokens>; forceRefreshTokens: () => Promise<AuthTokens>; getAuthHeaders: () => Promise<Record<string, string>>; getValidAccessToken: () => Promise<string | null>; checkAuthStatus: () => Promise<boolean>; debugToken: (token?: string) => void; debugResponse: (response: any) => void; hasValidSession: boolean | undefined; canRefresh: boolean; sessionId: string | null; isAuthenticated: boolean; user: import("../types").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; }; }; //# sourceMappingURL=useAuth.d.ts.map