better-auth 0.4.9-beta.7 → 0.4.9-beta.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/mongodb.js +14 -4
- package/dist/adapters/prisma.d.ts +1 -1
- package/dist/adapters/prisma.js +7 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +2 -2
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.ts +1 -1
- package/dist/{index-e3_mbU9X.d.ts → index-7R4SuAdU.d.ts} +1 -1
- package/dist/{index-DLbRYrL5.d.ts → index-BQ_rbsXC.d.ts} +38 -28
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -23
- package/dist/next-js.d.ts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/plugins.d.ts +3 -3
- 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.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/vue.d.ts +1 -1
- package/package.json +2 -1
package/dist/adapters/mongodb.js
CHANGED
|
@@ -80,15 +80,25 @@ var mongodbAdapter = (mongo) => {
|
|
|
80
80
|
async update(data) {
|
|
81
81
|
const { model, where, update } = data;
|
|
82
82
|
const wheres = whereConvertor(where);
|
|
83
|
-
|
|
83
|
+
if (where.length === 1) {
|
|
84
|
+
const res2 = await db.collection(model).findOneAndUpdate(
|
|
85
|
+
//@ts-expect-error
|
|
86
|
+
wheres,
|
|
87
|
+
{
|
|
88
|
+
$set: update
|
|
89
|
+
},
|
|
90
|
+
{ returnDocument: "after" }
|
|
91
|
+
);
|
|
92
|
+
return removeMongoId(res2);
|
|
93
|
+
}
|
|
94
|
+
const res = await db.collection(model).updateMany(
|
|
84
95
|
//@ts-expect-error
|
|
85
96
|
wheres,
|
|
86
97
|
{
|
|
87
98
|
$set: update
|
|
88
|
-
}
|
|
89
|
-
{ returnDocument: "after" }
|
|
99
|
+
}
|
|
90
100
|
);
|
|
91
|
-
return
|
|
101
|
+
return {};
|
|
92
102
|
},
|
|
93
103
|
async delete(data) {
|
|
94
104
|
const { model, where } = data;
|
package/dist/adapters/prisma.js
CHANGED
|
@@ -81,7 +81,13 @@ var prismaAdapter = (prisma, {
|
|
|
81
81
|
async update(data) {
|
|
82
82
|
const { model, where, update } = data;
|
|
83
83
|
const whereClause = whereConvertor(where);
|
|
84
|
-
|
|
84
|
+
if (where.length === 1) {
|
|
85
|
+
return await db[model].update({
|
|
86
|
+
where: whereClause,
|
|
87
|
+
data: update
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return await db[model].updateMany({
|
|
85
91
|
where: whereClause,
|
|
86
92
|
data: update
|
|
87
93
|
});
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { e as AuthEndpoint, f as AuthMiddleware, v as callbackOAuth, T as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, M as createEmailVerificationToken, $ as csrfMiddleware, V as deleteUser, Y as error, J as forgetPassword, K as forgetPasswordCallback, X as getCSRFToken, r as getEndpoints, w as getSession, x as getSessionFromCtx, z as listSessions, Z as ok, o as optionsMiddleware, L as resetPassword, C as revokeSession, D as revokeSessions, s as router, N as sendVerificationEmail, y as sessionMiddleware, U as setPassword, u as signInEmail, t as signInOAuth, E as signOut, _ as signUpEmail, Q as updateUser, O as verifyEmail } from './index-
|
|
1
|
+
export { e as AuthEndpoint, f as AuthMiddleware, v as callbackOAuth, T as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, M as createEmailVerificationToken, $ as csrfMiddleware, V as deleteUser, Y as error, J as forgetPassword, K as forgetPasswordCallback, X as getCSRFToken, r as getEndpoints, w as getSession, x as getSessionFromCtx, z as listSessions, Z as ok, o as optionsMiddleware, L as resetPassword, C as revokeSession, D as revokeSessions, s as router, N as sendVerificationEmail, y as sessionMiddleware, U as setPassword, u as signInEmail, t as signInOAuth, E as signOut, _ as signUpEmail, Q as updateUser, O as verifyEmail } from './index-BQ_rbsXC.js';
|
|
2
2
|
import './helper-DPDj8Nix.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
export { APIError } from 'better-call';
|
package/dist/api.js
CHANGED
|
@@ -2599,7 +2599,7 @@ function getEndpoints(ctx, options) {
|
|
|
2599
2599
|
};
|
|
2600
2600
|
let api = {};
|
|
2601
2601
|
for (const [key, value] of Object.entries(endpoints)) {
|
|
2602
|
-
api[key] = async (context) => {
|
|
2602
|
+
api[key] = async (context = {}) => {
|
|
2603
2603
|
let c = await ctx;
|
|
2604
2604
|
for (const plugin of options.plugins || []) {
|
|
2605
2605
|
if (plugin.hooks?.before) {
|
|
@@ -2614,7 +2614,7 @@ function getEndpoints(ctx, options) {
|
|
|
2614
2614
|
...context,
|
|
2615
2615
|
context: {
|
|
2616
2616
|
...c,
|
|
2617
|
-
...context
|
|
2617
|
+
...context?.context
|
|
2618
2618
|
}
|
|
2619
2619
|
});
|
|
2620
2620
|
if (hookRes && "context" in hookRes) {
|
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ 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, k as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin, j as genericOAuth } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, k as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin, j as genericOAuth } from '../index-7R4SuAdU.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-7R4SuAdU.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DPDj8Nix.js';
|
|
8
|
-
import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-
|
|
8
|
+
import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-BQ_rbsXC.js';
|
|
9
9
|
import '../types-IzAbV4nB.js';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'better-call';
|
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-BQ_rbsXC.js';
|
|
10
10
|
import 'kysely';
|
|
11
11
|
import './types-IzAbV4nB.js';
|
|
12
12
|
import 'better-call';
|
|
@@ -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, g as AuthContext } from './index-
|
|
8
|
+
import { H as HookEndpointContext, g as AuthContext } from './index-BQ_rbsXC.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
|
@@ -488,7 +488,7 @@ type BetterAuthPlugin = {
|
|
|
488
488
|
*/
|
|
489
489
|
type Where = {
|
|
490
490
|
operator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte";
|
|
491
|
-
value: string;
|
|
491
|
+
value: string | number | boolean;
|
|
492
492
|
field: string;
|
|
493
493
|
connector?: "AND" | "OR";
|
|
494
494
|
};
|
|
@@ -517,6 +517,10 @@ interface Adapter {
|
|
|
517
517
|
};
|
|
518
518
|
offset?: number;
|
|
519
519
|
}) => Promise<T[]>;
|
|
520
|
+
/**
|
|
521
|
+
* ⚠︎ Update may not return the updated data
|
|
522
|
+
* if multiple where clauses are provided
|
|
523
|
+
*/
|
|
520
524
|
update: <T>(data: {
|
|
521
525
|
model: string;
|
|
522
526
|
where: Where[];
|
|
@@ -1120,12 +1124,12 @@ declare const signInOAuth: {
|
|
|
1120
1124
|
/**
|
|
1121
1125
|
* OAuth2 provider to use`
|
|
1122
1126
|
*/
|
|
1123
|
-
provider: z.ZodEnum<["github", ...("
|
|
1127
|
+
provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1124
1128
|
}, "strip", z.ZodTypeAny, {
|
|
1125
|
-
provider: "
|
|
1129
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
1126
1130
|
callbackURL?: string | undefined;
|
|
1127
1131
|
}, {
|
|
1128
|
-
provider: "
|
|
1132
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
1129
1133
|
callbackURL?: string | undefined;
|
|
1130
1134
|
}>;
|
|
1131
1135
|
use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
|
|
@@ -1160,12 +1164,12 @@ declare const signInOAuth: {
|
|
|
1160
1164
|
/**
|
|
1161
1165
|
* OAuth2 provider to use`
|
|
1162
1166
|
*/
|
|
1163
|
-
provider: z.ZodEnum<["github", ...("
|
|
1167
|
+
provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1164
1168
|
}, "strip", z.ZodTypeAny, {
|
|
1165
|
-
provider: "
|
|
1169
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
1166
1170
|
callbackURL?: string | undefined;
|
|
1167
1171
|
}, {
|
|
1168
|
-
provider: "
|
|
1172
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
1169
1173
|
callbackURL?: string | undefined;
|
|
1170
1174
|
}>;
|
|
1171
1175
|
use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
|
|
@@ -2361,12 +2365,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2361
2365
|
}>>;
|
|
2362
2366
|
body: zod.ZodObject<{
|
|
2363
2367
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2364
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2368
|
+
provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2365
2369
|
}, "strip", zod.ZodTypeAny, {
|
|
2366
|
-
provider: "
|
|
2370
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
2367
2371
|
callbackURL?: string | undefined;
|
|
2368
2372
|
}, {
|
|
2369
|
-
provider: "
|
|
2373
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
2370
2374
|
callbackURL?: string | undefined;
|
|
2371
2375
|
}>;
|
|
2372
2376
|
use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
|
|
@@ -2391,12 +2395,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2391
2395
|
}>>;
|
|
2392
2396
|
body: zod.ZodObject<{
|
|
2393
2397
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2394
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2398
|
+
provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2395
2399
|
}, "strip", zod.ZodTypeAny, {
|
|
2396
|
-
provider: "
|
|
2400
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
2397
2401
|
callbackURL?: string | undefined;
|
|
2398
2402
|
}, {
|
|
2399
|
-
provider: "
|
|
2403
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
2400
2404
|
callbackURL?: string | undefined;
|
|
2401
2405
|
}>;
|
|
2402
2406
|
use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
|
|
@@ -3388,7 +3392,9 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
3388
3392
|
method: better_call.Method | better_call.Method[];
|
|
3389
3393
|
headers: Headers;
|
|
3390
3394
|
};
|
|
3391
|
-
} & UnionToIntersection<Option["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T
|
|
3395
|
+
} & UnionToIntersection<Option["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T extends {
|
|
3396
|
+
endpoints: infer E;
|
|
3397
|
+
} ? E : {} : {} : {}>;
|
|
3392
3398
|
middlewares: {
|
|
3393
3399
|
path: string;
|
|
3394
3400
|
middleware: Endpoint;
|
|
@@ -3450,12 +3456,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3450
3456
|
}>>;
|
|
3451
3457
|
body: zod.ZodObject<{
|
|
3452
3458
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3453
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3459
|
+
provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3454
3460
|
}, "strip", zod.ZodTypeAny, {
|
|
3455
|
-
provider: "
|
|
3461
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
3456
3462
|
callbackURL?: string | undefined;
|
|
3457
3463
|
}, {
|
|
3458
|
-
provider: "
|
|
3464
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
3459
3465
|
callbackURL?: string | undefined;
|
|
3460
3466
|
}>;
|
|
3461
3467
|
use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
|
|
@@ -3480,12 +3486,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3480
3486
|
}>>;
|
|
3481
3487
|
body: zod.ZodObject<{
|
|
3482
3488
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3483
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3489
|
+
provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3484
3490
|
}, "strip", zod.ZodTypeAny, {
|
|
3485
|
-
provider: "
|
|
3491
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
3486
3492
|
callbackURL?: string | undefined;
|
|
3487
3493
|
}, {
|
|
3488
|
-
provider: "
|
|
3494
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
3489
3495
|
callbackURL?: string | undefined;
|
|
3490
3496
|
}>;
|
|
3491
3497
|
use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
|
|
@@ -4477,7 +4483,9 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
4477
4483
|
method: better_call.Method | better_call.Method[];
|
|
4478
4484
|
headers: Headers;
|
|
4479
4485
|
};
|
|
4480
|
-
} & UnionToIntersection<Option["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T
|
|
4486
|
+
} & UnionToIntersection<Option["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T extends {
|
|
4487
|
+
endpoints: infer E;
|
|
4488
|
+
} ? E : {} : {} : {}>;
|
|
4481
4489
|
};
|
|
4482
4490
|
|
|
4483
4491
|
type InferAPI<API> = Omit<API, API extends {
|
|
@@ -4541,12 +4549,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4541
4549
|
}>>;
|
|
4542
4550
|
body: zod.ZodObject<{
|
|
4543
4551
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4544
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4552
|
+
provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4545
4553
|
}, "strip", zod.ZodTypeAny, {
|
|
4546
|
-
provider: "
|
|
4554
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
4547
4555
|
callbackURL?: string | undefined;
|
|
4548
4556
|
}, {
|
|
4549
|
-
provider: "
|
|
4557
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
4550
4558
|
callbackURL?: string | undefined;
|
|
4551
4559
|
}>;
|
|
4552
4560
|
use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
|
|
@@ -4571,12 +4579,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4571
4579
|
}>>;
|
|
4572
4580
|
body: zod.ZodObject<{
|
|
4573
4581
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4574
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4582
|
+
provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4575
4583
|
}, "strip", zod.ZodTypeAny, {
|
|
4576
|
-
provider: "
|
|
4584
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
4577
4585
|
callbackURL?: string | undefined;
|
|
4578
4586
|
}, {
|
|
4579
|
-
provider: "
|
|
4587
|
+
provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
|
|
4580
4588
|
callbackURL?: string | undefined;
|
|
4581
4589
|
}>;
|
|
4582
4590
|
use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
|
|
@@ -5568,7 +5576,9 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
5568
5576
|
method: better_call.Method | better_call.Method[];
|
|
5569
5577
|
headers: Headers;
|
|
5570
5578
|
};
|
|
5571
|
-
} & UnionToIntersection<O["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T
|
|
5579
|
+
} & UnionToIntersection<O["plugins"] extends (infer T)[] ? T extends BetterAuthPlugin ? T extends {
|
|
5580
|
+
endpoints: infer E;
|
|
5581
|
+
} ? E : {} : {} : {}>>;
|
|
5572
5582
|
options: O;
|
|
5573
5583
|
$Infer: {
|
|
5574
5584
|
Session: {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2705,7 +2705,7 @@ function getEndpoints(ctx, options) {
|
|
|
2705
2705
|
};
|
|
2706
2706
|
let api = {};
|
|
2707
2707
|
for (const [key, value] of Object.entries(endpoints)) {
|
|
2708
|
-
api[key] = async (context) => {
|
|
2708
|
+
api[key] = async (context = {}) => {
|
|
2709
2709
|
let c = await ctx;
|
|
2710
2710
|
for (const plugin of options.plugins || []) {
|
|
2711
2711
|
if (plugin.hooks?.before) {
|
|
@@ -2720,7 +2720,7 @@ function getEndpoints(ctx, options) {
|
|
|
2720
2720
|
...context,
|
|
2721
2721
|
context: {
|
|
2722
2722
|
...c,
|
|
2723
|
-
...context
|
|
2723
|
+
...context?.context
|
|
2724
2724
|
}
|
|
2725
2725
|
});
|
|
2726
2726
|
if (hookRes && "context" in hookRes) {
|
|
@@ -3578,7 +3578,6 @@ function convertFromDB(fields, values) {
|
|
|
3578
3578
|
}
|
|
3579
3579
|
|
|
3580
3580
|
// src/crypto/password.ts
|
|
3581
|
-
import { scrypt } from "node:crypto";
|
|
3582
3581
|
import { decodeHex, encodeHex } from "oslo/encoding";
|
|
3583
3582
|
|
|
3584
3583
|
// src/crypto/buffer.ts
|
|
@@ -3596,6 +3595,7 @@ function constantTimeEqual(a, b) {
|
|
|
3596
3595
|
}
|
|
3597
3596
|
|
|
3598
3597
|
// src/crypto/password.ts
|
|
3598
|
+
import { scryptAsync } from "@noble/hashes/scrypt";
|
|
3599
3599
|
var config = {
|
|
3600
3600
|
N: 16384,
|
|
3601
3601
|
r: 16,
|
|
@@ -3603,23 +3603,12 @@ var config = {
|
|
|
3603
3603
|
dkLen: 64
|
|
3604
3604
|
};
|
|
3605
3605
|
async function generateKey(password, salt) {
|
|
3606
|
-
return await
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
N: config.N,
|
|
3613
|
-
p: config.p,
|
|
3614
|
-
r: config.r,
|
|
3615
|
-
// errors when 128 * N * r > `maxmem` (approximately)
|
|
3616
|
-
maxmem: 128 * config.N * config.r * 2
|
|
3617
|
-
},
|
|
3618
|
-
(err, buff) => {
|
|
3619
|
-
if (err) return reject(err);
|
|
3620
|
-
return resolve(buff);
|
|
3621
|
-
}
|
|
3622
|
-
);
|
|
3606
|
+
return await scryptAsync(password.normalize("NFKC"), salt, {
|
|
3607
|
+
N: config.N,
|
|
3608
|
+
p: config.p,
|
|
3609
|
+
r: config.r,
|
|
3610
|
+
dkLen: config.dkLen,
|
|
3611
|
+
maxmem: 128 * config.N * config.r * 2
|
|
3623
3612
|
});
|
|
3624
3613
|
}
|
|
3625
3614
|
var hashPassword = async (password) => {
|
|
@@ -4149,9 +4138,6 @@ var init = async (options) => {
|
|
|
4149
4138
|
"You are using the default secret. Please set `BETTER_AUTH_SECRET` or `AUTH_SECRET` in your environment variables or pass `secret` in your auth config."
|
|
4150
4139
|
);
|
|
4151
4140
|
}
|
|
4152
|
-
logger.warn(
|
|
4153
|
-
"You are using the default secret. This is not recommended. Please set `BETTER_AUTH_SECRET` or `AUTH_SECRET` in your environment variables or pass `secret` in your auth config."
|
|
4154
|
-
);
|
|
4155
4141
|
}
|
|
4156
4142
|
options = {
|
|
4157
4143
|
...options,
|
package/dist/next-js.d.ts
CHANGED
package/dist/node.d.ts
CHANGED
package/dist/plugins.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as AnonymousOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, U as UserWithPhoneNumber, f as UserWithRole, i as admin, h as adminMiddleware, e as anonymous, j as genericOAuth, 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-
|
|
1
|
+
export { A as AnonymousOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, U as UserWithPhoneNumber, f as UserWithRole, i as admin, h as adminMiddleware, e as anonymous, j as genericOAuth, 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-7R4SuAdU.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-BQ_rbsXC.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-BQ_rbsXC.js';
|
|
5
5
|
import './types-IzAbV4nB.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './helper-DPDj8Nix.js';
|
package/dist/react.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 { useStore } from '@nanostores/react';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-BQ_rbsXC.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/solid-start.d.ts
CHANGED
package/dist/solid.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 { Accessor } from 'solid-js';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-BQ_rbsXC.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/svelte-kit.d.ts
CHANGED
package/dist/svelte.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as nanostores from 'nanostores';
|
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
5
5
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-BQ_rbsXC.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as BetterAuthPlugin, a as Auth, I as InferFieldsInputClient, h as InferFieldsOutput } from './index-
|
|
2
|
-
export { A as Adapter, k as AdditionalSessionFieldsInput, l as AdditionalSessionFieldsOutput, i as AdditionalUserFieldsInput, j as AdditionalUserFieldsOutput, g as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, p as InferPluginTypes, n as InferSession, m as InferUser, P as PluginSchema, R as RateLimit, S as SecondaryStorage, W as Where, q as init } from './index-
|
|
1
|
+
import { b as BetterAuthPlugin, a as Auth, I as InferFieldsInputClient, h as InferFieldsOutput } from './index-BQ_rbsXC.js';
|
|
2
|
+
export { A as Adapter, k as AdditionalSessionFieldsInput, l as AdditionalSessionFieldsOutput, i as AdditionalUserFieldsInput, j as AdditionalUserFieldsOutput, g as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, p as InferPluginTypes, n as InferSession, m as InferUser, P as PluginSchema, R as RateLimit, S as SecondaryStorage, W as Where, q as init } from './index-BQ_rbsXC.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 './types-IzAbV4nB.js';
|
package/dist/vue.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 { Ref, DeepReadonly } from 'vue';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-BQ_rbsXC.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "0.4.9-beta.
|
|
3
|
+
"version": "0.4.9-beta.9",
|
|
4
4
|
"description": "The most comprehensive authentication library for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"@nanostores/solid": "^0.4.2",
|
|
81
81
|
"@nanostores/vue": "^0.10.0",
|
|
82
82
|
"@noble/ciphers": "^0.6.0",
|
|
83
|
+
"@noble/hashes": "^1.5.0",
|
|
83
84
|
"@simplewebauthn/browser": "^10.0.0",
|
|
84
85
|
"@simplewebauthn/server": "^10.0.1",
|
|
85
86
|
"better-call": "0.2.6",
|