/** * CODAI Authentication React Hooks * * Comprehensive React hooks for authentication state management, * session handling, and user interactions. */ import type { User, Session, LoginCredentials, RegisterCredentials, ChangePasswordCredentials, AuthContextType, AuthError, DeviceInfo, LoginResponse, RegisterResponse, Permission } from './types'; import { getDeviceInfo, generateDeviceFingerprint, validatePassword } from './utils'; interface AuthStore { user: User | null; session: Session | null; isAuthenticated: boolean; isLoading: boolean; error: AuthError | null; setUser: (user: User | null) => void; setSession: (session: Session | null) => void; setLoading: (loading: boolean) => void; setError: (error: AuthError | null) => void; clearAuth: () => void; login: (credentials: LoginCredentials) => Promise; register: (credentials: RegisterCredentials) => Promise; logout: () => Promise; refreshToken: () => Promise; updateProfile: (updates: Partial) => Promise; changePassword: (credentials: ChangePasswordCredentials) => Promise; getSessions: () => Promise; terminateSession: (sessionId: string) => Promise; terminateAllSessions: () => Promise; } export declare const useAuthStore: import("zustand").UseBoundStore, "persist"> & { persist: { setOptions: (options: Partial>) => void; clearStorage: () => void; rehydrate: () => Promise | void; hasHydrated: () => boolean; onHydrate: (fn: (state: AuthStore) => void) => () => void; onFinishHydration: (fn: (state: AuthStore) => void) => () => void; getOptions: () => Partial>; }; }>; /** * Main authentication hook */ export declare function useAuth(): AuthContextType; /** * Hook for user session information */ export declare function useSession(): { session: Session | null; isActive: boolean; deviceInfo: DeviceInfo | undefined; lastActivity: Date | undefined; expiresAt: Date | undefined; }; /** * Hook for user permissions */ export declare function usePermissions(): { permissions: Permission[]; role: import("./types").UserRole | undefined; hasPermission: (permission: string) => boolean; hasRole: (role: string) => boolean; hasAnyRole: (roles: string[]) => boolean; isAdmin: boolean; isModerator: boolean; isUser: boolean; }; /** * Hook for authentication form state */ export declare function useAuthForm(): { isSubmitting: boolean; setIsSubmitting: import("react").Dispatch>; validationErrors: Record; setValidationErrors: import("react").Dispatch>>; validateField: (field: string, value: any, schema: any) => boolean; clearValidationErrors: () => void; }; /** * Hook for authentication utilities */ export declare function useAuthUtils(): { generateDeviceFingerprint: typeof generateDeviceFingerprint; getDeviceInfo: typeof getDeviceInfo; isValidEmail: (email: string) => boolean; validatePassword: typeof validatePassword; createAuthUrls: (baseUrl?: string) => { login: string; register: string; logout: string; refresh: string; verify: string; resetPassword: string; changePassword: string; profile: string; sessions: string; twoFactor: string; social: (provider: string) => string; }; }; export {}; //# sourceMappingURL=hooks.d.ts.map