@bitbaum/accountkit 0.0.0-stage → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +203 -2
- package/dist/AccountMenu.d.ts +76 -0
- package/dist/AccountMenu.d.ts.map +1 -0
- package/dist/AccountMenu.js +156 -0
- package/dist/AccountMenu.js.map +1 -0
- package/dist/SignInError.d.ts +50 -0
- package/dist/SignInError.d.ts.map +1 -0
- package/dist/SignInError.js +34 -0
- package/dist/SignInError.js.map +1 -0
- package/dist/auth/client.d.ts +19 -0
- package/dist/auth/client.d.ts.map +1 -0
- package/dist/auth/client.js +17 -0
- package/dist/auth/client.js.map +1 -0
- package/dist/auth/factor.d.ts +9 -0
- package/dist/auth/factor.d.ts.map +1 -0
- package/dist/auth/factor.js +107 -0
- package/dist/auth/factor.js.map +1 -0
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +6 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/labels.d.ts +114 -0
- package/dist/auth/labels.d.ts.map +1 -0
- package/dist/auth/labels.js +132 -0
- package/dist/auth/labels.js.map +1 -0
- package/dist/auth/limits.d.ts +28 -0
- package/dist/auth/limits.d.ts.map +1 -0
- package/dist/auth/limits.js +90 -0
- package/dist/auth/limits.js.map +1 -0
- package/dist/auth/mail.d.ts +10 -0
- package/dist/auth/mail.d.ts.map +1 -0
- package/dist/auth/mail.js +45 -0
- package/dist/auth/mail.js.map +1 -0
- package/dist/auth/methods.d.ts +71 -0
- package/dist/auth/methods.d.ts.map +1 -0
- package/dist/auth/methods.js +92 -0
- package/dist/auth/methods.js.map +1 -0
- package/dist/auth/next.d.ts +73 -0
- package/dist/auth/next.d.ts.map +1 -0
- package/dist/auth/next.js +131 -0
- package/dist/auth/next.js.map +1 -0
- package/dist/auth/react.d.ts +174 -0
- package/dist/auth/react.d.ts.map +1 -0
- package/dist/auth/react.js +396 -0
- package/dist/auth/react.js.map +1 -0
- package/dist/auth/recovery.d.ts +17 -0
- package/dist/auth/recovery.d.ts.map +1 -0
- package/dist/auth/recovery.js +85 -0
- package/dist/auth/recovery.js.map +1 -0
- package/dist/auth/roles.d.ts +19 -0
- package/dist/auth/roles.d.ts.map +1 -0
- package/dist/auth/roles.js +29 -0
- package/dist/auth/roles.js.map +1 -0
- package/dist/auth/schema.d.ts +1923 -0
- package/dist/auth/schema.d.ts.map +1 -0
- package/dist/auth/schema.js +120 -0
- package/dist/auth/schema.js.map +1 -0
- package/dist/auth/server.d.ts +56 -0
- package/dist/auth/server.d.ts.map +1 -0
- package/dist/auth/server.js +229 -0
- package/dist/auth/server.js.map +1 -0
- package/dist/auth/translations.d.ts +9 -0
- package/dist/auth/translations.d.ts.map +1 -0
- package/dist/auth/translations.js +513 -0
- package/dist/auth/translations.js.map +1 -0
- package/dist/identity.d.ts +50 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +76 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/orangecat.d.ts +333 -0
- package/dist/orangecat.d.ts.map +1 -0
- package/dist/orangecat.js +508 -0
- package/dist/orangecat.js.map +1 -0
- package/dist/paths.d.ts +3 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +11 -0
- package/dist/paths.js.map +1 -0
- package/package.json +145 -4
- package/styles.css +383 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/auth/schema.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
3
|
+
* Drizzle tables. Every product re-exports these from its own schema file:
|
|
4
|
+
*
|
|
5
|
+
* export * from "@bitbaum/accountkit/auth/schema";
|
|
6
|
+
*
|
|
7
|
+
* so drizzle-kit generates ONE migration for accounts that is identical in
|
|
8
|
+
* every product. A column that drifts here does not fail the build, it fails
|
|
9
|
+
* at sign-in, which is why this lives in one place.
|
|
10
|
+
*
|
|
11
|
+
* Pseudonymous by default: `name` may be empty and is never required to be
|
|
12
|
+
* real. A method that brings no email gets an address under `.invalid`
|
|
13
|
+
* (see methods.ts `placeholderEmail`).
|
|
14
|
+
*/
|
|
15
|
+
import { boolean, index, integer, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
|
|
16
|
+
import { DEFAULT_ROLE } from "./roles.js";
|
|
17
|
+
const timestamps = {
|
|
18
|
+
createdAt: timestamp("created_at", { withTimezone: true })
|
|
19
|
+
.defaultNow()
|
|
20
|
+
.notNull(),
|
|
21
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
22
|
+
.defaultNow()
|
|
23
|
+
.$onUpdate(() => new Date())
|
|
24
|
+
.notNull(),
|
|
25
|
+
};
|
|
26
|
+
export const user = pgTable("users", {
|
|
27
|
+
id: text("id").primaryKey(),
|
|
28
|
+
name: text("name").notNull().default(""),
|
|
29
|
+
email: text("email").notNull().unique(),
|
|
30
|
+
emailVerified: boolean("email_verified").notNull().default(false),
|
|
31
|
+
image: text("image"),
|
|
32
|
+
/** What this person is to the product. Never set by the person: sign-up ignores it. */
|
|
33
|
+
role: text("role").notNull().default(DEFAULT_ROLE),
|
|
34
|
+
twoFactorEnabled: boolean("two_factor_enabled").notNull().default(false),
|
|
35
|
+
...timestamps,
|
|
36
|
+
});
|
|
37
|
+
export const session = pgTable("sessions", {
|
|
38
|
+
id: text("id").primaryKey(),
|
|
39
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
40
|
+
token: text("token").notNull().unique(),
|
|
41
|
+
// Left empty on purpose: IP tracking is switched off.
|
|
42
|
+
ipAddress: text("ip_address"),
|
|
43
|
+
userAgent: text("user_agent"),
|
|
44
|
+
userId: text("user_id")
|
|
45
|
+
.notNull()
|
|
46
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
47
|
+
...timestamps,
|
|
48
|
+
}, (t) => [index("sessions_user_id_idx").on(t.userId)]);
|
|
49
|
+
export const account = pgTable("accounts", {
|
|
50
|
+
id: text("id").primaryKey(),
|
|
51
|
+
accountId: text("account_id").notNull(),
|
|
52
|
+
providerId: text("provider_id").notNull(),
|
|
53
|
+
userId: text("user_id")
|
|
54
|
+
.notNull()
|
|
55
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
56
|
+
// Provider tokens are never kept: the product needs to know WHO signed in.
|
|
57
|
+
accessToken: text("access_token"),
|
|
58
|
+
refreshToken: text("refresh_token"),
|
|
59
|
+
idToken: text("id_token"),
|
|
60
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at", {
|
|
61
|
+
withTimezone: true,
|
|
62
|
+
}),
|
|
63
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at", {
|
|
64
|
+
withTimezone: true,
|
|
65
|
+
}),
|
|
66
|
+
scope: text("scope"),
|
|
67
|
+
/** A slow, salted hash (scrypt). Never a plaintext secret. */
|
|
68
|
+
password: text("password"),
|
|
69
|
+
...timestamps,
|
|
70
|
+
}, (t) => [
|
|
71
|
+
index("accounts_user_id_idx").on(t.userId),
|
|
72
|
+
// One local person per provider identity.
|
|
73
|
+
uniqueIndex("accounts_provider_account_uidx").on(t.providerId, t.accountId),
|
|
74
|
+
]);
|
|
75
|
+
export const verification = pgTable("verifications", {
|
|
76
|
+
id: text("id").primaryKey(),
|
|
77
|
+
identifier: text("identifier").notNull(),
|
|
78
|
+
value: text("value").notNull(),
|
|
79
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
80
|
+
...timestamps,
|
|
81
|
+
}, (t) => [index("verifications_identifier_idx").on(t.identifier)]);
|
|
82
|
+
export const passkey = pgTable("passkeys", {
|
|
83
|
+
id: text("id").primaryKey(),
|
|
84
|
+
name: text("name"),
|
|
85
|
+
publicKey: text("public_key").notNull(),
|
|
86
|
+
userId: text("user_id")
|
|
87
|
+
.notNull()
|
|
88
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
89
|
+
credentialID: text("credential_id").notNull().unique(),
|
|
90
|
+
counter: integer("counter").notNull(),
|
|
91
|
+
deviceType: text("device_type").notNull(),
|
|
92
|
+
backedUp: boolean("backed_up").notNull(),
|
|
93
|
+
transports: text("transports"),
|
|
94
|
+
aaguid: text("aaguid"),
|
|
95
|
+
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
|
|
96
|
+
}, (t) => [index("passkeys_user_id_idx").on(t.userId)]);
|
|
97
|
+
export const twoFactor = pgTable("two_factors", {
|
|
98
|
+
id: text("id").primaryKey(),
|
|
99
|
+
/** Encrypted by better-auth with BETTER_AUTH_SECRET before it is stored. */
|
|
100
|
+
secret: text("secret").notNull(),
|
|
101
|
+
backupCodes: text("backup_codes").notNull(),
|
|
102
|
+
userId: text("user_id")
|
|
103
|
+
.notNull()
|
|
104
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
105
|
+
verified: boolean("verified").default(true),
|
|
106
|
+
failedVerificationCount: integer("failed_verification_count").default(0),
|
|
107
|
+
lockedUntil: timestamp("locked_until", { withTimezone: true }),
|
|
108
|
+
}, (t) => [
|
|
109
|
+
index("two_factors_user_id_idx").on(t.userId),
|
|
110
|
+
index("two_factors_secret_idx").on(t.secret),
|
|
111
|
+
]);
|
|
112
|
+
export const authSchema = {
|
|
113
|
+
user,
|
|
114
|
+
session,
|
|
115
|
+
account,
|
|
116
|
+
verification,
|
|
117
|
+
passkey,
|
|
118
|
+
twoFactor,
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../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E,OAAO,CAAC,2BAA2B,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,WAAW,EAAE,SAAS,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;CAC/D,EACD,CAAC,CAAC,EAAE,EAAE,CAAC;IACL,KAAK,CAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;CAC7C,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI;IACJ,OAAO;IACP,OAAO;IACP,YAAY;IACZ,OAAO;IACP,SAAS;CACV,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { betterAuth } from "better-auth";
|
|
2
|
+
import type { GenericOAuthConfig } from "better-auth/plugins";
|
|
3
|
+
import { type OidcClient } from "./methods.js";
|
|
4
|
+
export type AuthMailKind = "verify" | "magicLink" | "reset";
|
|
5
|
+
export interface AuthMailer {
|
|
6
|
+
/** Whether mail can be sent at all. Without it the methods that need mail are hidden. */
|
|
7
|
+
configured: boolean;
|
|
8
|
+
/** Send an account mail. Must not throw, and must not log the link. */
|
|
9
|
+
send(kind: AuthMailKind, to: string, url: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface AuthSite {
|
|
12
|
+
/** The public origin, e.g. https://causius.orangecat.ch. Pinned, never inferred. */
|
|
13
|
+
url: string;
|
|
14
|
+
/** Shown in authenticator apps and passkey prompts. */
|
|
15
|
+
title: string;
|
|
16
|
+
/** Cookie prefix. */
|
|
17
|
+
slug: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CreateAuthOptions {
|
|
20
|
+
site: AuthSite;
|
|
21
|
+
/** A Drizzle node-postgres or pglite database holding the tables in ./schema. */
|
|
22
|
+
database: unknown;
|
|
23
|
+
/** Defaults to this package's tables; pass your own only if you must. */
|
|
24
|
+
schema?: Record<string, unknown>;
|
|
25
|
+
mail: AuthMailer;
|
|
26
|
+
env?: NodeJS.ProcessEnv;
|
|
27
|
+
/**
|
|
28
|
+
* Called as a sign-in method is attached to a person (a first sign-up
|
|
29
|
+
* included), once the person exists. A product that used to identify people by another id — an
|
|
30
|
+
* OrangeCat actor id, say — re-keys its own rows here. Must be idempotent;
|
|
31
|
+
* a throw is logged and never blocks the sign-in.
|
|
32
|
+
*/
|
|
33
|
+
onAccountCreated?: (account: {
|
|
34
|
+
userId: string;
|
|
35
|
+
providerId: string;
|
|
36
|
+
accountId: string;
|
|
37
|
+
}) => Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export type AuthStatus = {
|
|
40
|
+
ready: true;
|
|
41
|
+
} | {
|
|
42
|
+
ready: false;
|
|
43
|
+
reason: "no_database" | "no_secret";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The session secret: BETTER_AUTH_SECRET, or the AUTH_SECRET a product moving
|
|
47
|
+
* off next-auth already has on its server (better-auth reads the same pair).
|
|
48
|
+
* Either way it must be 32+ characters in production.
|
|
49
|
+
*/
|
|
50
|
+
export declare function secretFrom(env: NodeJS.ProcessEnv): string;
|
|
51
|
+
export declare function authStatusFor(databaseConfigured: boolean, env?: NodeJS.ProcessEnv): AuthStatus;
|
|
52
|
+
/** An OIDC client as better-auth's generic OAuth provider. */
|
|
53
|
+
export declare function oidcProvider(client: OidcClient): GenericOAuthConfig;
|
|
54
|
+
export type Auth = ReturnType<typeof betterAuth>;
|
|
55
|
+
export declare function createAuthInstance(options: CreateAuthOptions): Auth;
|
|
56
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/auth/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC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AE,OAAO,EAC3B,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,UAAU,CAOZ;AAaD,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,kBAAkB,CAiCnE;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAEjD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CA0JnE"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { passkey } from "@better-auth/passkey";
|
|
2
|
+
import { betterAuth } from "better-auth";
|
|
3
|
+
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
4
|
+
import { nextCookies } from "better-auth/next-js";
|
|
5
|
+
import { genericOAuth, magicLink } from "better-auth/plugins";
|
|
6
|
+
import { oidcClients, placeholderEmail, signInMethods, } from "./methods.js";
|
|
7
|
+
import { DEFAULT_ROLE } from "./roles.js";
|
|
8
|
+
import { authSchema } from "./schema.js";
|
|
9
|
+
import { factorForAllMethods } from "./factor.js";
|
|
10
|
+
/**
|
|
11
|
+
* Accounts for a bitbaum product: better-auth 1.x on Drizzle + pg, configured
|
|
12
|
+
* the same way everywhere (fleet STACK.md, "Identity"). A product passes in
|
|
13
|
+
* what is its own — its address, its database, its mail — and gets the same
|
|
14
|
+
* methods, limits, cookie rules and account-linking rules as every other.
|
|
15
|
+
*/
|
|
16
|
+
const MIN_SECRET_LENGTH = 32;
|
|
17
|
+
const DEV_SECRET = "development-only-secret-never-used-in-production-0000";
|
|
18
|
+
/**
|
|
19
|
+
* The session secret: BETTER_AUTH_SECRET, or the AUTH_SECRET a product moving
|
|
20
|
+
* off next-auth already has on its server (better-auth reads the same pair).
|
|
21
|
+
* Either way it must be 32+ characters in production.
|
|
22
|
+
*/
|
|
23
|
+
export function secretFrom(env) {
|
|
24
|
+
return (env.BETTER_AUTH_SECRET?.trim() || env.AUTH_SECRET?.trim()) ?? "";
|
|
25
|
+
}
|
|
26
|
+
export function authStatusFor(databaseConfigured, env = process.env) {
|
|
27
|
+
if (!databaseConfigured)
|
|
28
|
+
return { ready: false, reason: "no_database" };
|
|
29
|
+
const secret = secretFrom(env);
|
|
30
|
+
if (env.NODE_ENV === "production" && secret.length < MIN_SECRET_LENGTH) {
|
|
31
|
+
return { ready: false, reason: "no_secret" };
|
|
32
|
+
}
|
|
33
|
+
return { ready: true };
|
|
34
|
+
}
|
|
35
|
+
function authSecret(env) {
|
|
36
|
+
const secret = secretFrom(env);
|
|
37
|
+
if (secret.length >= MIN_SECRET_LENGTH)
|
|
38
|
+
return secret;
|
|
39
|
+
if (env.NODE_ENV === "production") {
|
|
40
|
+
throw new Error("BETTER_AUTH_SECRET is missing or shorter than 32 characters");
|
|
41
|
+
}
|
|
42
|
+
return DEV_SECRET;
|
|
43
|
+
}
|
|
44
|
+
/** An OIDC client as better-auth's generic OAuth provider. */
|
|
45
|
+
export function oidcProvider(client) {
|
|
46
|
+
return {
|
|
47
|
+
providerId: client.providerId,
|
|
48
|
+
discoveryUrl: client.discoveryUrl,
|
|
49
|
+
// Identity comes from a VERIFIED id_token (issuer + JWKS from discovery);
|
|
50
|
+
// a discovery that cannot provide them skips the provider instead of
|
|
51
|
+
// silently decoding an unverified token.
|
|
52
|
+
requireIdTokenVerification: true,
|
|
53
|
+
clientId: client.clientId,
|
|
54
|
+
clientSecret: client.clientSecret,
|
|
55
|
+
// OrangeCat's token endpoint accepts ONLY client_secret_post (it answers
|
|
56
|
+
// basic with a misleading 400 "client_id is required"); the shared sign-in
|
|
57
|
+
// speaks the same. PKCE is required even for confidential clients.
|
|
58
|
+
tokenEndpointAuth: { method: "client_secret_post" },
|
|
59
|
+
pkce: true,
|
|
60
|
+
scopes: ["openid", "profile", "email"],
|
|
61
|
+
// Who signed in, never their provider address: see placeholderEmail.
|
|
62
|
+
mapProfileToUser: (profile) => {
|
|
63
|
+
const subject = String(profile.sub ?? profile.id ?? "");
|
|
64
|
+
if (!subject)
|
|
65
|
+
throw new Error(`${client.providerId}: id_token has no sub`);
|
|
66
|
+
const handle = typeof profile.preferred_username === "string"
|
|
67
|
+
? profile.preferred_username
|
|
68
|
+
: "";
|
|
69
|
+
return {
|
|
70
|
+
name: handle.replace(/^@/, "").slice(0, 80),
|
|
71
|
+
email: placeholderEmail(client.providerId, subject),
|
|
72
|
+
emailVerified: false,
|
|
73
|
+
image: undefined,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export function createAuthInstance(options) {
|
|
79
|
+
const env = options.env ?? process.env;
|
|
80
|
+
const { site, mail } = options;
|
|
81
|
+
const methods = signInMethods(env, mail.configured);
|
|
82
|
+
const providers = oidcClients(env).map(oidcProvider);
|
|
83
|
+
const origin = new URL(site.url);
|
|
84
|
+
const schema = options.schema ?? authSchema;
|
|
85
|
+
const auth = betterAuth({
|
|
86
|
+
appName: site.title,
|
|
87
|
+
secret: authSecret(env),
|
|
88
|
+
// Pinned, never inferred from the request: behind Caddy the app sees its
|
|
89
|
+
// INTERNAL origin, and links built from it point at localhost.
|
|
90
|
+
baseURL: site.url,
|
|
91
|
+
trustedOrigins: [origin.origin],
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
+
database: drizzleAdapter(options.database, {
|
|
94
|
+
provider: "pg",
|
|
95
|
+
schema: {
|
|
96
|
+
user: schema.user,
|
|
97
|
+
session: schema.session,
|
|
98
|
+
account: schema.account,
|
|
99
|
+
verification: schema.verification,
|
|
100
|
+
passkey: schema.passkey,
|
|
101
|
+
twoFactor: schema.twoFactor,
|
|
102
|
+
},
|
|
103
|
+
}),
|
|
104
|
+
telemetry: { enabled: false },
|
|
105
|
+
// One rate limiter, keyed on the proxy's hop (./limits), run by the route
|
|
106
|
+
// handler. better-auth's own would key on the first X-Forwarded-For entry,
|
|
107
|
+
// which the caller chooses.
|
|
108
|
+
rateLimit: { enabled: false },
|
|
109
|
+
advanced: {
|
|
110
|
+
useSecureCookies: env.NODE_ENV === "production",
|
|
111
|
+
// An IP address next to a session is personal data the product does not need.
|
|
112
|
+
ipAddress: { disableIpTracking: true },
|
|
113
|
+
cookiePrefix: site.slug,
|
|
114
|
+
},
|
|
115
|
+
session: {
|
|
116
|
+
expiresIn: 14 * 24 * 60 * 60,
|
|
117
|
+
updateAge: 24 * 60 * 60,
|
|
118
|
+
// Changing a password, a passkey or 2FA needs a session younger than this.
|
|
119
|
+
freshAge: 15 * 60,
|
|
120
|
+
},
|
|
121
|
+
user: {
|
|
122
|
+
additionalFields: {
|
|
123
|
+
// Never accepted from the person: a sign-up body carrying role: "admin" is ignored.
|
|
124
|
+
role: {
|
|
125
|
+
type: "string",
|
|
126
|
+
required: false,
|
|
127
|
+
defaultValue: DEFAULT_ROLE,
|
|
128
|
+
input: false,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
deleteUser: { enabled: true },
|
|
132
|
+
changeEmail: { enabled: mail.configured },
|
|
133
|
+
},
|
|
134
|
+
account: {
|
|
135
|
+
accountLinking: {
|
|
136
|
+
enabled: true,
|
|
137
|
+
// An address is never an identity: a new sign-in method joins an
|
|
138
|
+
// account only when the signed-in person links it from their account page.
|
|
139
|
+
disableImplicitLinking: true,
|
|
140
|
+
allowDifferentEmails: true,
|
|
141
|
+
},
|
|
142
|
+
encryptOAuthTokens: true,
|
|
143
|
+
},
|
|
144
|
+
databaseHooks: {
|
|
145
|
+
account: {
|
|
146
|
+
// The product needs to know WHO signed in, not to act at the provider
|
|
147
|
+
// on their behalf, so provider tokens are dropped before they are stored.
|
|
148
|
+
create: {
|
|
149
|
+
// Runs just before the sign-in method is stored, when the person's
|
|
150
|
+
// row already exists. (better-auth's `after` hooks are queued behind
|
|
151
|
+
// a transaction this adapter never opens, and did not fire.)
|
|
152
|
+
before: async (data) => {
|
|
153
|
+
try {
|
|
154
|
+
await options.onAccountCreated?.({
|
|
155
|
+
userId: String(data.userId),
|
|
156
|
+
providerId: String(data.providerId),
|
|
157
|
+
accountId: String(data.accountId),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.error(`[auth] onAccountCreated failed: ${error.name}`);
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
data: {
|
|
165
|
+
...data,
|
|
166
|
+
accessToken: null,
|
|
167
|
+
refreshToken: null,
|
|
168
|
+
idToken: null,
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
update: {
|
|
174
|
+
before: async (data) => ({
|
|
175
|
+
data: {
|
|
176
|
+
...data,
|
|
177
|
+
accessToken: null,
|
|
178
|
+
refreshToken: null,
|
|
179
|
+
idToken: null,
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
emailAndPassword: {
|
|
186
|
+
enabled: true,
|
|
187
|
+
minPasswordLength: 12,
|
|
188
|
+
maxPasswordLength: 128,
|
|
189
|
+
autoSignIn: !methods.verifyEmail,
|
|
190
|
+
// Without mail a verification link could never arrive, and requiring
|
|
191
|
+
// one would strand every new account.
|
|
192
|
+
requireEmailVerification: methods.verifyEmail,
|
|
193
|
+
revokeSessionsOnPasswordReset: true,
|
|
194
|
+
sendResetPassword: mail.configured
|
|
195
|
+
? async ({ user, url }) => mail.send("reset", user.email, url)
|
|
196
|
+
: undefined,
|
|
197
|
+
},
|
|
198
|
+
emailVerification: {
|
|
199
|
+
sendOnSignUp: methods.verifyEmail,
|
|
200
|
+
autoSignInAfterVerification: true,
|
|
201
|
+
sendVerificationEmail: async ({ user, url }) => mail.send("verify", user.email, url),
|
|
202
|
+
},
|
|
203
|
+
plugins: [
|
|
204
|
+
// allowPasswordless: someone who signs in only by passkey, link or OIDC can
|
|
205
|
+
// still add a second factor (with a fresh session instead of a password).
|
|
206
|
+
factorForAllMethods(site),
|
|
207
|
+
passkey({
|
|
208
|
+
rpID: origin.hostname,
|
|
209
|
+
rpName: site.title,
|
|
210
|
+
origin: origin.origin,
|
|
211
|
+
}),
|
|
212
|
+
...(methods.magicLink
|
|
213
|
+
? [
|
|
214
|
+
magicLink({
|
|
215
|
+
expiresIn: 10 * 60,
|
|
216
|
+
sendMagicLink: async ({ email, url }) => mail.send("magicLink", email, url),
|
|
217
|
+
}),
|
|
218
|
+
]
|
|
219
|
+
: []),
|
|
220
|
+
...(providers.length > 0 ? [genericOAuth({ config: providers })] : []),
|
|
221
|
+
// Lets server actions set cookies; keep it last.
|
|
222
|
+
nextCookies(),
|
|
223
|
+
],
|
|
224
|
+
});
|
|
225
|
+
// The inferred type names zod internals and cannot be published; the base
|
|
226
|
+
// type carries every call the products make (api.getSession, handler).
|
|
227
|
+
return auth;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/auth/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,aAAa,GAEd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,UAAU,GAAG,uDAAuD,CAAC;AA4C3E;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC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,CACtC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,CAAC;qBACrC,CAAC;iBACH;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACtE,iDAAiD;YACjD,WAAW,EAAE;SACd;KACF,CAAC,CAAC;IACH,0EAA0E;IAC1E,uEAAuE;IACvE,OAAO,IAAuB,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AuthLabels } from "./labels.js";
|
|
2
|
+
/** The languages with a full set of labels. */
|
|
3
|
+
export declare const AUTH_LABEL_LOCALES: string[];
|
|
4
|
+
/**
|
|
5
|
+
* The labels for a locale such as `de`, `de-CH` or `fr`. Unknown languages
|
|
6
|
+
* get English, which is the package's own default.
|
|
7
|
+
*/
|
|
8
|
+
export declare function authLabelsFor(locale: string | null | undefined): AuthLabels;
|
|
9
|
+
//# sourceMappingURL=translations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../src/auth/translations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAqmBnE,+CAA+C;AAC/C,eAAO,MAAM,kBAAkB,UAA2B,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,CAG3E"}
|