mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 00:51:20 +00:00
Replace raw pg Pool with Drizzle ORM backed by Bun.sql. Add per-user source configuration table (user_sources). Migrate Better Auth to drizzle-adapter. Add AES-256-GCM credential encryption. Co-authored-by: Ona <no-reply@ona.com>
20 lines
428 B
TypeScript
20 lines
428 B
TypeScript
import { betterAuth } from "better-auth"
|
|
import { drizzleAdapter } from "better-auth/adapters/drizzle"
|
|
|
|
import type { Database } from "../db/index.ts"
|
|
import * as schema from "../db/schema.ts"
|
|
|
|
export function createAuth(db: Database) {
|
|
return betterAuth({
|
|
database: drizzleAdapter(db, {
|
|
provider: "pg",
|
|
schema,
|
|
}),
|
|
emailAndPassword: {
|
|
enabled: true,
|
|
},
|
|
})
|
|
}
|
|
|
|
export type Auth = ReturnType<typeof createAuth>
|