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
|
@@ -4,7 +4,7 @@ const server = require('@simplewebauthn/server');
|
|
|
4
4
|
const betterCall = require('better-call');
|
|
5
5
|
const random = require('../../shared/better-auth.CYeOI8C-.cjs');
|
|
6
6
|
const zod = require('zod');
|
|
7
|
-
const
|
|
7
|
+
const refreshToken = require('../../shared/better-auth.b0MLzqQX.cjs');
|
|
8
8
|
const cookies_index = require('../../cookies/index.cjs');
|
|
9
9
|
const schema$1 = require('../../shared/better-auth.C5H9XEzZ.cjs');
|
|
10
10
|
require('../../shared/better-auth.DiSjtgs9.cjs');
|
|
@@ -24,7 +24,7 @@ require('@noble/hashes/utils');
|
|
|
24
24
|
require('@better-auth/utils/random');
|
|
25
25
|
require('../../social-providers/index.cjs');
|
|
26
26
|
require('@better-fetch/fetch');
|
|
27
|
-
require('../../shared/better-auth.
|
|
27
|
+
require('../../shared/better-auth.BLV8UOn8.cjs');
|
|
28
28
|
require('../../shared/better-auth.C1hdVENX.cjs');
|
|
29
29
|
require('../../shared/better-auth.ANpbi45u.cjs');
|
|
30
30
|
require('../../shared/better-auth.QbbyHMYf.cjs');
|
|
@@ -64,11 +64,11 @@ const passkey = (options) => {
|
|
|
64
64
|
return {
|
|
65
65
|
id: "passkey",
|
|
66
66
|
endpoints: {
|
|
67
|
-
generatePasskeyRegistrationOptions:
|
|
67
|
+
generatePasskeyRegistrationOptions: refreshToken.createAuthEndpoint(
|
|
68
68
|
"/passkey/generate-register-options",
|
|
69
69
|
{
|
|
70
70
|
method: "GET",
|
|
71
|
-
use: [
|
|
71
|
+
use: [refreshToken.freshSessionMiddleware],
|
|
72
72
|
query: zod.z.object({
|
|
73
73
|
authenticatorAttachment: zod.z.enum(["platform", "cross-platform"]).optional()
|
|
74
74
|
}).optional(),
|
|
@@ -252,7 +252,7 @@ const passkey = (options) => {
|
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
),
|
|
255
|
-
generatePasskeyAuthenticationOptions:
|
|
255
|
+
generatePasskeyAuthenticationOptions: refreshToken.createAuthEndpoint(
|
|
256
256
|
"/passkey/generate-authenticate-options",
|
|
257
257
|
{
|
|
258
258
|
method: "POST",
|
|
@@ -353,7 +353,7 @@ const passkey = (options) => {
|
|
|
353
353
|
}
|
|
354
354
|
},
|
|
355
355
|
async (ctx) => {
|
|
356
|
-
const session = await
|
|
356
|
+
const session = await refreshToken.getSessionFromCtx(ctx);
|
|
357
357
|
let userPasskeys = [];
|
|
358
358
|
if (session) {
|
|
359
359
|
userPasskeys = await ctx.context.adapter.findMany({
|
|
@@ -407,7 +407,7 @@ const passkey = (options) => {
|
|
|
407
407
|
});
|
|
408
408
|
}
|
|
409
409
|
),
|
|
410
|
-
verifyPasskeyRegistration:
|
|
410
|
+
verifyPasskeyRegistration: refreshToken.createAuthEndpoint(
|
|
411
411
|
"/passkey/verify-registration",
|
|
412
412
|
{
|
|
413
413
|
method: "POST",
|
|
@@ -419,7 +419,7 @@ const passkey = (options) => {
|
|
|
419
419
|
description: "Name of the passkey"
|
|
420
420
|
}).optional()
|
|
421
421
|
}),
|
|
422
|
-
use: [
|
|
422
|
+
use: [refreshToken.freshSessionMiddleware],
|
|
423
423
|
metadata: {
|
|
424
424
|
openapi: {
|
|
425
425
|
description: "Verify registration of a new passkey",
|
|
@@ -528,7 +528,7 @@ const passkey = (options) => {
|
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
530
|
),
|
|
531
|
-
verifyPasskeyAuthentication:
|
|
531
|
+
verifyPasskeyAuthentication: refreshToken.createAuthEndpoint(
|
|
532
532
|
"/passkey/verify-authentication",
|
|
533
533
|
{
|
|
534
534
|
method: "POST",
|
|
@@ -679,11 +679,11 @@ const passkey = (options) => {
|
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
681
|
),
|
|
682
|
-
listPasskeys:
|
|
682
|
+
listPasskeys: refreshToken.createAuthEndpoint(
|
|
683
683
|
"/passkey/list-user-passkeys",
|
|
684
684
|
{
|
|
685
685
|
method: "GET",
|
|
686
|
-
use: [
|
|
686
|
+
use: [refreshToken.sessionMiddleware]
|
|
687
687
|
},
|
|
688
688
|
async (ctx) => {
|
|
689
689
|
const passkeys = await ctx.context.adapter.findMany({
|
|
@@ -695,14 +695,14 @@ const passkey = (options) => {
|
|
|
695
695
|
});
|
|
696
696
|
}
|
|
697
697
|
),
|
|
698
|
-
deletePasskey:
|
|
698
|
+
deletePasskey: refreshToken.createAuthEndpoint(
|
|
699
699
|
"/passkey/delete-passkey",
|
|
700
700
|
{
|
|
701
701
|
method: "POST",
|
|
702
702
|
body: zod.z.object({
|
|
703
703
|
id: zod.z.string()
|
|
704
704
|
}),
|
|
705
|
-
use: [
|
|
705
|
+
use: [refreshToken.sessionMiddleware]
|
|
706
706
|
},
|
|
707
707
|
async (ctx) => {
|
|
708
708
|
await ctx.context.adapter.delete({
|
|
@@ -719,7 +719,7 @@ const passkey = (options) => {
|
|
|
719
719
|
});
|
|
720
720
|
}
|
|
721
721
|
),
|
|
722
|
-
updatePasskey:
|
|
722
|
+
updatePasskey: refreshToken.createAuthEndpoint(
|
|
723
723
|
"/passkey/update-passkey",
|
|
724
724
|
{
|
|
725
725
|
method: "POST",
|
|
@@ -727,7 +727,7 @@ const passkey = (options) => {
|
|
|
727
727
|
id: zod.z.string(),
|
|
728
728
|
name: zod.z.string()
|
|
729
729
|
}),
|
|
730
|
-
use: [
|
|
730
|
+
use: [refreshToken.sessionMiddleware]
|
|
731
731
|
},
|
|
732
732
|
async (ctx) => {
|
|
733
733
|
const passkey2 = await ctx.context.adapter.findOne({
|
|
@@ -2,11 +2,11 @@ import * as _simplewebauthn_server from '@simplewebauthn/server';
|
|
|
2
2
|
import { CredentialDeviceType, PublicKeyCredentialCreationOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/server';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { I as InferOptionSchema } from '../../shared/better-auth.
|
|
5
|
+
import { I as InferOptionSchema } from '../../shared/better-auth.BDAwKjlL.cjs';
|
|
6
6
|
import '../../shared/better-auth.Bi8FQwDD.cjs';
|
|
7
|
-
import '
|
|
8
|
-
import '../../shared/better-auth.CzK7QJBv.cjs';
|
|
7
|
+
import '../../shared/better-auth.CH6fRG6d.cjs';
|
|
9
8
|
import 'jose';
|
|
9
|
+
import 'kysely';
|
|
10
10
|
import 'better-sqlite3';
|
|
11
11
|
|
|
12
12
|
interface PasskeyOptions {
|
|
@@ -2,11 +2,11 @@ import * as _simplewebauthn_server from '@simplewebauthn/server';
|
|
|
2
2
|
import { CredentialDeviceType, PublicKeyCredentialCreationOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/server';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { I as InferOptionSchema } from '../../shared/better-auth.
|
|
5
|
+
import { I as InferOptionSchema } from '../../shared/better-auth.CTQDLJN7.mjs';
|
|
6
6
|
import '../../shared/better-auth.Bi8FQwDD.mjs';
|
|
7
|
-
import '
|
|
8
|
-
import '../../shared/better-auth.BjoUuJNr.mjs';
|
|
7
|
+
import '../../shared/better-auth.BTnAiI8e.mjs';
|
|
9
8
|
import 'jose';
|
|
9
|
+
import 'kysely';
|
|
10
10
|
import 'better-sqlite3';
|
|
11
11
|
|
|
12
12
|
interface PasskeyOptions {
|
|
@@ -2,11 +2,11 @@ import * as _simplewebauthn_server from '@simplewebauthn/server';
|
|
|
2
2
|
import { CredentialDeviceType, PublicKeyCredentialCreationOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/server';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { I as InferOptionSchema } from '../../shared/better-auth.
|
|
5
|
+
import { I as InferOptionSchema } from '../../shared/better-auth.tpz8D0AA.js';
|
|
6
6
|
import '../../shared/better-auth.Bi8FQwDD.js';
|
|
7
|
-
import '
|
|
8
|
-
import '../../shared/better-auth.Dd96RDNl.js';
|
|
7
|
+
import '../../shared/better-auth.BAfIsot3.js';
|
|
9
8
|
import 'jose';
|
|
9
|
+
import 'kysely';
|
|
10
10
|
import 'better-sqlite3';
|
|
11
11
|
|
|
12
12
|
interface PasskeyOptions {
|
|
@@ -2,7 +2,7 @@ import { verifyAuthenticationResponse, verifyRegistrationResponse, generateAuthe
|
|
|
2
2
|
import { APIError } from 'better-call';
|
|
3
3
|
import { g as generateRandomString } from '../../shared/better-auth.B4Qoxdgc.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { a as createAuthEndpoint, s as sessionMiddleware, f as freshSessionMiddleware, g as getSessionFromCtx } from '../../shared/better-auth.
|
|
5
|
+
import { a as createAuthEndpoint, s as sessionMiddleware, f as freshSessionMiddleware, g as getSessionFromCtx } from '../../shared/better-auth.DQ-pFMwp.mjs';
|
|
6
6
|
import { setSessionCookie } from '../../cookies/index.mjs';
|
|
7
7
|
import { m as mergeSchema } from '../../shared/better-auth.CepcSj5H.mjs';
|
|
8
8
|
import '../../shared/better-auth.8zoxzg-F.mjs';
|
|
@@ -22,7 +22,7 @@ import '@noble/hashes/utils';
|
|
|
22
22
|
import '@better-auth/utils/random';
|
|
23
23
|
import '../../social-providers/index.mjs';
|
|
24
24
|
import '@better-fetch/fetch';
|
|
25
|
-
import '../../shared/better-auth.
|
|
25
|
+
import '../../shared/better-auth.B2THyVQH.mjs';
|
|
26
26
|
import '../../shared/better-auth.CW6D9eSx.mjs';
|
|
27
27
|
import '../../shared/better-auth.DdzSJf-n.mjs';
|
|
28
28
|
import '../../shared/better-auth.BdyOG_p4.mjs';
|
|
@@ -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 schema$1 = require('../../shared/better-auth.C5H9XEzZ.cjs');
|
|
7
7
|
const random = require('../../shared/better-auth.CYeOI8C-.cjs');
|
|
@@ -13,7 +13,7 @@ const date = require('../../shared/better-auth.C1hdVENX.cjs');
|
|
|
13
13
|
require('../../social-providers/index.cjs');
|
|
14
14
|
require('@better-fetch/fetch');
|
|
15
15
|
require('jose');
|
|
16
|
-
require('../../shared/better-auth.
|
|
16
|
+
require('../../shared/better-auth.BLV8UOn8.cjs');
|
|
17
17
|
require('@better-auth/utils/hash');
|
|
18
18
|
require('@better-auth/utils/base64');
|
|
19
19
|
require('@noble/ciphers/chacha');
|
|
@@ -59,7 +59,7 @@ const phoneNumber = (options) => {
|
|
|
59
59
|
return {
|
|
60
60
|
id: "phone-number",
|
|
61
61
|
endpoints: {
|
|
62
|
-
signInPhoneNumber:
|
|
62
|
+
signInPhoneNumber: refreshToken.createAuthEndpoint(
|
|
63
63
|
"/sign-in/phone-number",
|
|
64
64
|
{
|
|
65
65
|
method: "POST",
|
|
@@ -167,7 +167,7 @@ const phoneNumber = (options) => {
|
|
|
167
167
|
if (!session) {
|
|
168
168
|
ctx.context.logger.error("Failed to create session");
|
|
169
169
|
throw new betterCall.APIError("UNAUTHORIZED", {
|
|
170
|
-
message:
|
|
170
|
+
message: refreshToken.BASE_ERROR_CODES.FAILED_TO_CREATE_SESSION
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
await cookies_index.setSessionCookie(
|
|
@@ -194,7 +194,7 @@ const phoneNumber = (options) => {
|
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
),
|
|
197
|
-
sendPhoneNumberOTP:
|
|
197
|
+
sendPhoneNumberOTP: refreshToken.createAuthEndpoint(
|
|
198
198
|
"/phone-number/send-otp",
|
|
199
199
|
{
|
|
200
200
|
method: "POST",
|
|
@@ -260,7 +260,7 @@ const phoneNumber = (options) => {
|
|
|
260
260
|
return ctx.json({ message: "code sent" });
|
|
261
261
|
}
|
|
262
262
|
),
|
|
263
|
-
verifyPhoneNumber:
|
|
263
|
+
verifyPhoneNumber: refreshToken.createAuthEndpoint(
|
|
264
264
|
"/phone-number/verify",
|
|
265
265
|
{
|
|
266
266
|
method: "POST",
|
|
@@ -344,10 +344,10 @@ const phoneNumber = (options) => {
|
|
|
344
344
|
}
|
|
345
345
|
await ctx.context.internalAdapter.deleteVerificationValue(otp.id);
|
|
346
346
|
if (ctx.body.updatePhoneNumber) {
|
|
347
|
-
const session = await
|
|
347
|
+
const session = await refreshToken.getSessionFromCtx(ctx);
|
|
348
348
|
if (!session) {
|
|
349
349
|
throw new betterCall.APIError("UNAUTHORIZED", {
|
|
350
|
-
message:
|
|
350
|
+
message: refreshToken.BASE_ERROR_CODES.USER_NOT_FOUND
|
|
351
351
|
});
|
|
352
352
|
}
|
|
353
353
|
const existingUser = await ctx.context.adapter.findMany({
|
|
@@ -414,7 +414,7 @@ const phoneNumber = (options) => {
|
|
|
414
414
|
);
|
|
415
415
|
if (!user) {
|
|
416
416
|
throw new betterCall.APIError("INTERNAL_SERVER_ERROR", {
|
|
417
|
-
message:
|
|
417
|
+
message: refreshToken.BASE_ERROR_CODES.FAILED_TO_CREATE_USER
|
|
418
418
|
});
|
|
419
419
|
}
|
|
420
420
|
}
|
|
@@ -439,7 +439,7 @@ const phoneNumber = (options) => {
|
|
|
439
439
|
);
|
|
440
440
|
if (!user) {
|
|
441
441
|
throw new betterCall.APIError("INTERNAL_SERVER_ERROR", {
|
|
442
|
-
message:
|
|
442
|
+
message: refreshToken.BASE_ERROR_CODES.FAILED_TO_UPDATE_USER
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
if (!ctx.body.disableSession) {
|
|
@@ -449,7 +449,7 @@ const phoneNumber = (options) => {
|
|
|
449
449
|
);
|
|
450
450
|
if (!session) {
|
|
451
451
|
throw new betterCall.APIError("INTERNAL_SERVER_ERROR", {
|
|
452
|
-
message:
|
|
452
|
+
message: refreshToken.BASE_ERROR_CODES.FAILED_TO_CREATE_SESSION
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
455
|
await cookies_index.setSessionCookie(ctx, {
|
|
@@ -489,7 +489,7 @@ const phoneNumber = (options) => {
|
|
|
489
489
|
});
|
|
490
490
|
}
|
|
491
491
|
),
|
|
492
|
-
forgetPasswordPhoneNumber:
|
|
492
|
+
forgetPasswordPhoneNumber: refreshToken.createAuthEndpoint(
|
|
493
493
|
"/phone-number/forget-password",
|
|
494
494
|
{
|
|
495
495
|
method: "POST",
|
|
@@ -530,7 +530,7 @@ const phoneNumber = (options) => {
|
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
532
|
),
|
|
533
|
-
resetPasswordPhoneNumber:
|
|
533
|
+
resetPasswordPhoneNumber: refreshToken.createAuthEndpoint(
|
|
534
534
|
"/phone-number/reset-password",
|
|
535
535
|
{
|
|
536
536
|
method: "POST",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { U as User, I as InferOptionSchema } from '../../shared/better-auth.
|
|
3
|
+
import { U as User, I as InferOptionSchema } 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 UserWithPhoneNumber extends User {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { U as User, I as InferOptionSchema } from '../../shared/better-auth.
|
|
3
|
+
import { U as User, I as InferOptionSchema } 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 UserWithPhoneNumber extends User {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { U as User, I as InferOptionSchema } from '../../shared/better-auth.
|
|
3
|
+
import { U as User, I as InferOptionSchema } 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 UserWithPhoneNumber extends User {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { a as createAuthEndpoint, g as getSessionFromCtx, B as BASE_ERROR_CODES } from '../../shared/better-auth.
|
|
2
|
+
import { a as createAuthEndpoint, g as getSessionFromCtx, B as BASE_ERROR_CODES } from '../../shared/better-auth.DQ-pFMwp.mjs';
|
|
3
3
|
import { APIError } from 'better-call';
|
|
4
4
|
import { m as mergeSchema } from '../../shared/better-auth.CepcSj5H.mjs';
|
|
5
5
|
import { g as generateRandomString } from '../../shared/better-auth.B4Qoxdgc.mjs';
|
|
@@ -11,7 +11,7 @@ import { g as getDate } from '../../shared/better-auth.CW6D9eSx.mjs';
|
|
|
11
11
|
import '../../social-providers/index.mjs';
|
|
12
12
|
import '@better-fetch/fetch';
|
|
13
13
|
import 'jose';
|
|
14
|
-
import '../../shared/better-auth.
|
|
14
|
+
import '../../shared/better-auth.B2THyVQH.mjs';
|
|
15
15
|
import '@better-auth/utils/hash';
|
|
16
16
|
import '@better-auth/utils/base64';
|
|
17
17
|
import '@noble/ciphers/chacha';
|
|
@@ -2,17 +2,17 @@
|
|
|
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');
|
|
9
9
|
require('../../shared/better-auth.GpOOav9x.cjs');
|
|
10
10
|
require('defu');
|
|
11
|
-
const
|
|
11
|
+
const refreshAccessToken = require('../../shared/better-auth.BLV8UOn8.cjs');
|
|
12
|
+
const fetch = require('@better-fetch/fetch');
|
|
12
13
|
require('@better-auth/utils/hash');
|
|
13
14
|
require('@better-auth/utils/base64');
|
|
14
15
|
const state = require('../../shared/better-auth.QbbyHMYf.cjs');
|
|
15
|
-
const fetch = require('@better-fetch/fetch');
|
|
16
16
|
const jose = require('jose');
|
|
17
17
|
require('../../social-providers/index.cjs');
|
|
18
18
|
require('@noble/ciphers/chacha');
|
|
@@ -38,7 +38,7 @@ const sso = (options) => {
|
|
|
38
38
|
return {
|
|
39
39
|
id: "sso",
|
|
40
40
|
endpoints: {
|
|
41
|
-
createOIDCProvider:
|
|
41
|
+
createOIDCProvider: refreshToken.createAuthEndpoint(
|
|
42
42
|
"/sso/register",
|
|
43
43
|
{
|
|
44
44
|
method: "POST",
|
|
@@ -100,7 +100,7 @@ const sso = (options) => {
|
|
|
100
100
|
description: "If organization plugin is enabled, the organization id to link the provider to"
|
|
101
101
|
}).optional()
|
|
102
102
|
}),
|
|
103
|
-
use: [
|
|
103
|
+
use: [refreshToken.sessionMiddleware],
|
|
104
104
|
metadata: {
|
|
105
105
|
openapi: {
|
|
106
106
|
summary: "Register an OIDC provider",
|
|
@@ -152,7 +152,7 @@ const sso = (options) => {
|
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
),
|
|
155
|
-
signInSSO:
|
|
155
|
+
signInSSO: refreshToken.createAuthEndpoint(
|
|
156
156
|
"/sign-in/sso",
|
|
157
157
|
{
|
|
158
158
|
method: "POST",
|
|
@@ -278,7 +278,7 @@ const sso = (options) => {
|
|
|
278
278
|
}
|
|
279
279
|
const state$1 = await state.generateState(ctx);
|
|
280
280
|
const redirectURI = `${ctx.context.baseURL}/sso/callback/${provider.providerId}`;
|
|
281
|
-
const authorizationURL = await
|
|
281
|
+
const authorizationURL = await refreshAccessToken.createAuthorizationURL({
|
|
282
282
|
id: provider.issuer,
|
|
283
283
|
options: {
|
|
284
284
|
clientId: provider.oidcConfig.clientId,
|
|
@@ -301,7 +301,7 @@ const sso = (options) => {
|
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
303
|
),
|
|
304
|
-
callbackSSO:
|
|
304
|
+
callbackSSO: refreshToken.createAuthEndpoint(
|
|
305
305
|
"/sso/callback/:providerId",
|
|
306
306
|
{
|
|
307
307
|
method: "GET",
|
|
@@ -376,7 +376,7 @@ const sso = (options) => {
|
|
|
376
376
|
`${errorURL || callbackURL}/error?error=invalid_provider&error_description=token_endpoint_not_found`
|
|
377
377
|
);
|
|
378
378
|
}
|
|
379
|
-
const tokenResponse = await
|
|
379
|
+
const tokenResponse = await refreshAccessToken.validateAuthorizationCode({
|
|
380
380
|
code,
|
|
381
381
|
codeVerifier: provider.oidcConfig.pkce ? stateData.codeVerifier : void 0,
|
|
382
382
|
redirectURI: `${ctx.context.baseURL}/sso/callback/${provider.providerId}`,
|
|
@@ -407,7 +407,7 @@ const sso = (options) => {
|
|
|
407
407
|
`${errorURL || callbackURL}/error?error=invalid_provider&error_description=jwks_endpoint_not_found`
|
|
408
408
|
);
|
|
409
409
|
}
|
|
410
|
-
const verified = await
|
|
410
|
+
const verified = await refreshAccessToken.validateToken(
|
|
411
411
|
tokenResponse.idToken,
|
|
412
412
|
config.jwksEndpoint
|
|
413
413
|
).catch((e) => {
|
|
@@ -461,7 +461,7 @@ const sso = (options) => {
|
|
|
461
461
|
`${errorURL || callbackURL}/error?error=invalid_provider&error_description=missing_user_info`
|
|
462
462
|
);
|
|
463
463
|
}
|
|
464
|
-
const linked = await
|
|
464
|
+
const linked = await refreshToken.handleOAuthUserInfo(ctx, {
|
|
465
465
|
userInfo: {
|
|
466
466
|
email: userInfo.email,
|
|
467
467
|
name: userInfo.name || userInfo.email,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { O as OAuth2Tokens } from '../../shared/better-auth.
|
|
4
|
-
import { U as User } from '../../shared/better-auth.
|
|
3
|
+
import { O as OAuth2Tokens } from '../../shared/better-auth.CH6fRG6d.cjs';
|
|
4
|
+
import { U as User } from '../../shared/better-auth.BDAwKjlL.cjs';
|
|
5
5
|
import '../../shared/better-auth.Bi8FQwDD.cjs';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { O as OAuth2Tokens } from '../../shared/better-auth.
|
|
4
|
-
import { U as User } from '../../shared/better-auth.
|
|
3
|
+
import { O as OAuth2Tokens } from '../../shared/better-auth.BTnAiI8e.mjs';
|
|
4
|
+
import { U as User } from '../../shared/better-auth.CTQDLJN7.mjs';
|
|
5
5
|
import '../../shared/better-auth.Bi8FQwDD.mjs';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as better_call from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { O as OAuth2Tokens } from '../../shared/better-auth.
|
|
4
|
-
import { U as User } from '../../shared/better-auth.
|
|
3
|
+
import { O as OAuth2Tokens } from '../../shared/better-auth.BAfIsot3.js';
|
|
4
|
+
import { U as User } from '../../shared/better-auth.tpz8D0AA.js';
|
|
5
5
|
import '../../shared/better-auth.Bi8FQwDD.js';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'kysely';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { APIError } from 'better-call';
|
|
3
|
-
import { a as createAuthEndpoint, h as handleOAuthUserInfo, s as sessionMiddleware } from '../../shared/better-auth.
|
|
3
|
+
import { a as createAuthEndpoint, h as handleOAuthUserInfo, s as sessionMiddleware } from '../../shared/better-auth.DQ-pFMwp.mjs';
|
|
4
4
|
import { setSessionCookie } from '../../cookies/index.mjs';
|
|
5
5
|
import '../../shared/better-auth.CepcSj5H.mjs';
|
|
6
6
|
import '../../shared/better-auth.8zoxzg-F.mjs';
|
|
7
7
|
import '../../shared/better-auth.DH3YjMQH.mjs';
|
|
8
8
|
import 'defu';
|
|
9
|
-
import { v as validateAuthorizationCode, a as validateToken, c as createAuthorizationURL } from '../../shared/better-auth.
|
|
9
|
+
import { v as validateAuthorizationCode, a as validateToken, c as createAuthorizationURL } from '../../shared/better-auth.B2THyVQH.mjs';
|
|
10
|
+
import { betterFetch, BetterFetchError } from '@better-fetch/fetch';
|
|
10
11
|
import '@better-auth/utils/hash';
|
|
11
12
|
import '@better-auth/utils/base64';
|
|
12
13
|
import { p as parseState, g as generateState } from '../../shared/better-auth.BdyOG_p4.mjs';
|
|
13
|
-
import { betterFetch, BetterFetchError } from '@better-fetch/fetch';
|
|
14
14
|
import { decodeJwt } from 'jose';
|
|
15
15
|
import '../../social-providers/index.mjs';
|
|
16
16
|
import '@noble/ciphers/chacha';
|