UNPKG

@nerdlat/auth

Version:

Authentication library similar to Clerk for React and Express applications

63 lines 1.5 kB
export interface User { id: number; email: string; } export interface AuthContextType { user: User | null; setUser: (user: User | null) => void; isLoading: boolean; isSignedIn: boolean; } export interface AuthConfig { baseUrl?: string; apiPath?: string; } export interface AuthOptions { sessionCookie?: string; onUserCreate?: (user: User) => void; onUserLogin?: (user: User) => void; validateEmail?: (email: string) => boolean; validatePassword?: (password: string) => boolean; } export interface AuthProviderProps { children: React.ReactNode; fallback?: React.ReactNode; } /** * Detailed user data returned by OAuth providers. */ export interface UserData { id: string; email: string; name: string; avatar: string; provider: 'google' | 'discord' | 'instagram' | 'facebook' | 'twitter' | 'github' | 'linkedin'; username?: string; verified?: boolean; createdAt: Date; lastLogin: Date; raw: any; permissions?: string[]; } /** * Auth state returned by hooks and services. */ export interface AuthState { user: UserData | null; isLoading: boolean; isAuthenticated: boolean; error: string | null; provider: string | null; } /** * OAuth configuration for each provider. */ export interface OAuthConfig { clientId: string; redirectUri: string; scope: string; authUrl: string; tokenUrl: string; userUrl: string; } //# sourceMappingURL=index.d.ts.map