better-auth 0.2.9-beta.8 → 0.2.9
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.d.ts +1 -1
- package/dist/adapters/mongodb.d.ts +1 -1
- package/dist/adapters/prisma.d.ts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/cli.js +10 -20
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.ts +1 -1
- package/dist/{index-CzTRLQrX.d.ts → index-C3owlKu1.d.ts} +2 -9
- package/dist/{index-PjYlcsPD.d.ts → index-C9S3KShG.d.ts} +24 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/next-js.d.ts +1 -1
- package/dist/next-js.js +6 -2
- package/dist/node.d.ts +1 -1
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +53 -18
- package/dist/react.d.ts +1 -1
- package/dist/solid-start.d.ts +1 -1
- package/dist/solid.d.ts +1 -1
- package/dist/svelte-kit.d.ts +1 -1
- package/dist/svelte-kit.js +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/vue.d.ts +1 -1
- package/package.json +3 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { e as AuthEndpoint, f as AuthMiddleware, n as callbackOAuth, L as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, D as createEmailVerificationToken, V as csrfMiddleware, N as deleteUser, Q as error, y as forgetPassword, z as forgetPasswordCallback, O as getCSRFToken, l as getEndpoints, p as getSession, q as getSessionFromCtx, u as listSessions, T as ok, o as optionsMiddleware, C as resetPassword, v as revokeSession, w as revokeSessions, r as router, E as sendVerificationEmail, t as sessionMiddleware, M as setPassword, m as signInEmail, s as signInOAuth, x as signOut, U as signUpEmail, K as updateUser, J as verifyEmail } from './index-
|
|
1
|
+
export { e as AuthEndpoint, f as AuthMiddleware, n as callbackOAuth, L as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, D as createEmailVerificationToken, V as csrfMiddleware, N as deleteUser, Q as error, y as forgetPassword, z as forgetPasswordCallback, O as getCSRFToken, l as getEndpoints, p as getSession, q as getSessionFromCtx, u as listSessions, T as ok, o as optionsMiddleware, C as resetPassword, v as revokeSession, w as revokeSessions, r as router, E as sendVerificationEmail, t as sessionMiddleware, M as setPassword, m as signInEmail, s as signInOAuth, x as signOut, U as signUpEmail, K as updateUser, J as verifyEmail } from './index-C9S3KShG.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import './helper-DPDj8Nix.js';
|
|
4
4
|
import 'better-call';
|
package/dist/cli.js
CHANGED
|
@@ -200,7 +200,7 @@ import {
|
|
|
200
200
|
var createKyselyAdapter = async (config) => {
|
|
201
201
|
const db = config.database;
|
|
202
202
|
let dialect = void 0;
|
|
203
|
-
let databaseType =
|
|
203
|
+
let databaseType = "sqlite";
|
|
204
204
|
if ("createDriver" in db) {
|
|
205
205
|
dialect = db;
|
|
206
206
|
if (dialect instanceof SqliteDialect) {
|
|
@@ -239,9 +239,9 @@ var createKyselyAdapter = async (config) => {
|
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
// src/cli/commands/migrate.ts
|
|
242
|
-
import
|
|
242
|
+
import ora from "ora";
|
|
243
243
|
import chalk from "chalk";
|
|
244
|
-
import
|
|
244
|
+
import prompts from "prompts";
|
|
245
245
|
|
|
246
246
|
// src/cli/utils/get-migration.ts
|
|
247
247
|
import "kysely";
|
|
@@ -607,16 +607,6 @@ async function getMigrations(config) {
|
|
|
607
607
|
return { toBeCreated, toBeAdded, runMigrations, compileMigrations };
|
|
608
608
|
}
|
|
609
609
|
|
|
610
|
-
// src/cli/utils/install-dep.ts
|
|
611
|
-
import ora from "ora";
|
|
612
|
-
import prompts from "prompts";
|
|
613
|
-
|
|
614
|
-
// src/cli/utils/get-package-manager.ts
|
|
615
|
-
import { detect } from "@antfu/ni";
|
|
616
|
-
|
|
617
|
-
// src/cli/utils/install-dep.ts
|
|
618
|
-
import { execa } from "execa";
|
|
619
|
-
|
|
620
610
|
// src/cli/commands/migrate.ts
|
|
621
611
|
var migrate = new Command("migrate").option(
|
|
622
612
|
"-c, --cwd <cwd>",
|
|
@@ -653,7 +643,7 @@ var migrate = new Command("migrate").option(
|
|
|
653
643
|
logger.error("Invalid database configuration.");
|
|
654
644
|
process.exit(1);
|
|
655
645
|
}
|
|
656
|
-
const spinner =
|
|
646
|
+
const spinner = ora("preparing migration...").start();
|
|
657
647
|
const { toBeAdded, toBeCreated, runMigrations } = await getMigrations(config);
|
|
658
648
|
if (!toBeAdded.length && !toBeCreated.length) {
|
|
659
649
|
spinner.stop();
|
|
@@ -671,7 +661,7 @@ var migrate = new Command("migrate").option(
|
|
|
671
661
|
chalk.white("table.")
|
|
672
662
|
);
|
|
673
663
|
}
|
|
674
|
-
const { migrate: migrate2 } = await
|
|
664
|
+
const { migrate: migrate2 } = await prompts({
|
|
675
665
|
type: "confirm",
|
|
676
666
|
name: "migrate",
|
|
677
667
|
message: "Are you sure you want to run these migrations?",
|
|
@@ -693,8 +683,8 @@ import { Command as Command2 } from "commander";
|
|
|
693
683
|
import { z as z2 } from "zod";
|
|
694
684
|
import { existsSync as existsSync3 } from "fs";
|
|
695
685
|
import path4 from "path";
|
|
696
|
-
import
|
|
697
|
-
import
|
|
686
|
+
import ora2 from "ora";
|
|
687
|
+
import prompts2 from "prompts";
|
|
698
688
|
|
|
699
689
|
// src/adapters/kysely-adapter/index.ts
|
|
700
690
|
function convertWhere(w) {
|
|
@@ -1025,7 +1015,7 @@ var generate = new Command2("generate").option(
|
|
|
1025
1015
|
);
|
|
1026
1016
|
return;
|
|
1027
1017
|
}
|
|
1028
|
-
const spinner =
|
|
1018
|
+
const spinner = ora2("preparing schema...").start();
|
|
1029
1019
|
const adapter = await getAdapter(config, true).catch((e) => {
|
|
1030
1020
|
logger.error(e.message);
|
|
1031
1021
|
process.exit(1);
|
|
@@ -1060,7 +1050,7 @@ var generate = new Command2("generate").option(
|
|
|
1060
1050
|
process.exit(0);
|
|
1061
1051
|
}
|
|
1062
1052
|
if (append || overwrite) {
|
|
1063
|
-
const { confirm: confirm2 } = await
|
|
1053
|
+
const { confirm: confirm2 } = await prompts2({
|
|
1064
1054
|
type: "confirm",
|
|
1065
1055
|
name: "confirm",
|
|
1066
1056
|
message: `The file ${fileName} already exists. Do you want to ${chalk2.yellow(
|
|
@@ -1086,7 +1076,7 @@ var generate = new Command2("generate").option(
|
|
|
1086
1076
|
process.exit(1);
|
|
1087
1077
|
}
|
|
1088
1078
|
}
|
|
1089
|
-
const { confirm } = await
|
|
1079
|
+
const { confirm } = await prompts2({
|
|
1090
1080
|
type: "confirm",
|
|
1091
1081
|
name: "confirm",
|
|
1092
1082
|
message: `Do you want to generate the schema to ${chalk2.yellow(
|
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { A as AccessControl, S as StatementsPrimitive, R as Role } from '../statement-CfnyN34h.js';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchOption } from '@better-fetch/fetch';
|
|
5
|
-
import { o as organization, e as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, e as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber } from '../index-C3owlKu1.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-C3owlKu1.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DPDj8Nix.js';
|
|
8
8
|
import '../index-JM-i6hLs.js';
|
|
9
9
|
import 'arctic';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'better-call';
|
|
12
|
-
import '../index-
|
|
12
|
+
import '../index-C9S3KShG.js';
|
|
13
13
|
import 'kysely';
|
|
14
14
|
import 'better-sqlite3';
|
|
15
15
|
import 'mysql2';
|
package/dist/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { BetterFetch, BetterFetchError, BetterFetchOption } from '@better-fetch/
|
|
|
6
6
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
7
7
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, InferSessionFromClient, InferUserFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
8
8
|
export { AtomListener, InferPluginsFromClient } from './types.js';
|
|
9
|
-
import './index-
|
|
9
|
+
import './index-C9S3KShG.js';
|
|
10
10
|
import 'kysely';
|
|
11
11
|
import './index-JM-i6hLs.js';
|
|
12
12
|
import 'arctic';
|
|
@@ -5,7 +5,7 @@ import { P as Prettify } from './helper-DPDj8Nix.js';
|
|
|
5
5
|
import { A as AccessControl, R as Role, S as StatementsPrimitive, g as defaultRoles } from './statement-CfnyN34h.js';
|
|
6
6
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
7
7
|
import { BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
|
|
8
|
-
import { H as HookEndpointContext } from './index-
|
|
8
|
+
import { H as HookEndpointContext } from './index-C9S3KShG.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
|
@@ -3680,13 +3680,6 @@ interface PasskeyOptions {
|
|
|
3680
3680
|
webAuthnChallengeCookie?: string;
|
|
3681
3681
|
};
|
|
3682
3682
|
}
|
|
3683
|
-
type WebAuthnCookieType = {
|
|
3684
|
-
expectedChallenge: string;
|
|
3685
|
-
userData: {
|
|
3686
|
-
id: string;
|
|
3687
|
-
};
|
|
3688
|
-
callbackURL?: string;
|
|
3689
|
-
};
|
|
3690
3683
|
type Passkey = {
|
|
3691
3684
|
id: string;
|
|
3692
3685
|
name?: string;
|
|
@@ -4636,4 +4629,4 @@ declare const phoneNumber: (options?: {
|
|
|
4636
4629
|
};
|
|
4637
4630
|
};
|
|
4638
4631
|
|
|
4639
|
-
export { type Invitation as I, type Member as M, type OrganizationOptions as O, type PasskeyOptions as P,
|
|
4632
|
+
export { type Invitation as I, type Member as M, type OrganizationOptions as O, type PasskeyOptions as P, twoFactorClient as a, type Passkey as b, passkeyClient as c, phoneNumber as d, type Organization as e, getPasskeyActions as g, magicLink as m, organization as o, passkey as p, twoFactor as t, username as u };
|
|
@@ -1243,17 +1243,17 @@ declare const signInOAuth: {
|
|
|
1243
1243
|
/**
|
|
1244
1244
|
* OAuth2 provider to use`
|
|
1245
1245
|
*/
|
|
1246
|
-
provider: z.ZodEnum<["github", ...("
|
|
1246
|
+
provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1247
1247
|
/**
|
|
1248
1248
|
* If this is true the session will only be valid for the current browser session
|
|
1249
1249
|
*/
|
|
1250
1250
|
dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
1251
1251
|
}, "strip", z.ZodTypeAny, {
|
|
1252
|
-
provider: "
|
|
1252
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
1253
1253
|
callbackURL?: string | undefined;
|
|
1254
1254
|
dontRememberMe?: boolean | undefined;
|
|
1255
1255
|
}, {
|
|
1256
|
-
provider: "
|
|
1256
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
1257
1257
|
callbackURL?: string | undefined;
|
|
1258
1258
|
dontRememberMe?: boolean | undefined;
|
|
1259
1259
|
}>;
|
|
@@ -1286,17 +1286,17 @@ declare const signInOAuth: {
|
|
|
1286
1286
|
/**
|
|
1287
1287
|
* OAuth2 provider to use`
|
|
1288
1288
|
*/
|
|
1289
|
-
provider: z.ZodEnum<["github", ...("
|
|
1289
|
+
provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1290
1290
|
/**
|
|
1291
1291
|
* If this is true the session will only be valid for the current browser session
|
|
1292
1292
|
*/
|
|
1293
1293
|
dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
1294
1294
|
}, "strip", z.ZodTypeAny, {
|
|
1295
|
-
provider: "
|
|
1295
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
1296
1296
|
callbackURL?: string | undefined;
|
|
1297
1297
|
dontRememberMe?: boolean | undefined;
|
|
1298
1298
|
}, {
|
|
1299
|
-
provider: "
|
|
1299
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
1300
1300
|
callbackURL?: string | undefined;
|
|
1301
1301
|
dontRememberMe?: boolean | undefined;
|
|
1302
1302
|
}>;
|
|
@@ -2445,14 +2445,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2445
2445
|
}>>;
|
|
2446
2446
|
body: zod.ZodObject<{
|
|
2447
2447
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2448
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2448
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2449
2449
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
2450
2450
|
}, "strip", zod.ZodTypeAny, {
|
|
2451
|
-
provider: "
|
|
2451
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
2452
2452
|
callbackURL?: string | undefined;
|
|
2453
2453
|
dontRememberMe?: boolean | undefined;
|
|
2454
2454
|
}, {
|
|
2455
|
-
provider: "
|
|
2455
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
2456
2456
|
callbackURL?: string | undefined;
|
|
2457
2457
|
dontRememberMe?: boolean | undefined;
|
|
2458
2458
|
}>;
|
|
@@ -2475,14 +2475,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2475
2475
|
}>>;
|
|
2476
2476
|
body: zod.ZodObject<{
|
|
2477
2477
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2478
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2478
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2479
2479
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
2480
2480
|
}, "strip", zod.ZodTypeAny, {
|
|
2481
|
-
provider: "
|
|
2481
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
2482
2482
|
callbackURL?: string | undefined;
|
|
2483
2483
|
dontRememberMe?: boolean | undefined;
|
|
2484
2484
|
}, {
|
|
2485
|
-
provider: "
|
|
2485
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
2486
2486
|
callbackURL?: string | undefined;
|
|
2487
2487
|
dontRememberMe?: boolean | undefined;
|
|
2488
2488
|
}>;
|
|
@@ -3507,14 +3507,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3507
3507
|
}>>;
|
|
3508
3508
|
body: zod.ZodObject<{
|
|
3509
3509
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3510
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3510
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3511
3511
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
3512
3512
|
}, "strip", zod.ZodTypeAny, {
|
|
3513
|
-
provider: "
|
|
3513
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
3514
3514
|
callbackURL?: string | undefined;
|
|
3515
3515
|
dontRememberMe?: boolean | undefined;
|
|
3516
3516
|
}, {
|
|
3517
|
-
provider: "
|
|
3517
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
3518
3518
|
callbackURL?: string | undefined;
|
|
3519
3519
|
dontRememberMe?: boolean | undefined;
|
|
3520
3520
|
}>;
|
|
@@ -3537,14 +3537,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3537
3537
|
}>>;
|
|
3538
3538
|
body: zod.ZodObject<{
|
|
3539
3539
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3540
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3540
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3541
3541
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
3542
3542
|
}, "strip", zod.ZodTypeAny, {
|
|
3543
|
-
provider: "
|
|
3543
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
3544
3544
|
callbackURL?: string | undefined;
|
|
3545
3545
|
dontRememberMe?: boolean | undefined;
|
|
3546
3546
|
}, {
|
|
3547
|
-
provider: "
|
|
3547
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
3548
3548
|
callbackURL?: string | undefined;
|
|
3549
3549
|
dontRememberMe?: boolean | undefined;
|
|
3550
3550
|
}>;
|
|
@@ -4571,14 +4571,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4571
4571
|
}>>;
|
|
4572
4572
|
body: zod.ZodObject<{
|
|
4573
4573
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4574
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4574
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4575
4575
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
4576
4576
|
}, "strip", zod.ZodTypeAny, {
|
|
4577
|
-
provider: "
|
|
4577
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
4578
4578
|
callbackURL?: string | undefined;
|
|
4579
4579
|
dontRememberMe?: boolean | undefined;
|
|
4580
4580
|
}, {
|
|
4581
|
-
provider: "
|
|
4581
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
4582
4582
|
callbackURL?: string | undefined;
|
|
4583
4583
|
dontRememberMe?: boolean | undefined;
|
|
4584
4584
|
}>;
|
|
@@ -4601,14 +4601,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4601
4601
|
}>>;
|
|
4602
4602
|
body: zod.ZodObject<{
|
|
4603
4603
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4604
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4604
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4605
4605
|
dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
4606
4606
|
}, "strip", zod.ZodTypeAny, {
|
|
4607
|
-
provider: "
|
|
4607
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
4608
4608
|
callbackURL?: string | undefined;
|
|
4609
4609
|
dontRememberMe?: boolean | undefined;
|
|
4610
4610
|
}, {
|
|
4611
|
-
provider: "
|
|
4611
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
|
|
4612
4612
|
callbackURL?: string | undefined;
|
|
4613
4613
|
dontRememberMe?: boolean | undefined;
|
|
4614
4614
|
}>;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2882,7 +2882,7 @@ import {
|
|
|
2882
2882
|
var createKyselyAdapter = async (config2) => {
|
|
2883
2883
|
const db = config2.database;
|
|
2884
2884
|
let dialect = void 0;
|
|
2885
|
-
let databaseType =
|
|
2885
|
+
let databaseType = "sqlite";
|
|
2886
2886
|
if ("createDriver" in db) {
|
|
2887
2887
|
dialect = db;
|
|
2888
2888
|
if (dialect instanceof SqliteDialect) {
|
package/dist/next-js.d.ts
CHANGED
package/dist/next-js.js
CHANGED
|
@@ -14,9 +14,13 @@ function authMiddleware(options) {
|
|
|
14
14
|
return async (request) => {
|
|
15
15
|
const url = new URL(request.url).origin;
|
|
16
16
|
const basePath = options?.basePath || "/api/auth";
|
|
17
|
-
const fullURL = `${url}${basePath}/
|
|
17
|
+
const fullURL = `${url}${basePath}/user/list-sessions`;
|
|
18
18
|
const res = await betterFetch(fullURL, {
|
|
19
|
-
headers:
|
|
19
|
+
headers: {
|
|
20
|
+
cookie: request.headers.get("cookie") || ""
|
|
21
|
+
}
|
|
22
|
+
}).catch((e) => {
|
|
23
|
+
return { data: null };
|
|
20
24
|
});
|
|
21
25
|
const session = res.data || null;
|
|
22
26
|
if (options.customRedirect) {
|
package/dist/node.d.ts
CHANGED
package/dist/plugins.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { O as OrganizationOptions, b as Passkey, P as PasskeyOptions,
|
|
1
|
+
export { O as OrganizationOptions, b as Passkey, P as PasskeyOptions, g as getPasskeyActions, m as magicLink, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-C3owlKu1.js';
|
|
2
2
|
export { i as ac } from './index-DfAHOgpj.js';
|
|
3
|
-
import { H as HookEndpointContext } from './index-
|
|
4
|
-
export { e as AuthEndpoint, f as AuthMiddleware, b as BetterAuthPlugin, P as PluginSchema, d as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-
|
|
3
|
+
import { H as HookEndpointContext } from './index-C9S3KShG.js';
|
|
4
|
+
export { e as AuthEndpoint, f as AuthMiddleware, b as BetterAuthPlugin, P as PluginSchema, d as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-C9S3KShG.js';
|
|
5
5
|
import './index-JM-i6hLs.js';
|
|
6
6
|
import 'arctic';
|
|
7
7
|
import 'zod';
|
package/dist/plugins.js
CHANGED
|
@@ -4981,7 +4981,11 @@ var passkey = (options) => {
|
|
|
4981
4981
|
...options?.advanced
|
|
4982
4982
|
}
|
|
4983
4983
|
};
|
|
4984
|
-
const
|
|
4984
|
+
const expirationTime = new Date(Date.now() + 1e3 * 60 * 5);
|
|
4985
|
+
const currentTime = /* @__PURE__ */ new Date();
|
|
4986
|
+
const maxAgeInSeconds = Math.floor(
|
|
4987
|
+
(expirationTime.getTime() - currentTime.getTime()) / 1e3
|
|
4988
|
+
);
|
|
4985
4989
|
return {
|
|
4986
4990
|
id: "passkey",
|
|
4987
4991
|
endpoints: {
|
|
@@ -5027,23 +5031,28 @@ var passkey = (options) => {
|
|
|
5027
5031
|
authenticatorAttachment: "platform"
|
|
5028
5032
|
}
|
|
5029
5033
|
});
|
|
5030
|
-
const
|
|
5031
|
-
expectedChallenge: options2.challenge,
|
|
5032
|
-
userData: {
|
|
5033
|
-
id: session.user.id
|
|
5034
|
-
}
|
|
5035
|
-
};
|
|
5034
|
+
const id = generateRandomString(32, alphabet("a-z", "0-9"));
|
|
5036
5035
|
await ctx.setSignedCookie(
|
|
5037
5036
|
opts.advanced.webAuthnChallengeCookie,
|
|
5038
|
-
|
|
5037
|
+
id,
|
|
5039
5038
|
ctx.context.secret,
|
|
5040
5039
|
{
|
|
5041
5040
|
secure: true,
|
|
5042
5041
|
httpOnly: true,
|
|
5043
5042
|
sameSite: "lax",
|
|
5044
|
-
maxAge:
|
|
5043
|
+
maxAge: maxAgeInSeconds
|
|
5045
5044
|
}
|
|
5046
5045
|
);
|
|
5046
|
+
await ctx.context.internalAdapter.createVerificationValue({
|
|
5047
|
+
identifier: id,
|
|
5048
|
+
value: JSON.stringify({
|
|
5049
|
+
expectedChallenge: options2.challenge,
|
|
5050
|
+
userData: {
|
|
5051
|
+
id: session.user.id
|
|
5052
|
+
}
|
|
5053
|
+
}),
|
|
5054
|
+
expiresAt: expirationTime
|
|
5055
|
+
});
|
|
5047
5056
|
return ctx.json(options2, {
|
|
5048
5057
|
status: 200
|
|
5049
5058
|
});
|
|
@@ -5091,17 +5100,23 @@ var passkey = (options) => {
|
|
|
5091
5100
|
id: session?.user.id || ""
|
|
5092
5101
|
}
|
|
5093
5102
|
};
|
|
5103
|
+
const id = generateRandomString(32, alphabet("a-z", "0-9"));
|
|
5094
5104
|
await ctx.setSignedCookie(
|
|
5095
5105
|
opts.advanced.webAuthnChallengeCookie,
|
|
5096
|
-
|
|
5106
|
+
id,
|
|
5097
5107
|
ctx.context.secret,
|
|
5098
5108
|
{
|
|
5099
5109
|
secure: true,
|
|
5100
5110
|
httpOnly: true,
|
|
5101
5111
|
sameSite: "lax",
|
|
5102
|
-
maxAge:
|
|
5112
|
+
maxAge: maxAgeInSeconds
|
|
5103
5113
|
}
|
|
5104
5114
|
);
|
|
5115
|
+
await ctx.context.internalAdapter.createVerificationValue({
|
|
5116
|
+
identifier: id,
|
|
5117
|
+
value: JSON.stringify(data),
|
|
5118
|
+
expiresAt: expirationTime
|
|
5119
|
+
});
|
|
5105
5120
|
return ctx.json(options2, {
|
|
5106
5121
|
status: 200
|
|
5107
5122
|
});
|
|
@@ -5125,17 +5140,29 @@ var passkey = (options) => {
|
|
|
5125
5140
|
});
|
|
5126
5141
|
}
|
|
5127
5142
|
const resp = ctx.body.response;
|
|
5128
|
-
const
|
|
5143
|
+
const challengeId = await ctx.getSignedCookie(
|
|
5129
5144
|
opts.advanced.webAuthnChallengeCookie,
|
|
5130
5145
|
ctx.context.secret
|
|
5131
5146
|
);
|
|
5132
|
-
if (!
|
|
5147
|
+
if (!challengeId) {
|
|
5148
|
+
return ctx.json(null, {
|
|
5149
|
+
status: 400,
|
|
5150
|
+
statusText: "No challenge found",
|
|
5151
|
+
body: {
|
|
5152
|
+
message: "No challenge found"
|
|
5153
|
+
}
|
|
5154
|
+
});
|
|
5155
|
+
}
|
|
5156
|
+
const data = await ctx.context.internalAdapter.findVerificationValue(
|
|
5157
|
+
challengeId
|
|
5158
|
+
);
|
|
5159
|
+
if (!data) {
|
|
5133
5160
|
return ctx.json(null, {
|
|
5134
5161
|
status: 400
|
|
5135
5162
|
});
|
|
5136
5163
|
}
|
|
5137
|
-
const {
|
|
5138
|
-
|
|
5164
|
+
const { expectedChallenge, userData } = JSON.parse(
|
|
5165
|
+
data.value
|
|
5139
5166
|
);
|
|
5140
5167
|
if (userData.id !== ctx.context.session.user.id) {
|
|
5141
5168
|
throw new APIError11("UNAUTHORIZED", {
|
|
@@ -5210,17 +5237,25 @@ var passkey = (options) => {
|
|
|
5210
5237
|
});
|
|
5211
5238
|
}
|
|
5212
5239
|
const resp = ctx.body.response;
|
|
5213
|
-
const
|
|
5240
|
+
const challengeId = await ctx.getSignedCookie(
|
|
5214
5241
|
opts.advanced.webAuthnChallengeCookie,
|
|
5215
5242
|
ctx.context.secret
|
|
5216
5243
|
);
|
|
5217
|
-
if (!
|
|
5244
|
+
if (!challengeId) {
|
|
5245
|
+
return ctx.json(null, {
|
|
5246
|
+
status: 400
|
|
5247
|
+
});
|
|
5248
|
+
}
|
|
5249
|
+
const data = await ctx.context.internalAdapter.findVerificationValue(
|
|
5250
|
+
challengeId
|
|
5251
|
+
);
|
|
5252
|
+
if (!data) {
|
|
5218
5253
|
return ctx.json(null, {
|
|
5219
5254
|
status: 400
|
|
5220
5255
|
});
|
|
5221
5256
|
}
|
|
5222
5257
|
const { expectedChallenge, callbackURL } = JSON.parse(
|
|
5223
|
-
|
|
5258
|
+
data.value
|
|
5224
5259
|
);
|
|
5225
5260
|
const passkey2 = await ctx.context.adapter.findOne({
|
|
5226
5261
|
model: "passkey",
|
package/dist/react.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from
|
|
|
3
3
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
4
4
|
import { useStore } from '@nanostores/react';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-C9S3KShG.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './index-JM-i6hLs.js';
|
|
9
9
|
import 'arctic';
|
package/dist/solid-start.d.ts
CHANGED
package/dist/solid.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from
|
|
|
3
3
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
4
4
|
import { Accessor } from 'solid-js';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-C9S3KShG.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './index-JM-i6hLs.js';
|
|
9
9
|
import 'arctic';
|
package/dist/svelte-kit.d.ts
CHANGED
package/dist/svelte-kit.js
CHANGED
package/dist/svelte.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-C9S3KShG.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './index-JM-i6hLs.js';
|
|
9
9
|
import 'arctic';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as BetterAuthPlugin, a as Auth, F as FieldAttribute, I as InferFieldOutput } from './index-
|
|
2
|
-
export { A as Adapter, k as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, i as InferPluginTypes, h as InferSession, g as InferUser, P as PluginSchema, R as RateLimit, S as SessionAdapter, W as Where, j as init } from './index-
|
|
1
|
+
import { b as BetterAuthPlugin, a as Auth, F as FieldAttribute, I as InferFieldOutput } from './index-C9S3KShG.js';
|
|
2
|
+
export { A as Adapter, k as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, i as InferPluginTypes, h as InferSession, g as InferUser, P as PluginSchema, R as RateLimit, S as SessionAdapter, W as Where, j as init } from './index-C9S3KShG.js';
|
|
3
3
|
import { U as UnionToIntersection, H as HasRequiredKeys, P as Prettify, S as StripEmptyObjects, L as LiteralString } from './helper-DPDj8Nix.js';
|
|
4
4
|
export { D as DeepPartial, a as LiteralUnion, R as RequiredKeysOf, W as WithoutEmpty } from './helper-DPDj8Nix.js';
|
|
5
5
|
import { S as Session, U as User } from './index-JM-i6hLs.js';
|
package/dist/vue.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from
|
|
|
3
3
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
4
4
|
import { Ref, DeepReadonly } from 'vue';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-C9S3KShG.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './index-JM-i6hLs.js';
|
|
9
9
|
import 'arctic';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "0.2.9
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "The most comprehensive authentication library for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@prisma/client": "^5.19.1",
|
|
46
46
|
"@simplewebauthn/types": "^10.0.0",
|
|
47
47
|
"@types/better-sqlite3": "^7.6.11",
|
|
48
|
-
"better-sqlite3": "^11.3.0",
|
|
49
48
|
"@types/pg": "^8.11.6",
|
|
50
49
|
"@types/prompts": "^2.4.9",
|
|
51
50
|
"@types/react": "^18.3.3",
|
|
51
|
+
"better-sqlite3": "^11.3.0",
|
|
52
52
|
"drizzle-orm": "^0.33.0",
|
|
53
53
|
"happy-dom": "^15.7.4",
|
|
54
54
|
"hono": "^4.5.4",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"dotenv": "^16.4.5",
|
|
93
93
|
"execa": "^9.4.0",
|
|
94
94
|
"jose": "^5.7.0",
|
|
95
|
+
"js-base64": "^3.7.7",
|
|
95
96
|
"kysely": "^0.27.4",
|
|
96
97
|
"nanoid": "^5.0.7",
|
|
97
98
|
"nanoquery": "^1.3.0",
|