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.

34 lines (28 loc) 1.12 kB
/** * Auth Provider Compatibility Layer * * IMPORTANT: This module provides a unified API for both NextAuth and better-auth. * It uses dynamic imports and environment detection to load the correct provider at runtime. * * The actual hooks implementation is in separate files to avoid React Hooks rules violations. * Import from this file to get provider-agnostic authentication hooks. */ 'use client'; export type { AuthSession, AuthUser } from './types'; export type { SignInResult, SignInOptions, UseSessionResult } from './react-hooks'; // Re-export the provider type export type AuthProvider = 'nextauth' | 'better-auth'; /** * Get configured auth provider from environment */ export function getAuthProvider(): AuthProvider { if (typeof window !== 'undefined') { return (process.env.NEXT_PUBLIC_AUTH_PROVIDER || 'nextauth') as AuthProvider; } return 'nextauth'; } /** * Re-export hooks based on provider * These will be imported from the correct provider-specific module at build time */ export { useSession, useSignIn, useSignOut } from './react-hooks';