feaeet: add passkeys support

This commit is contained in:
2026-03-10 22:46:51 +08:00
parent 476b48addb
commit d3d25d56d8
7 changed files with 358 additions and 67 deletions

View File

@@ -1,27 +1,26 @@
import { betterAuth } from 'better-auth'
import { drizzleAdapter } from 'better-auth/adapters/drizzle'
import { useDrizzle } from './db.js'
import * as schema from '@/db/schema.ts'
import { admin, bearer, username } from 'better-auth/plugins'
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { useDrizzle } from "./db.js";
import * as schema from "@/db/schema.ts";
import { admin, bearer, username } from "better-auth/plugins";
import { passkey } from "@better-auth/passkey";
export const auth = betterAuth({
database: drizzleAdapter(useDrizzle(), {
provider: 'pg',
provider: "pg",
schema: {
...schema,
},
}),
trustedOrigins: [
process.env.WEB_ORIGIN ?? 'http://localhost:3000',
],
trustedOrigins: [process.env.WEB_ORIGIN ?? "http://localhost:3000"],
user: {
additionalFields: {},
},
emailAndPassword: {
enabled: true,
},
plugins: [admin(), username(), bearer()],
plugins: [admin(), username(), bearer(), passkey()],
advanced: {
cookiePrefix: 'helios_auth',
cookiePrefix: "helios_auth",
},
})
});