better-auth 1.6.3 → 1.6.5
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/dist/client/config.mjs
CHANGED
|
@@ -67,7 +67,7 @@ const getClientConfig = (options, loadEnv) => {
|
|
|
67
67
|
const atomListeners = [{
|
|
68
68
|
signal: "$sessionSignal",
|
|
69
69
|
matcher(path) {
|
|
70
|
-
return path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/change-email";
|
|
70
|
+
return path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/revoke-other-sessions" || path === "/change-email" || path === "/change-password";
|
|
71
71
|
},
|
|
72
72
|
callback(path) {
|
|
73
73
|
if (path === "/sign-out") broadcastSessionUpdate("signout");
|
package/dist/package.mjs
CHANGED
|
@@ -18,19 +18,28 @@ declare module "@better-auth/core" {
|
|
|
18
18
|
* - Auth helpers (login, getAuthHeaders, getCookies)
|
|
19
19
|
* - OTP capture (when captureOTP: true)
|
|
20
20
|
*
|
|
21
|
+
* This plugin does not register public HTTP routes or API endpoints, but it does
|
|
22
|
+
* expose privileged helpers on `ctx.test` for creating sessions and mutating data.
|
|
23
|
+
* Prefer including it in a test-only auth instance such as `auth.test.ts` instead
|
|
24
|
+
* of a production auth config.
|
|
25
|
+
*
|
|
26
|
+
* If you conditionally spread it into `plugins`, TypeScript may stop inferring
|
|
27
|
+
* `ctx.test` correctly. A separate test-only auth instance keeps the helpers
|
|
28
|
+
* typed without adding the plugin to your production auth config.
|
|
29
|
+
*
|
|
21
30
|
* @example
|
|
22
31
|
* ```ts
|
|
23
32
|
* import { betterAuth } from "better-auth";
|
|
24
33
|
* import { testUtils } from "better-auth/plugins";
|
|
25
34
|
*
|
|
26
|
-
* export const
|
|
35
|
+
* export const testAuth = betterAuth({
|
|
27
36
|
* plugins: [
|
|
28
37
|
* testUtils({ captureOTP: true }),
|
|
29
38
|
* ],
|
|
30
39
|
* });
|
|
31
40
|
*
|
|
32
41
|
* // In tests, access helpers via context:
|
|
33
|
-
* const ctx = await
|
|
42
|
+
* const ctx = await testAuth.$context;
|
|
34
43
|
* const test = ctx.test;
|
|
35
44
|
*
|
|
36
45
|
* const user = test.createUser({ email: "test@example.com" });
|
|
@@ -13,19 +13,28 @@ import { createOTPStore } from "./otp-sink.mjs";
|
|
|
13
13
|
* - Auth helpers (login, getAuthHeaders, getCookies)
|
|
14
14
|
* - OTP capture (when captureOTP: true)
|
|
15
15
|
*
|
|
16
|
+
* This plugin does not register public HTTP routes or API endpoints, but it does
|
|
17
|
+
* expose privileged helpers on `ctx.test` for creating sessions and mutating data.
|
|
18
|
+
* Prefer including it in a test-only auth instance such as `auth.test.ts` instead
|
|
19
|
+
* of a production auth config.
|
|
20
|
+
*
|
|
21
|
+
* If you conditionally spread it into `plugins`, TypeScript may stop inferring
|
|
22
|
+
* `ctx.test` correctly. A separate test-only auth instance keeps the helpers
|
|
23
|
+
* typed without adding the plugin to your production auth config.
|
|
24
|
+
*
|
|
16
25
|
* @example
|
|
17
26
|
* ```ts
|
|
18
27
|
* import { betterAuth } from "better-auth";
|
|
19
28
|
* import { testUtils } from "better-auth/plugins";
|
|
20
29
|
*
|
|
21
|
-
* export const
|
|
30
|
+
* export const testAuth = betterAuth({
|
|
22
31
|
* plugins: [
|
|
23
32
|
* testUtils({ captureOTP: true }),
|
|
24
33
|
* ],
|
|
25
34
|
* });
|
|
26
35
|
*
|
|
27
36
|
* // In tests, access helpers via context:
|
|
28
|
-
* const ctx = await
|
|
37
|
+
* const ctx = await testAuth.$context;
|
|
29
38
|
* const test = ctx.test;
|
|
30
39
|
*
|
|
31
40
|
* const user = test.createUser({ email: "test@example.com" });
|
|
@@ -189,13 +189,12 @@ const twoFactor = (options) => {
|
|
|
189
189
|
options,
|
|
190
190
|
hooks: { after: [{
|
|
191
191
|
matcher(context) {
|
|
192
|
-
return context.context.
|
|
192
|
+
return context.path === "/sign-in/email" || context.path === "/sign-in/username" || context.path === "/sign-in/phone-number";
|
|
193
193
|
},
|
|
194
194
|
handler: createAuthMiddleware(async (ctx) => {
|
|
195
195
|
const data = ctx.context.newSession;
|
|
196
196
|
if (!data) return;
|
|
197
197
|
if (!data?.user.twoFactorEnabled) return;
|
|
198
|
-
if (ctx.context.session) return;
|
|
199
198
|
const trustDeviceCookieAttrs = ctx.context.createAuthCookie(TRUST_DEVICE_COOKIE_NAME, { maxAge: trustDeviceMaxAge });
|
|
200
199
|
const trustDeviceCookie = await ctx.getSignedCookie(trustDeviceCookieAttrs.name, ctx.context.secret);
|
|
201
200
|
if (trustDeviceCookie) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -489,13 +489,13 @@
|
|
|
489
489
|
"kysely": "^0.28.14",
|
|
490
490
|
"nanostores": "^1.1.1",
|
|
491
491
|
"zod": "^4.3.6",
|
|
492
|
-
"@better-auth/core": "1.6.
|
|
493
|
-
"@better-auth/drizzle-adapter": "1.6.
|
|
494
|
-
"@better-auth/kysely-adapter": "1.6.
|
|
495
|
-
"@better-auth/memory-adapter": "1.6.
|
|
496
|
-
"@better-auth/mongo-adapter": "1.6.
|
|
497
|
-
"@better-auth/prisma-adapter": "1.6.
|
|
498
|
-
"@better-auth/telemetry": "1.6.
|
|
492
|
+
"@better-auth/core": "1.6.5",
|
|
493
|
+
"@better-auth/drizzle-adapter": "1.6.5",
|
|
494
|
+
"@better-auth/kysely-adapter": "1.6.5",
|
|
495
|
+
"@better-auth/memory-adapter": "1.6.5",
|
|
496
|
+
"@better-auth/mongo-adapter": "1.6.5",
|
|
497
|
+
"@better-auth/prisma-adapter": "1.6.5",
|
|
498
|
+
"@better-auth/telemetry": "1.6.5"
|
|
499
499
|
},
|
|
500
500
|
"devDependencies": {
|
|
501
501
|
"@lynx-js/react": "^0.116.3",
|
|
@@ -512,7 +512,7 @@
|
|
|
512
512
|
"happy-dom": "^20.8.9",
|
|
513
513
|
"listhen": "^1.9.0",
|
|
514
514
|
"msw": "^2.12.10",
|
|
515
|
-
"next": "^16.2.
|
|
515
|
+
"next": "^16.2.3",
|
|
516
516
|
"oauth2-mock-server": "^8.2.2",
|
|
517
517
|
"react": "^19.2.4",
|
|
518
518
|
"react-dom": "^19.2.4",
|
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
"@tanstack/solid-start": "^1.0.0",
|
|
532
532
|
"better-sqlite3": "^12.0.0",
|
|
533
533
|
"drizzle-kit": ">=0.31.4",
|
|
534
|
-
"drizzle-orm": "
|
|
534
|
+
"drizzle-orm": "^0.45.2",
|
|
535
535
|
"mongodb": "^6.0.0 || ^7.0.0",
|
|
536
536
|
"mysql2": "^3.0.0",
|
|
537
537
|
"next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|