import type { Algorithm } from 'jsonwebtoken' export interface User { id: string email: string createdAt: Date updatedAt: Date } export interface Session { id: string userId: string token: string expiresAt: Date createdAt: Date updatedAt: Date invalidated: boolean ipAddress?: string userAgent?: string } export interface OTP { id: string email: string code: string expiresAt: Date used: boolean } export interface AuthConfig { jwt: { secret: string algorithm?: Algorithm } session: { ttl: number // seconds refreshInterval: number // seconds cookieName?: string secure?: boolean sameSite?: 'lax' | 'strict' | 'none' } otp: { ttl: number // seconds length?: number } } // Storage interface export interface AuthStorage { // User operations createUser(email: string): Promise getUserById(id: string): Promise getUserByEmail(email: string): Promise // Session operations createSession( userId: string, token: string, expiresAt: Date, ipAddress?: string, userAgent?: string, ): Promise getSessionById(sessionId: string): Promise updateSession( sessionId: string, data: { token: string; expiresAt: Date }, ): Promise invalidateSession(sessionId: string): Promise invalidateUserSessions(userId: string): Promise // OTP operations createOTP(email: string, code: string, expiresAt: Date): Promise verifyOTP(otpId: string, email: string, code: string): Promise } // Email provider interface export interface EmailProvider { sendOTP(email: string, code: string): Promise } // Framework adapter interface export interface CookieOptions { httpOnly?: boolean secure?: boolean sameSite?: 'lax' | 'strict' | 'none' maxAge?: number path?: string } export interface FrameworkAdapter { setCookie(name: string, value: string, options?: CookieOptions): Promise getCookie(name: string): Promise deleteCookie(name: string): Promise redirect(url: string): Promise }