/** * Authentication configuration for Better Auth */ import type { Environment } from '../env.js' export interface AuthConfig { secret: string baseURL: string database?: D1Database session?: { expiresIn: number updateAge: number } } export function createAuth(env: Environment): AuthConfig { return { secret: env.BETTER_AUTH_SECRET || 'default-secret-for-development', baseURL: env.BETTER_AUTH_URL || 'http://localhost:8787', database: env.DB, session: { expiresIn: 60 * 60 * 24 * 7, // 7 days updateAge: 60 * 60 * 24, // 1 day }, } } export const auth = { // Auth utilities and helpers verifySession: async (_token: string) => { // Session verification logic return null }, createSession: async (_userId: string) => { // Session creation logic return null }, destroySession: async (_token: string) => { // Session destruction logic return true }, }