UNPKG

codalware-auth

Version:

Complete authentication system with enterprise security, attack protection, team workspaces, waitlist, billing, UI components, 2FA, and account recovery - production-ready in 5 minutes. Enhanced CLI with verification, rollback, and App Router scaffolding.

60 lines (49 loc) 1.29 kB
/** * Auth Provider Abstraction Layer * Enables support for multiple authentication providers (NextAuth, better-auth, etc.) */ export type AuthProvider = 'nextauth' | 'better-auth'; export interface AuthUser { id: string; email: string; name?: string | null; image?: string | null; [key: string]: unknown; } export interface AuthSession { user: AuthUser; expires: string; } export interface SignInCredentials { email: string; password?: string; [key: string]: unknown; } export interface SignInResult { ok: boolean; error?: string; url?: string; } /** * Unified auth adapter interface * Implement this interface for each authentication provider */ export interface AuthAdapter { /** Get current authentication session */ getSession(): Promise<AuthSession | null>; /** Sign in with credentials */ signIn(credentials: SignInCredentials): Promise<SignInResult>; /** Sign out current session */ signOut(): Promise<void>; /** Refresh authentication token if applicable */ refreshSession?(): Promise<void>; } /** * Auth provider configuration */ export interface AuthProviderConfig { provider: AuthProvider; databaseUrl?: string; secret?: string; [key: string]: unknown; }