better-auth 1.2.5-beta.9 → 1.2.6-beta.1
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/adapters/drizzle-adapter/index.d.cts +3 -3
- package/dist/adapters/drizzle-adapter/index.d.mts +3 -3
- package/dist/adapters/drizzle-adapter/index.d.ts +3 -3
- package/dist/adapters/kysely-adapter/index.d.cts +3 -3
- package/dist/adapters/kysely-adapter/index.d.mts +3 -3
- package/dist/adapters/kysely-adapter/index.d.ts +3 -3
- package/dist/adapters/memory-adapter/index.d.cts +3 -3
- package/dist/adapters/memory-adapter/index.d.mts +3 -3
- package/dist/adapters/memory-adapter/index.d.ts +3 -3
- package/dist/adapters/mongodb-adapter/index.d.cts +3 -3
- package/dist/adapters/mongodb-adapter/index.d.mts +3 -3
- package/dist/adapters/mongodb-adapter/index.d.ts +3 -3
- package/dist/adapters/prisma-adapter/index.d.cts +3 -3
- package/dist/adapters/prisma-adapter/index.d.mts +3 -3
- package/dist/adapters/prisma-adapter/index.d.ts +3 -3
- package/dist/adapters/test.d.cts +3 -3
- package/dist/adapters/test.d.mts +3 -3
- package/dist/adapters/test.d.ts +3 -3
- package/dist/api/index.cjs +77 -75
- package/dist/api/index.d.cts +4 -4
- package/dist/api/index.d.mts +4 -4
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.mjs +6 -5
- package/dist/client/index.d.cts +4 -4
- package/dist/client/index.d.mts +4 -4
- package/dist/client/index.d.ts +4 -4
- package/dist/client/plugins/index.d.cts +4 -4
- package/dist/client/plugins/index.d.mts +4 -4
- package/dist/client/plugins/index.d.ts +4 -4
- package/dist/client/react/index.d.cts +4 -4
- package/dist/client/react/index.d.mts +4 -4
- package/dist/client/react/index.d.ts +4 -4
- package/dist/client/solid/index.d.cts +4 -4
- package/dist/client/solid/index.d.mts +4 -4
- package/dist/client/solid/index.d.ts +4 -4
- package/dist/client/svelte/index.d.cts +4 -4
- package/dist/client/svelte/index.d.mts +4 -4
- package/dist/client/svelte/index.d.ts +4 -4
- package/dist/client/vue/index.d.cts +4 -4
- package/dist/client/vue/index.d.mts +4 -4
- package/dist/client/vue/index.d.ts +4 -4
- package/dist/cookies/index.d.cts +3 -3
- package/dist/cookies/index.d.mts +3 -3
- package/dist/cookies/index.d.ts +3 -3
- package/dist/db/index.cjs +1 -1
- package/dist/db/index.d.cts +4 -4
- package/dist/db/index.d.mts +4 -4
- package/dist/db/index.d.ts +4 -4
- package/dist/db/index.mjs +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/integrations/next-js.cjs +5 -5
- package/dist/integrations/next-js.d.cts +3 -3
- package/dist/integrations/next-js.d.mts +3 -3
- package/dist/integrations/next-js.d.ts +3 -3
- package/dist/integrations/next-js.mjs +4 -4
- package/dist/integrations/node.d.cts +3 -3
- package/dist/integrations/node.d.mts +3 -3
- package/dist/integrations/node.d.ts +3 -3
- package/dist/integrations/svelte-kit.d.cts +3 -3
- package/dist/integrations/svelte-kit.d.mts +3 -3
- package/dist/integrations/svelte-kit.d.ts +3 -3
- package/dist/oauth2/index.cjs +7 -6
- package/dist/oauth2/index.d.cts +14 -5
- package/dist/oauth2/index.d.mts +14 -5
- package/dist/oauth2/index.d.ts +14 -5
- package/dist/oauth2/index.mjs +1 -1
- package/dist/plugins/admin/index.cjs +3 -3
- package/dist/plugins/admin/index.d.cts +3 -3
- package/dist/plugins/admin/index.d.mts +3 -3
- package/dist/plugins/admin/index.d.ts +3 -3
- package/dist/plugins/admin/index.mjs +3 -3
- package/dist/plugins/anonymous/index.cjs +5 -5
- package/dist/plugins/anonymous/index.d.cts +3 -3
- package/dist/plugins/anonymous/index.d.mts +3 -3
- package/dist/plugins/anonymous/index.d.ts +3 -3
- package/dist/plugins/anonymous/index.mjs +2 -2
- package/dist/plugins/bearer/index.cjs +4 -4
- package/dist/plugins/bearer/index.d.cts +3 -3
- package/dist/plugins/bearer/index.d.mts +3 -3
- package/dist/plugins/bearer/index.d.ts +3 -3
- package/dist/plugins/bearer/index.mjs +2 -2
- package/dist/plugins/custom-session/index.cjs +4 -4
- package/dist/plugins/custom-session/index.d.cts +3 -3
- package/dist/plugins/custom-session/index.d.mts +3 -3
- package/dist/plugins/custom-session/index.d.ts +3 -3
- package/dist/plugins/custom-session/index.mjs +2 -2
- package/dist/plugins/email-otp/index.cjs +10 -10
- package/dist/plugins/email-otp/index.d.cts +3 -3
- package/dist/plugins/email-otp/index.d.mts +3 -3
- package/dist/plugins/email-otp/index.d.ts +3 -3
- package/dist/plugins/email-otp/index.mjs +2 -2
- package/dist/plugins/generic-oauth/index.cjs +43 -19
- package/dist/plugins/generic-oauth/index.d.cts +4 -4
- package/dist/plugins/generic-oauth/index.d.mts +4 -4
- package/dist/plugins/generic-oauth/index.d.ts +4 -4
- package/dist/plugins/generic-oauth/index.mjs +29 -5
- package/dist/plugins/index.cjs +22 -22
- package/dist/plugins/index.d.cts +4 -4
- package/dist/plugins/index.d.mts +4 -4
- package/dist/plugins/index.d.ts +4 -4
- package/dist/plugins/index.mjs +6 -6
- package/dist/plugins/jwt/index.cjs +6 -6
- package/dist/plugins/jwt/index.d.cts +3 -3
- package/dist/plugins/jwt/index.d.mts +3 -3
- package/dist/plugins/jwt/index.d.ts +3 -3
- package/dist/plugins/jwt/index.mjs +2 -2
- package/dist/plugins/magic-link/index.cjs +6 -6
- package/dist/plugins/magic-link/index.mjs +2 -2
- package/dist/plugins/multi-session/index.cjs +9 -9
- package/dist/plugins/multi-session/index.d.cts +3 -3
- package/dist/plugins/multi-session/index.d.mts +3 -3
- package/dist/plugins/multi-session/index.d.ts +3 -3
- package/dist/plugins/multi-session/index.mjs +2 -2
- package/dist/plugins/oauth-proxy/index.cjs +6 -6
- package/dist/plugins/oauth-proxy/index.d.cts +3 -3
- package/dist/plugins/oauth-proxy/index.d.mts +3 -3
- package/dist/plugins/oauth-proxy/index.d.ts +3 -3
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/index.cjs +14 -14
- package/dist/plugins/oidc-provider/index.d.cts +3 -3
- package/dist/plugins/oidc-provider/index.d.mts +3 -3
- package/dist/plugins/oidc-provider/index.d.ts +3 -3
- package/dist/plugins/oidc-provider/index.mjs +2 -2
- package/dist/plugins/one-tap/index.cjs +3 -3
- package/dist/plugins/one-tap/index.mjs +2 -2
- package/dist/plugins/open-api/index.cjs +4 -4
- package/dist/plugins/open-api/index.d.cts +3 -3
- package/dist/plugins/open-api/index.d.mts +3 -3
- package/dist/plugins/open-api/index.d.ts +3 -3
- package/dist/plugins/open-api/index.mjs +2 -2
- package/dist/plugins/organization/index.cjs +3 -3
- package/dist/plugins/organization/index.d.cts +3 -3
- package/dist/plugins/organization/index.d.mts +3 -3
- package/dist/plugins/organization/index.d.ts +3 -3
- package/dist/plugins/organization/index.mjs +3 -3
- package/dist/plugins/passkey/index.cjs +15 -15
- package/dist/plugins/passkey/index.d.cts +3 -3
- package/dist/plugins/passkey/index.d.mts +3 -3
- package/dist/plugins/passkey/index.d.ts +3 -3
- package/dist/plugins/passkey/index.mjs +2 -2
- package/dist/plugins/phone-number/index.cjs +13 -13
- package/dist/plugins/phone-number/index.d.cts +3 -3
- package/dist/plugins/phone-number/index.d.mts +3 -3
- package/dist/plugins/phone-number/index.d.ts +3 -3
- package/dist/plugins/phone-number/index.mjs +2 -2
- package/dist/plugins/sso/index.cjs +11 -11
- package/dist/plugins/sso/index.d.cts +2 -2
- package/dist/plugins/sso/index.d.mts +2 -2
- package/dist/plugins/sso/index.d.ts +2 -2
- package/dist/plugins/sso/index.mjs +3 -3
- package/dist/plugins/two-factor/index.cjs +20 -20
- package/dist/plugins/two-factor/index.d.cts +3 -3
- package/dist/plugins/two-factor/index.d.mts +3 -3
- package/dist/plugins/two-factor/index.d.ts +3 -3
- package/dist/plugins/two-factor/index.mjs +3 -3
- package/dist/plugins/username/index.cjs +9 -9
- package/dist/plugins/username/index.d.cts +3 -3
- package/dist/plugins/username/index.d.mts +3 -3
- package/dist/plugins/username/index.d.ts +3 -3
- package/dist/plugins/username/index.mjs +2 -2
- package/dist/shared/{better-auth.oyDBIJLs.mjs → better-auth.2rfXmCNS.mjs} +1 -1
- package/dist/shared/{better-auth.KTt7CS7L.mjs → better-auth.9knM1kR4.mjs} +1 -1
- package/dist/shared/{better-auth.DiMBK1Ep.mjs → better-auth.B2THyVQH.mjs} +54 -1
- package/dist/shared/{better-auth.C8tekzhG.cjs → better-auth.B7irTavj.cjs} +35 -35
- package/dist/shared/{better-auth.Dd96RDNl.d.ts → better-auth.BAfIsot3.d.ts} +41 -2
- package/dist/shared/{better-auth.Dunt9jpN.d.cts → better-auth.BBG0jAhH.d.mts} +2 -2
- package/dist/shared/{better-auth.CxMUffeh.d.cts → better-auth.BDAwKjlL.d.cts} +567 -46
- package/dist/shared/{better-auth.CbBX7Xla.mjs → better-auth.BK4Kh5QZ.mjs} +19 -17
- package/dist/shared/{better-auth.DgXCgiHI.cjs → better-auth.BLV8UOn8.cjs} +54 -0
- package/dist/shared/{better-auth.BjoUuJNr.d.mts → better-auth.BTnAiI8e.d.mts} +41 -2
- package/dist/shared/{better-auth.CzK7QJBv.d.cts → better-auth.CH6fRG6d.d.cts} +41 -2
- package/dist/shared/{better-auth.dzwyqpra.d.mts → better-auth.CTQDLJN7.d.mts} +567 -46
- package/dist/shared/{better-auth.CEuqoYDM.d.mts → better-auth.CtSY9Kmu.d.cts} +2 -2
- package/dist/shared/{better-auth.Cz2saE_0.d.cts → better-auth.DAnkIG1r.d.cts} +1 -1
- package/dist/shared/{better-auth.4ZqMps6Z.d.ts → better-auth.DCxEy-As.d.ts} +1 -1
- package/dist/shared/{better-auth.D7hUw1_Y.d.ts → better-auth.DIOWNBS2.d.ts} +1 -1
- package/dist/shared/{better-auth.ybwxmbrM.mjs → better-auth.DQ-pFMwp.mjs} +118 -5
- package/dist/shared/{better-auth.BxC2ipUB.d.mts → better-auth.DZPJQ81N.d.mts} +1 -1
- package/dist/shared/{better-auth.CL_N_Cfq.cjs → better-auth.DqGx7Ip8.cjs} +20 -20
- package/dist/shared/{better-auth.wspQErD2.cjs → better-auth.TNTVT6jt.cjs} +3 -3
- package/dist/shared/{better-auth.4J4_zAGP.cjs → better-auth.b0MLzqQX.cjs} +118 -4
- package/dist/shared/{better-auth.CdPDif0r.mjs → better-auth.cN4sTcuQ.mjs} +1 -1
- package/dist/shared/{better-auth.X0ynzeu1.cjs → better-auth.q7ChvjiM.cjs} +19 -17
- package/dist/shared/{better-auth.CixnJ90x.d.ts → better-auth.tpz8D0AA.d.ts} +567 -46
- package/dist/social-providers/index.cjs +197 -32
- package/dist/social-providers/index.d.cts +1 -1
- package/dist/social-providers/index.d.mts +1 -1
- package/dist/social-providers/index.d.ts +1 -1
- package/dist/social-providers/index.mjs +166 -1
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.d.ts +4 -4
- package/package.json +3 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { betterFetch } from '@better-fetch/fetch';
|
|
2
2
|
import { APIError } from 'better-call';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { a as createAuthEndpoint, s as sessionMiddleware, B as BASE_ERROR_CODES, h as handleOAuthUserInfo } from '../../shared/better-auth.
|
|
4
|
+
import { a as createAuthEndpoint, s as sessionMiddleware, B as BASE_ERROR_CODES, h as handleOAuthUserInfo } from '../../shared/better-auth.DQ-pFMwp.mjs';
|
|
5
5
|
import { setSessionCookie } from '../../cookies/index.mjs';
|
|
6
6
|
import '../../shared/better-auth.CepcSj5H.mjs';
|
|
7
7
|
import '../../shared/better-auth.8zoxzg-F.mjs';
|
|
8
8
|
import '../../shared/better-auth.DH3YjMQH.mjs';
|
|
9
9
|
import 'defu';
|
|
10
|
-
import { c as createAuthorizationURL, v as validateAuthorizationCode } from '../../shared/better-auth.
|
|
10
|
+
import { c as createAuthorizationURL, v as validateAuthorizationCode, r as refreshAccessToken } from '../../shared/better-auth.B2THyVQH.mjs';
|
|
11
11
|
import '@better-auth/utils/hash';
|
|
12
12
|
import '@better-auth/utils/base64';
|
|
13
13
|
import { g as generateState, p as parseState } from '../../shared/better-auth.BdyOG_p4.mjs';
|
|
@@ -116,8 +116,31 @@ const genericOAuth = (options) => {
|
|
|
116
116
|
clientSecret: c.clientSecret,
|
|
117
117
|
redirectURI: c.redirectURI
|
|
118
118
|
},
|
|
119
|
-
tokenEndpoint: finalTokenUrl
|
|
120
|
-
|
|
119
|
+
tokenEndpoint: finalTokenUrl
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
async refreshAccessToken(refreshToken) {
|
|
123
|
+
let finalTokenUrl = c.tokenUrl;
|
|
124
|
+
if (c.discoveryUrl) {
|
|
125
|
+
const discovery = await betterFetch(c.discoveryUrl, {
|
|
126
|
+
method: "GET"
|
|
127
|
+
});
|
|
128
|
+
if (discovery.data) {
|
|
129
|
+
finalTokenUrl = discovery.data.token_endpoint;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (!finalTokenUrl) {
|
|
133
|
+
throw new APIError("BAD_REQUEST", {
|
|
134
|
+
message: "Invalid OAuth configuration. Token URL not found."
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return refreshAccessToken({
|
|
138
|
+
refreshToken,
|
|
139
|
+
options: {
|
|
140
|
+
clientId: c.clientId,
|
|
141
|
+
clientSecret: c.clientSecret
|
|
142
|
+
},
|
|
143
|
+
tokenEndpoint: finalTokenUrl
|
|
121
144
|
});
|
|
122
145
|
},
|
|
123
146
|
async getUserInfo(tokens) {
|
|
@@ -225,7 +248,8 @@ const genericOAuth = (options) => {
|
|
|
225
248
|
prompt,
|
|
226
249
|
accessType,
|
|
227
250
|
authorizationUrlParams,
|
|
228
|
-
responseMode
|
|
251
|
+
responseMode,
|
|
252
|
+
authentication
|
|
229
253
|
} = config;
|
|
230
254
|
let finalAuthUrl = authorizationUrl;
|
|
231
255
|
let finalTokenUrl = tokenUrl;
|
package/dist/plugins/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const organization = require('../shared/better-auth.
|
|
3
|
+
const organization = require('../shared/better-auth.B7irTavj.cjs');
|
|
4
4
|
const plugins_twoFactor_index = require('./two-factor/index.cjs');
|
|
5
5
|
const plugins_username_index = require('./username/index.cjs');
|
|
6
6
|
const plugins_bearer_index = require('./bearer/index.cjs');
|
|
7
|
-
const
|
|
7
|
+
const refreshToken = require('../shared/better-auth.b0MLzqQX.cjs');
|
|
8
8
|
const plugins_magicLink_index = require('./magic-link/index.cjs');
|
|
9
9
|
const plugins_phoneNumber_index = require('./phone-number/index.cjs');
|
|
10
10
|
const plugins_anonymous_index = require('./anonymous/index.cjs');
|
|
11
|
-
const admin = require('../shared/better-auth.
|
|
11
|
+
const admin = require('../shared/better-auth.DqGx7Ip8.cjs');
|
|
12
12
|
const plugins_genericOauth_index = require('./generic-oauth/index.cjs');
|
|
13
13
|
const plugins_jwt_index = require('./jwt/index.cjs');
|
|
14
14
|
const plugins_multiSession_index = require('./multi-session/index.cjs');
|
|
@@ -53,13 +53,13 @@ require('../shared/better-auth.C-R0J0n1.cjs');
|
|
|
53
53
|
require('../crypto/index.cjs');
|
|
54
54
|
require('../shared/better-auth.YUF6P-PB.cjs');
|
|
55
55
|
require('../shared/better-auth.BMYo0QR-.cjs');
|
|
56
|
-
require('../shared/better-auth.
|
|
56
|
+
require('../shared/better-auth.TNTVT6jt.cjs');
|
|
57
57
|
require('../shared/better-auth.C1-vpKly.cjs');
|
|
58
58
|
require('@better-auth/utils/otp');
|
|
59
59
|
require('../shared/better-auth.CDXNofOe.cjs');
|
|
60
60
|
require('../social-providers/index.cjs');
|
|
61
61
|
require('@better-fetch/fetch');
|
|
62
|
-
require('../shared/better-auth.
|
|
62
|
+
require('../shared/better-auth.BLV8UOn8.cjs');
|
|
63
63
|
require('../shared/better-auth.QbbyHMYf.cjs');
|
|
64
64
|
require('jose/errors');
|
|
65
65
|
require('@better-auth/utils/binary');
|
|
@@ -266,7 +266,7 @@ function createApiKey({
|
|
|
266
266
|
schema,
|
|
267
267
|
deleteAllExpiredApiKeys
|
|
268
268
|
}) {
|
|
269
|
-
return
|
|
269
|
+
return refreshToken.createAuthEndpoint(
|
|
270
270
|
"/api-key/create",
|
|
271
271
|
{
|
|
272
272
|
method: "POST",
|
|
@@ -317,7 +317,7 @@ function createApiKey({
|
|
|
317
317
|
rateLimitTimeWindow,
|
|
318
318
|
rateLimitEnabled
|
|
319
319
|
} = ctx.body;
|
|
320
|
-
const session = await
|
|
320
|
+
const session = await refreshToken.getSessionFromCtx(ctx);
|
|
321
321
|
const authRequired = (ctx.request || ctx.headers) && !ctx.body.userId;
|
|
322
322
|
const user = session?.user ?? (authRequired ? null : { id: ctx.body.userId });
|
|
323
323
|
if (!user?.id) {
|
|
@@ -458,7 +458,7 @@ function deleteApiKey({
|
|
|
458
458
|
schema,
|
|
459
459
|
deleteAllExpiredApiKeys
|
|
460
460
|
}) {
|
|
461
|
-
return
|
|
461
|
+
return refreshToken.createAuthEndpoint(
|
|
462
462
|
"/api-key/delete",
|
|
463
463
|
{
|
|
464
464
|
method: "POST",
|
|
@@ -467,7 +467,7 @@ function deleteApiKey({
|
|
|
467
467
|
description: "The id of the Api Key"
|
|
468
468
|
})
|
|
469
469
|
}),
|
|
470
|
-
use: [
|
|
470
|
+
use: [refreshToken.sessionMiddleware]
|
|
471
471
|
},
|
|
472
472
|
async (ctx) => {
|
|
473
473
|
const { keyId } = ctx.body;
|
|
@@ -519,7 +519,7 @@ function getApiKey({
|
|
|
519
519
|
schema,
|
|
520
520
|
deleteAllExpiredApiKeys
|
|
521
521
|
}) {
|
|
522
|
-
return
|
|
522
|
+
return refreshToken.createAuthEndpoint(
|
|
523
523
|
"/api-key/get",
|
|
524
524
|
{
|
|
525
525
|
method: "GET",
|
|
@@ -528,7 +528,7 @@ function getApiKey({
|
|
|
528
528
|
description: "The id of the Api Key"
|
|
529
529
|
})
|
|
530
530
|
}),
|
|
531
|
-
use: [
|
|
531
|
+
use: [refreshToken.sessionMiddleware]
|
|
532
532
|
},
|
|
533
533
|
async (ctx) => {
|
|
534
534
|
const { id } = ctx.query;
|
|
@@ -566,7 +566,7 @@ function updateApiKey({
|
|
|
566
566
|
schema,
|
|
567
567
|
deleteAllExpiredApiKeys
|
|
568
568
|
}) {
|
|
569
|
-
return
|
|
569
|
+
return refreshToken.createAuthEndpoint(
|
|
570
570
|
"/api-key/update",
|
|
571
571
|
{
|
|
572
572
|
method: "POST",
|
|
@@ -623,7 +623,7 @@ function updateApiKey({
|
|
|
623
623
|
rateLimitTimeWindow,
|
|
624
624
|
rateLimitMax
|
|
625
625
|
} = ctx.body;
|
|
626
|
-
const session = await
|
|
626
|
+
const session = await refreshToken.getSessionFromCtx(ctx);
|
|
627
627
|
const authRequired = (ctx.request || ctx.headers) && !ctx.body.userId;
|
|
628
628
|
const user = session?.user ?? (authRequired ? null : { id: ctx.body.userId });
|
|
629
629
|
if (!user?.id) {
|
|
@@ -837,7 +837,7 @@ function verifyApiKey({
|
|
|
837
837
|
schema,
|
|
838
838
|
deleteAllExpiredApiKeys
|
|
839
839
|
}) {
|
|
840
|
-
return
|
|
840
|
+
return refreshToken.createAuthEndpoint(
|
|
841
841
|
"/api-key/verify",
|
|
842
842
|
{
|
|
843
843
|
method: "POST",
|
|
@@ -1065,11 +1065,11 @@ function listApiKeys({
|
|
|
1065
1065
|
schema,
|
|
1066
1066
|
deleteAllExpiredApiKeys
|
|
1067
1067
|
}) {
|
|
1068
|
-
return
|
|
1068
|
+
return refreshToken.createAuthEndpoint(
|
|
1069
1069
|
"/api-key/list",
|
|
1070
1070
|
{
|
|
1071
1071
|
method: "GET",
|
|
1072
|
-
use: [
|
|
1072
|
+
use: [refreshToken.sessionMiddleware]
|
|
1073
1073
|
},
|
|
1074
1074
|
async (ctx) => {
|
|
1075
1075
|
const session = ctx.context.session;
|
|
@@ -1103,7 +1103,7 @@ function listApiKeys({
|
|
|
1103
1103
|
function deleteAllExpiredApiKeysEndpoint({
|
|
1104
1104
|
deleteAllExpiredApiKeys
|
|
1105
1105
|
}) {
|
|
1106
|
-
return
|
|
1106
|
+
return refreshToken.createAuthEndpoint(
|
|
1107
1107
|
"/api-key/delete-all-expired-api-keys",
|
|
1108
1108
|
{
|
|
1109
1109
|
method: "POST",
|
|
@@ -1265,7 +1265,7 @@ const apiKey = (options) => {
|
|
|
1265
1265
|
before: [
|
|
1266
1266
|
{
|
|
1267
1267
|
matcher: (ctx) => !!getter(ctx) && opts.disableSessionForAPIKeys === false,
|
|
1268
|
-
handler:
|
|
1268
|
+
handler: refreshToken.createAuthMiddleware(async (ctx) => {
|
|
1269
1269
|
const key = getter(ctx);
|
|
1270
1270
|
if (typeof key !== "string") {
|
|
1271
1271
|
throw new betterCall.APIError("BAD_REQUEST", {
|
|
@@ -1362,10 +1362,10 @@ exports.parseRoles = organization.parseRoles;
|
|
|
1362
1362
|
exports.twoFactor = plugins_twoFactor_index.twoFactor;
|
|
1363
1363
|
exports.username = plugins_username_index.username;
|
|
1364
1364
|
exports.bearer = plugins_bearer_index.bearer;
|
|
1365
|
-
exports.HIDE_METADATA =
|
|
1366
|
-
exports.createAuthEndpoint =
|
|
1367
|
-
exports.createAuthMiddleware =
|
|
1368
|
-
exports.optionsMiddleware =
|
|
1365
|
+
exports.HIDE_METADATA = refreshToken.HIDE_METADATA;
|
|
1366
|
+
exports.createAuthEndpoint = refreshToken.createAuthEndpoint;
|
|
1367
|
+
exports.createAuthMiddleware = refreshToken.createAuthMiddleware;
|
|
1368
|
+
exports.optionsMiddleware = refreshToken.optionsMiddleware;
|
|
1369
1369
|
exports.magicLink = plugins_magicLink_index.magicLink;
|
|
1370
1370
|
exports.phoneNumber = plugins_phoneNumber_index.phoneNumber;
|
|
1371
1371
|
exports.anonymous = plugins_anonymous_index.anonymous;
|
package/dist/plugins/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ export { adminAc, defaultAc, defaultRoles, defaultStatements, memberAc, ownerAc
|
|
|
3
3
|
export { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, twoFactor, twoFactorClient } from './two-factor/index.cjs';
|
|
4
4
|
export { UsernameOptions, username } from './username/index.cjs';
|
|
5
5
|
export { bearer } from './bearer/index.cjs';
|
|
6
|
-
export { d as AuthEndpoint, e as AuthMiddleware, A as AuthPluginSchema, B as BetterAuthPlugin, I as InferOptionSchema, a as InferPluginErrorCodes, b as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from '../shared/better-auth.
|
|
6
|
+
export { d as AuthEndpoint, e as AuthMiddleware, A as AuthPluginSchema, B as BetterAuthPlugin, I as InferOptionSchema, a as InferPluginErrorCodes, b as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from '../shared/better-auth.BDAwKjlL.cjs';
|
|
7
7
|
export { H as HIDE_METADATA } from '../shared/better-auth.DEHJp1rk.cjs';
|
|
8
8
|
export { magicLink } from './magic-link/index.cjs';
|
|
9
9
|
export { PhoneNumberOptions, UserWithPhoneNumber, phoneNumber } from './phone-number/index.cjs';
|
|
@@ -19,13 +19,13 @@ export { customSession } from './custom-session/index.cjs';
|
|
|
19
19
|
export { OpenAPIOptions, Path, generator, openAPI } from './open-api/index.cjs';
|
|
20
20
|
export { AuthorizationQuery, Client, CodeVerificationValue, OAuthAccessToken, OIDCMetadata, OIDCOptions, TokenBody, oidcProvider } from './oidc-provider/index.cjs';
|
|
21
21
|
export { CaptchaOptions, captcha } from './captcha/index.cjs';
|
|
22
|
-
export { E as ERROR_CODES, a as apiKey } from '../shared/better-auth.
|
|
22
|
+
export { E as ERROR_CODES, a as apiKey } from '../shared/better-auth.CtSY9Kmu.cjs';
|
|
23
23
|
import './access/index.cjs';
|
|
24
24
|
import '../shared/better-auth.Bi8FQwDD.cjs';
|
|
25
25
|
import 'zod';
|
|
26
26
|
import 'better-call';
|
|
27
27
|
import '@better-fetch/fetch';
|
|
28
|
-
import '
|
|
29
|
-
import '../shared/better-auth.CzK7QJBv.cjs';
|
|
28
|
+
import '../shared/better-auth.CH6fRG6d.cjs';
|
|
30
29
|
import 'jose';
|
|
30
|
+
import 'kysely';
|
|
31
31
|
import 'better-sqlite3';
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ export { adminAc, defaultAc, defaultRoles, defaultStatements, memberAc, ownerAc
|
|
|
3
3
|
export { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, twoFactor, twoFactorClient } from './two-factor/index.mjs';
|
|
4
4
|
export { UsernameOptions, username } from './username/index.mjs';
|
|
5
5
|
export { bearer } from './bearer/index.mjs';
|
|
6
|
-
export { d as AuthEndpoint, e as AuthMiddleware, A as AuthPluginSchema, B as BetterAuthPlugin, I as InferOptionSchema, a as InferPluginErrorCodes, b as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from '../shared/better-auth.
|
|
6
|
+
export { d as AuthEndpoint, e as AuthMiddleware, A as AuthPluginSchema, B as BetterAuthPlugin, I as InferOptionSchema, a as InferPluginErrorCodes, b as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from '../shared/better-auth.CTQDLJN7.mjs';
|
|
7
7
|
export { H as HIDE_METADATA } from '../shared/better-auth.DEHJp1rk.mjs';
|
|
8
8
|
export { magicLink } from './magic-link/index.mjs';
|
|
9
9
|
export { PhoneNumberOptions, UserWithPhoneNumber, phoneNumber } from './phone-number/index.mjs';
|
|
@@ -19,13 +19,13 @@ export { customSession } from './custom-session/index.mjs';
|
|
|
19
19
|
export { OpenAPIOptions, Path, generator, openAPI } from './open-api/index.mjs';
|
|
20
20
|
export { AuthorizationQuery, Client, CodeVerificationValue, OAuthAccessToken, OIDCMetadata, OIDCOptions, TokenBody, oidcProvider } from './oidc-provider/index.mjs';
|
|
21
21
|
export { CaptchaOptions, captcha } from './captcha/index.mjs';
|
|
22
|
-
export { E as ERROR_CODES, a as apiKey } from '../shared/better-auth.
|
|
22
|
+
export { E as ERROR_CODES, a as apiKey } from '../shared/better-auth.BBG0jAhH.mjs';
|
|
23
23
|
import './access/index.mjs';
|
|
24
24
|
import '../shared/better-auth.Bi8FQwDD.mjs';
|
|
25
25
|
import 'zod';
|
|
26
26
|
import 'better-call';
|
|
27
27
|
import '@better-fetch/fetch';
|
|
28
|
-
import '
|
|
29
|
-
import '../shared/better-auth.BjoUuJNr.mjs';
|
|
28
|
+
import '../shared/better-auth.BTnAiI8e.mjs';
|
|
30
29
|
import 'jose';
|
|
30
|
+
import 'kysely';
|
|
31
31
|
import 'better-sqlite3';
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { adminAc, defaultAc, defaultRoles, defaultStatements, memberAc, ownerAc
|
|
|
3
3
|
export { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, twoFactor, twoFactorClient } from './two-factor/index.js';
|
|
4
4
|
export { UsernameOptions, username } from './username/index.js';
|
|
5
5
|
export { bearer } from './bearer/index.js';
|
|
6
|
-
export { d as AuthEndpoint, e as AuthMiddleware, A as AuthPluginSchema, B as BetterAuthPlugin, I as InferOptionSchema, a as InferPluginErrorCodes, b as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from '../shared/better-auth.
|
|
6
|
+
export { d as AuthEndpoint, e as AuthMiddleware, A as AuthPluginSchema, B as BetterAuthPlugin, I as InferOptionSchema, a as InferPluginErrorCodes, b as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from '../shared/better-auth.tpz8D0AA.js';
|
|
7
7
|
export { H as HIDE_METADATA } from '../shared/better-auth.DEHJp1rk.js';
|
|
8
8
|
export { magicLink } from './magic-link/index.js';
|
|
9
9
|
export { PhoneNumberOptions, UserWithPhoneNumber, phoneNumber } from './phone-number/index.js';
|
|
@@ -19,13 +19,13 @@ export { customSession } from './custom-session/index.js';
|
|
|
19
19
|
export { OpenAPIOptions, Path, generator, openAPI } from './open-api/index.js';
|
|
20
20
|
export { AuthorizationQuery, Client, CodeVerificationValue, OAuthAccessToken, OIDCMetadata, OIDCOptions, TokenBody, oidcProvider } from './oidc-provider/index.js';
|
|
21
21
|
export { CaptchaOptions, captcha } from './captcha/index.js';
|
|
22
|
-
export { E as ERROR_CODES, a as apiKey } from '../shared/better-auth.
|
|
22
|
+
export { E as ERROR_CODES, a as apiKey } from '../shared/better-auth.DCxEy-As.js';
|
|
23
23
|
import './access/index.js';
|
|
24
24
|
import '../shared/better-auth.Bi8FQwDD.js';
|
|
25
25
|
import 'zod';
|
|
26
26
|
import 'better-call';
|
|
27
27
|
import '@better-fetch/fetch';
|
|
28
|
-
import '
|
|
29
|
-
import '../shared/better-auth.Dd96RDNl.js';
|
|
28
|
+
import '../shared/better-auth.BAfIsot3.js';
|
|
30
29
|
import 'jose';
|
|
30
|
+
import 'kysely';
|
|
31
31
|
import 'better-sqlite3';
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { o as organization, p as parseRoles } from '../shared/better-auth.
|
|
1
|
+
export { o as organization, p as parseRoles } from '../shared/better-auth.9knM1kR4.mjs';
|
|
2
2
|
export { twoFactor } from './two-factor/index.mjs';
|
|
3
3
|
export { username } from './username/index.mjs';
|
|
4
4
|
export { bearer } from './bearer/index.mjs';
|
|
5
|
-
import { a as createAuthEndpoint, g as getSessionFromCtx, s as sessionMiddleware, c as createAuthMiddleware } from '../shared/better-auth.
|
|
6
|
-
export { H as HIDE_METADATA,
|
|
5
|
+
import { a as createAuthEndpoint, g as getSessionFromCtx, s as sessionMiddleware, c as createAuthMiddleware } from '../shared/better-auth.DQ-pFMwp.mjs';
|
|
6
|
+
export { H as HIDE_METADATA, O as optionsMiddleware } from '../shared/better-auth.DQ-pFMwp.mjs';
|
|
7
7
|
export { magicLink } from './magic-link/index.mjs';
|
|
8
8
|
export { phoneNumber } from './phone-number/index.mjs';
|
|
9
9
|
export { anonymous } from './anonymous/index.mjs';
|
|
10
|
-
export { a as admin } from '../shared/better-auth.
|
|
10
|
+
export { a as admin } from '../shared/better-auth.cN4sTcuQ.mjs';
|
|
11
11
|
export { genericOAuth } from './generic-oauth/index.mjs';
|
|
12
12
|
export { getJwtToken, jwt } from './jwt/index.mjs';
|
|
13
13
|
export { multiSession } from './multi-session/index.mjs';
|
|
@@ -52,13 +52,13 @@ import '../shared/better-auth.VTXNLFMT.mjs';
|
|
|
52
52
|
import '../crypto/index.mjs';
|
|
53
53
|
import '../shared/better-auth.OT3XFeFk.mjs';
|
|
54
54
|
import '../shared/better-auth.DDEbWX-S.mjs';
|
|
55
|
-
import '../shared/better-auth.
|
|
55
|
+
import '../shared/better-auth.2rfXmCNS.mjs';
|
|
56
56
|
import '../shared/better-auth.BcoSd9tC.mjs';
|
|
57
57
|
import '@better-auth/utils/otp';
|
|
58
58
|
import '../shared/better-auth.YwDQhoPc.mjs';
|
|
59
59
|
import '../social-providers/index.mjs';
|
|
60
60
|
import '@better-fetch/fetch';
|
|
61
|
-
import '../shared/better-auth.
|
|
61
|
+
import '../shared/better-auth.B2THyVQH.mjs';
|
|
62
62
|
import '../shared/better-auth.BdyOG_p4.mjs';
|
|
63
63
|
import 'jose/errors';
|
|
64
64
|
import '@better-auth/utils/binary';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const schema$1 = require('../../shared/better-auth.BG6vHVNT.cjs');
|
|
4
4
|
const jose = require('jose');
|
|
5
5
|
require('better-call');
|
|
6
|
-
const
|
|
6
|
+
const refreshToken = require('../../shared/better-auth.b0MLzqQX.cjs');
|
|
7
7
|
require('zod');
|
|
8
8
|
const index = require('../../shared/better-auth.ANpbi45u.cjs');
|
|
9
9
|
require('../../shared/better-auth.DiSjtgs9.cjs');
|
|
@@ -19,7 +19,7 @@ require('../../shared/better-auth.D3mtHEZg.cjs');
|
|
|
19
19
|
require('../../shared/better-auth.C-R0J0n1.cjs');
|
|
20
20
|
require('../../social-providers/index.cjs');
|
|
21
21
|
require('@better-fetch/fetch');
|
|
22
|
-
require('../../shared/better-auth.
|
|
22
|
+
require('../../shared/better-auth.BLV8UOn8.cjs');
|
|
23
23
|
require('@better-auth/utils/hash');
|
|
24
24
|
require('@noble/ciphers/chacha');
|
|
25
25
|
require('@noble/ciphers/utils');
|
|
@@ -121,7 +121,7 @@ const jwt = (options) => {
|
|
|
121
121
|
return {
|
|
122
122
|
id: "jwt",
|
|
123
123
|
endpoints: {
|
|
124
|
-
getJwks:
|
|
124
|
+
getJwks: refreshToken.createAuthEndpoint(
|
|
125
125
|
"/jwks",
|
|
126
126
|
{
|
|
127
127
|
method: "GET",
|
|
@@ -219,12 +219,12 @@ const jwt = (options) => {
|
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
),
|
|
222
|
-
getToken:
|
|
222
|
+
getToken: refreshToken.createAuthEndpoint(
|
|
223
223
|
"/token",
|
|
224
224
|
{
|
|
225
225
|
method: "GET",
|
|
226
226
|
requireHeaders: true,
|
|
227
|
-
use: [
|
|
227
|
+
use: [refreshToken.sessionMiddleware],
|
|
228
228
|
metadata: {
|
|
229
229
|
openapi: {
|
|
230
230
|
description: "Get a JWT token",
|
|
@@ -262,7 +262,7 @@ const jwt = (options) => {
|
|
|
262
262
|
matcher(context) {
|
|
263
263
|
return context.path === "/get-session";
|
|
264
264
|
},
|
|
265
|
-
handler:
|
|
265
|
+
handler: refreshToken.createAuthMiddleware(async (ctx) => {
|
|
266
266
|
const session = ctx.context.session || ctx.context.newSession;
|
|
267
267
|
if (session && session.session) {
|
|
268
268
|
const jwt2 = await getJwtToken(ctx, options);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
|
-
import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext, G as GenericEndpointContext } from '../../shared/better-auth.
|
|
2
|
+
import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext, G as GenericEndpointContext } from '../../shared/better-auth.BDAwKjlL.cjs';
|
|
3
3
|
import '../../shared/better-auth.Bi8FQwDD.cjs';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '
|
|
6
|
-
import '../../shared/better-auth.CzK7QJBv.cjs';
|
|
5
|
+
import '../../shared/better-auth.CH6fRG6d.cjs';
|
|
7
6
|
import 'jose';
|
|
7
|
+
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
10
10
|
declare const schema: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
|
-
import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext, G as GenericEndpointContext } from '../../shared/better-auth.
|
|
2
|
+
import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext, G as GenericEndpointContext } from '../../shared/better-auth.CTQDLJN7.mjs';
|
|
3
3
|
import '../../shared/better-auth.Bi8FQwDD.mjs';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '
|
|
6
|
-
import '../../shared/better-auth.BjoUuJNr.mjs';
|
|
5
|
+
import '../../shared/better-auth.BTnAiI8e.mjs';
|
|
7
6
|
import 'jose';
|
|
7
|
+
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
10
10
|
declare const schema: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
|
-
import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext, G as GenericEndpointContext } from '../../shared/better-auth.
|
|
2
|
+
import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext, G as GenericEndpointContext } from '../../shared/better-auth.tpz8D0AA.js';
|
|
3
3
|
import '../../shared/better-auth.Bi8FQwDD.js';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '
|
|
6
|
-
import '../../shared/better-auth.Dd96RDNl.js';
|
|
5
|
+
import '../../shared/better-auth.BAfIsot3.js';
|
|
7
6
|
import 'jose';
|
|
7
|
+
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
10
10
|
declare const schema: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as schema } from '../../shared/better-auth.fsvwNeUx.mjs';
|
|
2
2
|
import { generateKeyPair, exportJWK, importJWK, SignJWT } from 'jose';
|
|
3
3
|
import 'better-call';
|
|
4
|
-
import { c as createAuthMiddleware, a as createAuthEndpoint, s as sessionMiddleware } from '../../shared/better-auth.
|
|
4
|
+
import { c as createAuthMiddleware, a as createAuthEndpoint, s as sessionMiddleware } from '../../shared/better-auth.DQ-pFMwp.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import { B as BetterAuthError } from '../../shared/better-auth.DdzSJf-n.mjs';
|
|
7
7
|
import '../../shared/better-auth.8zoxzg-F.mjs';
|
|
@@ -17,7 +17,7 @@ import '../../shared/better-auth.tB5eU6EY.mjs';
|
|
|
17
17
|
import '../../shared/better-auth.VTXNLFMT.mjs';
|
|
18
18
|
import '../../social-providers/index.mjs';
|
|
19
19
|
import '@better-fetch/fetch';
|
|
20
|
-
import '../../shared/better-auth.
|
|
20
|
+
import '../../shared/better-auth.B2THyVQH.mjs';
|
|
21
21
|
import '@better-auth/utils/hash';
|
|
22
22
|
import '@noble/ciphers/chacha';
|
|
23
23
|
import '@noble/ciphers/utils';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zod = require('zod');
|
|
4
|
-
const
|
|
4
|
+
const refreshToken = require('../../shared/better-auth.b0MLzqQX.cjs');
|
|
5
5
|
const betterCall = require('better-call');
|
|
6
6
|
const cookies_index = require('../../cookies/index.cjs');
|
|
7
7
|
require('@better-auth/utils/hash');
|
|
@@ -21,7 +21,7 @@ require('../../shared/better-auth.GpOOav9x.cjs');
|
|
|
21
21
|
require('defu');
|
|
22
22
|
require('../../social-providers/index.cjs');
|
|
23
23
|
require('@better-fetch/fetch');
|
|
24
|
-
require('../../shared/better-auth.
|
|
24
|
+
require('../../shared/better-auth.BLV8UOn8.cjs');
|
|
25
25
|
require('../../shared/better-auth.C1hdVENX.cjs');
|
|
26
26
|
require('../../shared/better-auth.ANpbi45u.cjs');
|
|
27
27
|
require('@better-auth/utils/random');
|
|
@@ -38,7 +38,7 @@ const magicLink = (options) => {
|
|
|
38
38
|
return {
|
|
39
39
|
id: "magic-link",
|
|
40
40
|
endpoints: {
|
|
41
|
-
signInMagicLink:
|
|
41
|
+
signInMagicLink: refreshToken.createAuthEndpoint(
|
|
42
42
|
"/sign-in/magic-link",
|
|
43
43
|
{
|
|
44
44
|
method: "POST",
|
|
@@ -83,7 +83,7 @@ const magicLink = (options) => {
|
|
|
83
83
|
const user = await ctx.context.internalAdapter.findUserByEmail(email);
|
|
84
84
|
if (!user) {
|
|
85
85
|
throw new betterCall.APIError("BAD_REQUEST", {
|
|
86
|
-
message:
|
|
86
|
+
message: refreshToken.BASE_ERROR_CODES.USER_NOT_FOUND
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -109,7 +109,7 @@ const magicLink = (options) => {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
),
|
|
112
|
-
magicLinkVerify:
|
|
112
|
+
magicLinkVerify: refreshToken.createAuthEndpoint(
|
|
113
113
|
"/magic-link/verify",
|
|
114
114
|
{
|
|
115
115
|
method: "GET",
|
|
@@ -121,7 +121,7 @@ const magicLink = (options) => {
|
|
|
121
121
|
description: "URL to redirect after magic link verification, if not provided will return session"
|
|
122
122
|
}).optional()
|
|
123
123
|
}),
|
|
124
|
-
use: [
|
|
124
|
+
use: [refreshToken.originCheck((ctx) => ctx.query.callbackURL)],
|
|
125
125
|
requireHeaders: true,
|
|
126
126
|
metadata: {
|
|
127
127
|
openapi: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { a as createAuthEndpoint, o as originCheck, B as BASE_ERROR_CODES } from '../../shared/better-auth.
|
|
2
|
+
import { a as createAuthEndpoint, o as originCheck, B as BASE_ERROR_CODES } from '../../shared/better-auth.DQ-pFMwp.mjs';
|
|
3
3
|
import { APIError } from 'better-call';
|
|
4
4
|
import { setSessionCookie } from '../../cookies/index.mjs';
|
|
5
5
|
import '@better-auth/utils/hash';
|
|
@@ -19,7 +19,7 @@ import '../../shared/better-auth.DH3YjMQH.mjs';
|
|
|
19
19
|
import 'defu';
|
|
20
20
|
import '../../social-providers/index.mjs';
|
|
21
21
|
import '@better-fetch/fetch';
|
|
22
|
-
import '../../shared/better-auth.
|
|
22
|
+
import '../../shared/better-auth.B2THyVQH.mjs';
|
|
23
23
|
import '../../shared/better-auth.CW6D9eSx.mjs';
|
|
24
24
|
import '../../shared/better-auth.DdzSJf-n.mjs';
|
|
25
25
|
import '@better-auth/utils/random';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const zod = require('zod');
|
|
4
4
|
const betterCall = require('better-call');
|
|
5
|
-
const
|
|
5
|
+
const refreshToken = require('../../shared/better-auth.b0MLzqQX.cjs');
|
|
6
6
|
const cookies_index = require('../../cookies/index.cjs');
|
|
7
7
|
require('../../shared/better-auth.C5H9XEzZ.cjs');
|
|
8
8
|
require('../../shared/better-auth.DiSjtgs9.cjs');
|
|
@@ -11,7 +11,7 @@ require('defu');
|
|
|
11
11
|
require('../../social-providers/index.cjs');
|
|
12
12
|
require('@better-fetch/fetch');
|
|
13
13
|
require('jose');
|
|
14
|
-
require('../../shared/better-auth.
|
|
14
|
+
require('../../shared/better-auth.BLV8UOn8.cjs');
|
|
15
15
|
require('../../shared/better-auth.C1hdVENX.cjs');
|
|
16
16
|
require('@better-auth/utils/hash');
|
|
17
17
|
require('@better-auth/utils/base64');
|
|
@@ -46,7 +46,7 @@ const multiSession = (options) => {
|
|
|
46
46
|
return {
|
|
47
47
|
id: "multi-session",
|
|
48
48
|
endpoints: {
|
|
49
|
-
listDeviceSessions:
|
|
49
|
+
listDeviceSessions: refreshToken.createAuthEndpoint(
|
|
50
50
|
"/multi-session/list-device-sessions",
|
|
51
51
|
{
|
|
52
52
|
method: "GET",
|
|
@@ -78,7 +78,7 @@ const multiSession = (options) => {
|
|
|
78
78
|
return ctx.json(uniqueUserSessions);
|
|
79
79
|
}
|
|
80
80
|
),
|
|
81
|
-
setActiveSession:
|
|
81
|
+
setActiveSession: refreshToken.createAuthEndpoint(
|
|
82
82
|
"/multi-session/set-active",
|
|
83
83
|
{
|
|
84
84
|
method: "POST",
|
|
@@ -88,7 +88,7 @@ const multiSession = (options) => {
|
|
|
88
88
|
})
|
|
89
89
|
}),
|
|
90
90
|
requireHeaders: true,
|
|
91
|
-
use: [
|
|
91
|
+
use: [refreshToken.sessionMiddleware],
|
|
92
92
|
metadata: {
|
|
93
93
|
openapi: {
|
|
94
94
|
description: "Set the active session",
|
|
@@ -138,7 +138,7 @@ const multiSession = (options) => {
|
|
|
138
138
|
return ctx.json(session);
|
|
139
139
|
}
|
|
140
140
|
),
|
|
141
|
-
revokeDeviceSession:
|
|
141
|
+
revokeDeviceSession: refreshToken.createAuthEndpoint(
|
|
142
142
|
"/multi-session/revoke",
|
|
143
143
|
{
|
|
144
144
|
method: "POST",
|
|
@@ -148,7 +148,7 @@ const multiSession = (options) => {
|
|
|
148
148
|
})
|
|
149
149
|
}),
|
|
150
150
|
requireHeaders: true,
|
|
151
|
-
use: [
|
|
151
|
+
use: [refreshToken.sessionMiddleware],
|
|
152
152
|
metadata: {
|
|
153
153
|
openapi: {
|
|
154
154
|
description: "Revoke a device session",
|
|
@@ -227,7 +227,7 @@ const multiSession = (options) => {
|
|
|
227
227
|
after: [
|
|
228
228
|
{
|
|
229
229
|
matcher: () => true,
|
|
230
|
-
handler:
|
|
230
|
+
handler: refreshToken.createAuthMiddleware(async (ctx) => {
|
|
231
231
|
const cookieString = ctx.context.responseHeaders?.get("set-cookie");
|
|
232
232
|
if (!cookieString) return;
|
|
233
233
|
const setCookies = cookies_index.parseSetCookieHeader(cookieString);
|
|
@@ -253,7 +253,7 @@ const multiSession = (options) => {
|
|
|
253
253
|
},
|
|
254
254
|
{
|
|
255
255
|
matcher: (context) => context.path === "/sign-out",
|
|
256
|
-
handler:
|
|
256
|
+
handler: refreshToken.createAuthMiddleware(async (ctx) => {
|
|
257
257
|
const cookieHeader = ctx.headers?.get("cookie");
|
|
258
258
|
if (!cookieHeader) return;
|
|
259
259
|
const cookies = Object.fromEntries(cookies_index.parseCookies(cookieHeader));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { S as Session, U as User, H as HookEndpointContext } from '../../shared/better-auth.
|
|
3
|
+
import { S as Session, U as User, H as HookEndpointContext } from '../../shared/better-auth.BDAwKjlL.cjs';
|
|
4
4
|
import '../../shared/better-auth.Bi8FQwDD.cjs';
|
|
5
|
-
import '
|
|
6
|
-
import '../../shared/better-auth.CzK7QJBv.cjs';
|
|
5
|
+
import '../../shared/better-auth.CH6fRG6d.cjs';
|
|
7
6
|
import 'jose';
|
|
7
|
+
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
10
10
|
interface MultiSessionConfig {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { S as Session, U as User, H as HookEndpointContext } from '../../shared/better-auth.
|
|
3
|
+
import { S as Session, U as User, H as HookEndpointContext } from '../../shared/better-auth.CTQDLJN7.mjs';
|
|
4
4
|
import '../../shared/better-auth.Bi8FQwDD.mjs';
|
|
5
|
-
import '
|
|
6
|
-
import '../../shared/better-auth.BjoUuJNr.mjs';
|
|
5
|
+
import '../../shared/better-auth.BTnAiI8e.mjs';
|
|
7
6
|
import 'jose';
|
|
7
|
+
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
10
10
|
interface MultiSessionConfig {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { S as Session, U as User, H as HookEndpointContext } from '../../shared/better-auth.
|
|
3
|
+
import { S as Session, U as User, H as HookEndpointContext } from '../../shared/better-auth.tpz8D0AA.js';
|
|
4
4
|
import '../../shared/better-auth.Bi8FQwDD.js';
|
|
5
|
-
import '
|
|
6
|
-
import '../../shared/better-auth.Dd96RDNl.js';
|
|
5
|
+
import '../../shared/better-auth.BAfIsot3.js';
|
|
7
6
|
import 'jose';
|
|
7
|
+
import 'kysely';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
10
10
|
interface MultiSessionConfig {
|