better-auth 1.6.27 → 1.6.28
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/index.d.mts +6 -1
- package/dist/api/dispatch.d.mts +1 -0
- package/dist/api/index.d.mts +474 -472
- package/dist/api/middlewares/authorization.d.mts +8 -12
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/index.d.mts +1 -2
- package/dist/api/middlewares/origin-check.d.mts +5 -3
- package/dist/api/routes/account.d.mts +13 -10
- package/dist/api/routes/callback.d.mts +3 -1
- package/dist/api/routes/email-verification.d.mts +8 -4
- package/dist/api/routes/error.d.mts +3 -1
- package/dist/api/routes/index.d.mts +1 -2
- package/dist/api/routes/ok.d.mts +3 -1
- package/dist/api/routes/password.d.mts +9 -7
- package/dist/api/routes/session.d.mts +24 -22
- package/dist/api/routes/sign-in.d.mts +5 -3
- package/dist/api/routes/sign-out.d.mts +3 -1
- package/dist/api/routes/sign-up.d.mts +4 -3
- package/dist/api/routes/update-session.d.mts +4 -3
- package/dist/api/routes/update-user.d.mts +14 -13
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/client/config.d.mts +14 -12
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +1 -0
- package/dist/client/index.d.mts +5 -6
- package/dist/client/lynx/index.d.mts +5 -4
- package/dist/client/lynx/lynx-store.d.mts +2 -1
- package/dist/client/parser.d.mts +3 -7
- package/dist/client/path-to-object.d.mts +4 -3
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +1 -0
- package/dist/client/query.d.mts +1 -0
- package/dist/client/react/index.d.mts +5 -4
- package/dist/client/react/react-store.d.mts +2 -1
- package/dist/client/session-atom.mjs +41 -17
- package/dist/client/session-refresh.d.mts +1 -0
- package/dist/client/solid/index.d.mts +5 -4
- package/dist/client/svelte/index.d.mts +5 -4
- package/dist/client/types.d.mts +2 -2
- package/dist/client/vanilla.d.mts +2 -1
- package/dist/client/vue/index.d.mts +5 -4
- package/dist/context/create-context.mjs +3 -3
- package/dist/context/helpers.mjs +2 -2
- package/dist/cookies/index.d.mts +7 -6
- package/dist/cookies/session-store.d.mts +0 -1
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/index.d.mts +9 -2
- package/dist/crypto/jwt.d.mts +1 -0
- package/dist/crypto/password.d.mts +5 -1
- package/dist/db/adapter-base.d.mts +1 -0
- package/dist/db/adapter-kysely.d.mts +1 -0
- package/dist/db/field-converter.d.mts +1 -0
- package/dist/db/field.d.mts +10 -9
- package/dist/db/get-migration.d.mts +1 -0
- package/dist/db/get-schema.d.mts +1 -0
- package/dist/db/internal-adapter.d.mts +1 -0
- package/dist/db/internal-adapter.mjs +1 -2
- package/dist/db/revoke-unproven-account-access.d.mts +1 -0
- package/dist/db/schema.d.mts +2 -2
- package/dist/db/to-zod.d.mts +7 -3
- package/dist/db/with-hooks.d.mts +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/integrations/next-js.d.mts +7 -4
- package/dist/integrations/node.d.mts +3 -2
- package/dist/integrations/svelte-kit.d.mts +9 -2
- package/dist/integrations/tanstack-start-solid.d.mts +5 -2
- package/dist/integrations/tanstack-start.d.mts +5 -2
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/state.d.mts +1 -0
- package/dist/oauth2/utils.d.mts +1 -0
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +1 -0
- package/dist/plugins/access/types.d.mts +5 -4
- package/dist/plugins/additional-fields/client.d.mts +1 -0
- package/dist/plugins/admin/access/statement.d.mts +0 -1
- package/dist/plugins/admin/admin.d.mts +125 -120
- package/dist/plugins/admin/client.d.mts +30 -30
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -23
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/schema.d.mts +1 -1
- package/dist/plugins/admin/types.d.mts +2 -3
- package/dist/plugins/anonymous/client.d.mts +11 -9
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -8
- package/dist/plugins/anonymous/index.d.mts +18 -14
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +7 -4
- package/dist/plugins/captcha/index.d.mts +8 -5
- package/dist/plugins/captcha/types.d.mts +1 -0
- package/dist/plugins/custom-session/client.d.mts +1 -0
- package/dist/plugins/custom-session/index.d.mts +12 -7
- package/dist/plugins/device-authorization/client.d.mts +1 -0
- package/dist/plugins/device-authorization/index.d.mts +22 -19
- package/dist/plugins/email-otp/client.d.mts +6 -4
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -3
- package/dist/plugins/email-otp/index.d.mts +74 -67
- package/dist/plugins/email-otp/types.d.mts +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +11 -10
- package/dist/plugins/generic-oauth/client.mjs +1 -1
- package/dist/plugins/generic-oauth/error-codes.d.mts +10 -8
- package/dist/plugins/generic-oauth/index.d.mts +44 -40
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +2 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +6 -3
- package/dist/plugins/index.d.mts +1 -4
- package/dist/plugins/jwt/client.d.mts +2 -1
- package/dist/plugins/jwt/index.d.mts +11 -8
- package/dist/plugins/jwt/sign.d.mts +2 -2
- package/dist/plugins/jwt/types.d.mts +1 -1
- package/dist/plugins/jwt/utils.d.mts +4 -2
- package/dist/plugins/jwt/verify.d.mts +1 -0
- package/dist/plugins/last-login-method/index.d.mts +5 -2
- package/dist/plugins/magic-link/client.d.mts +1 -0
- package/dist/plugins/magic-link/index.d.mts +6 -4
- package/dist/plugins/mcp/client/adapters.d.mts +1 -0
- package/dist/plugins/mcp/client/index.mjs +2 -4
- package/dist/plugins/mcp/index.d.mts +11 -10
- package/dist/plugins/multi-session/client.d.mts +4 -2
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -1
- package/dist/plugins/multi-session/index.d.mts +11 -7
- package/dist/plugins/oauth-popup/client.d.mts +12 -6
- package/dist/plugins/oauth-popup/client.mjs +3 -5
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -4
- package/dist/plugins/oauth-popup/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/index.mjs +1 -1
- package/dist/plugins/oauth-popup/types.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +9 -6
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/client.d.mts +2 -1
- package/dist/plugins/oidc-provider/index.d.mts +17 -15
- package/dist/plugins/oidc-provider/schema.d.mts +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +1 -1
- package/dist/plugins/one-tap/client.d.mts +3 -1
- package/dist/plugins/one-tap/index.d.mts +3 -1
- package/dist/plugins/one-time-token/client.d.mts +2 -1
- package/dist/plugins/one-time-token/index.d.mts +6 -5
- package/dist/plugins/open-api/generator.d.mts +1 -0
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -3
- package/dist/plugins/organization/access/statement.d.mts +0 -1
- package/dist/plugins/organization/adapter.d.mts +82 -56
- package/dist/plugins/organization/client.d.mts +103 -104
- package/dist/plugins/organization/client.mjs +4 -7
- package/dist/plugins/organization/error-codes.d.mts +61 -59
- package/dist/plugins/organization/has-permission.d.mts +1 -0
- package/dist/plugins/organization/has-permission.mjs +1 -1
- package/dist/plugins/organization/index.d.mts +1 -1
- package/dist/plugins/organization/organization.d.mts +9 -9
- package/dist/plugins/organization/organization.mjs +1 -1
- package/dist/plugins/organization/permission.d.mts +2 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +27 -27
- package/dist/plugins/organization/routes/crud-invites.d.mts +64 -63
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +56 -54
- package/dist/plugins/organization/routes/crud-members.mjs +1 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +54 -53
- package/dist/plugins/organization/routes/crud-team.d.mts +65 -64
- package/dist/plugins/organization/schema.d.mts +4 -4
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +14 -14
- package/dist/plugins/phone-number/client.d.mts +15 -13
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -12
- package/dist/plugins/phone-number/index.d.mts +47 -41
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/client.d.mts +1 -0
- package/dist/plugins/siwe/index.d.mts +5 -4
- package/dist/plugins/test-utils/index.d.mts +4 -2
- package/dist/plugins/test-utils/types.d.mts +0 -1
- package/dist/plugins/two-factor/backup-codes/index.d.mts +6 -4
- package/dist/plugins/two-factor/backup-codes/index.mjs +1 -1
- package/dist/plugins/two-factor/client.d.mts +15 -12
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +12 -10
- package/dist/plugins/two-factor/index.d.mts +31 -27
- package/dist/plugins/two-factor/otp/index.d.mts +4 -2
- package/dist/plugins/two-factor/totp/index.d.mts +6 -4
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/username/client.d.mts +11 -9
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +10 -8
- package/dist/plugins/username/index.d.mts +22 -17
- package/dist/plugins/username/schema.d.mts +5 -3
- package/dist/state.d.mts +1 -0
- package/dist/test-utils/test-instance.d.mts +3 -5
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +2 -1
- package/dist/types/auth.d.mts +1 -0
- package/dist/types/helper.d.mts +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +1 -0
- package/dist/types/plugins.d.mts +3 -2
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/url.d.mts +1 -0
- package/package.json +10 -10
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { PhoneNumberOptions, UserWithPhoneNumber } from "./types.mjs";
|
|
2
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
3
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
4
|
+
import * as _$better_call0 from "better-call";
|
|
5
|
+
import * as _$zod from "zod";
|
|
6
|
+
import * as _$zod_v4_core0 from "zod/v4/core";
|
|
7
|
+
|
|
2
8
|
//#region src/plugins/phone-number/index.d.ts
|
|
3
9
|
declare module "@better-auth/core" {
|
|
4
10
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -42,18 +48,18 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
|
|
|
42
48
|
};
|
|
43
49
|
hooks: {
|
|
44
50
|
before: {
|
|
45
|
-
matcher: (ctx:
|
|
46
|
-
handler:
|
|
51
|
+
matcher: (ctx: _$_better_auth_core0.HookEndpointContext) => boolean;
|
|
52
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<never>>;
|
|
47
53
|
}[];
|
|
48
54
|
};
|
|
49
55
|
endpoints: {
|
|
50
|
-
signInPhoneNumber:
|
|
56
|
+
signInPhoneNumber: _$better_call0.StrictEndpoint<"/sign-in/phone-number", {
|
|
51
57
|
method: "POST";
|
|
52
|
-
body:
|
|
53
|
-
phoneNumber:
|
|
54
|
-
password:
|
|
55
|
-
rememberMe:
|
|
56
|
-
},
|
|
58
|
+
body: _$zod.ZodObject<{
|
|
59
|
+
phoneNumber: _$zod.ZodString;
|
|
60
|
+
password: _$zod.ZodString;
|
|
61
|
+
rememberMe: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
62
|
+
}, _$zod_v4_core0.$strip>;
|
|
57
63
|
metadata: {
|
|
58
64
|
openapi: {
|
|
59
65
|
summary: string;
|
|
@@ -87,11 +93,11 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
|
|
|
87
93
|
token: string;
|
|
88
94
|
user: UserWithPhoneNumber;
|
|
89
95
|
}>;
|
|
90
|
-
sendPhoneNumberOTP:
|
|
96
|
+
sendPhoneNumberOTP: _$better_call0.StrictEndpoint<"/phone-number/send-otp", {
|
|
91
97
|
method: "POST";
|
|
92
|
-
body:
|
|
93
|
-
phoneNumber:
|
|
94
|
-
},
|
|
98
|
+
body: _$zod.ZodObject<{
|
|
99
|
+
phoneNumber: _$zod.ZodString;
|
|
100
|
+
}, _$zod_v4_core0.$strip>;
|
|
95
101
|
metadata: {
|
|
96
102
|
openapi: {
|
|
97
103
|
summary: string;
|
|
@@ -118,14 +124,14 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
|
|
|
118
124
|
}, {
|
|
119
125
|
message: string;
|
|
120
126
|
}>;
|
|
121
|
-
verifyPhoneNumber:
|
|
127
|
+
verifyPhoneNumber: _$better_call0.StrictEndpoint<"/phone-number/verify", {
|
|
122
128
|
method: "POST";
|
|
123
|
-
body:
|
|
124
|
-
phoneNumber:
|
|
125
|
-
code:
|
|
126
|
-
disableSession:
|
|
127
|
-
updatePhoneNumber:
|
|
128
|
-
},
|
|
129
|
+
body: _$zod.ZodIntersection<_$zod.ZodObject<{
|
|
130
|
+
phoneNumber: _$zod.ZodString;
|
|
131
|
+
code: _$zod.ZodString;
|
|
132
|
+
disableSession: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
133
|
+
updatePhoneNumber: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
134
|
+
}, _$zod_v4_core0.$strip>, _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodAny>>;
|
|
129
135
|
metadata: {
|
|
130
136
|
openapi: {
|
|
131
137
|
summary: string;
|
|
@@ -229,11 +235,11 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
|
|
|
229
235
|
token: null;
|
|
230
236
|
user: UserWithPhoneNumber;
|
|
231
237
|
}>;
|
|
232
|
-
requestPasswordResetPhoneNumber:
|
|
238
|
+
requestPasswordResetPhoneNumber: _$better_call0.StrictEndpoint<"/phone-number/request-password-reset", {
|
|
233
239
|
method: "POST";
|
|
234
|
-
body:
|
|
235
|
-
phoneNumber:
|
|
236
|
-
},
|
|
240
|
+
body: _$zod.ZodObject<{
|
|
241
|
+
phoneNumber: _$zod.ZodString;
|
|
242
|
+
}, _$zod_v4_core0.$strip>;
|
|
237
243
|
metadata: {
|
|
238
244
|
openapi: {
|
|
239
245
|
description: string;
|
|
@@ -262,13 +268,13 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
|
|
|
262
268
|
}, {
|
|
263
269
|
status: boolean;
|
|
264
270
|
}>;
|
|
265
|
-
resetPasswordPhoneNumber:
|
|
271
|
+
resetPasswordPhoneNumber: _$better_call0.StrictEndpoint<"/phone-number/reset-password", {
|
|
266
272
|
method: "POST";
|
|
267
|
-
body:
|
|
268
|
-
otp:
|
|
269
|
-
phoneNumber:
|
|
270
|
-
newPassword:
|
|
271
|
-
},
|
|
273
|
+
body: _$zod.ZodObject<{
|
|
274
|
+
otp: _$zod.ZodString;
|
|
275
|
+
phoneNumber: _$zod.ZodString;
|
|
276
|
+
newPassword: _$zod.ZodString;
|
|
277
|
+
}, _$zod_v4_core0.$strip>;
|
|
272
278
|
metadata: {
|
|
273
279
|
openapi: {
|
|
274
280
|
description: string;
|
|
@@ -324,18 +330,18 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
|
|
|
324
330
|
}[];
|
|
325
331
|
options: PhoneNumberOptions | undefined;
|
|
326
332
|
$ERROR_CODES: {
|
|
327
|
-
OTP_EXPIRED:
|
|
328
|
-
INVALID_OTP:
|
|
329
|
-
TOO_MANY_ATTEMPTS:
|
|
330
|
-
INVALID_PHONE_NUMBER:
|
|
331
|
-
PHONE_NUMBER_EXIST:
|
|
332
|
-
PHONE_NUMBER_NOT_EXIST:
|
|
333
|
-
INVALID_PHONE_NUMBER_OR_PASSWORD:
|
|
334
|
-
UNEXPECTED_ERROR:
|
|
335
|
-
OTP_NOT_FOUND:
|
|
336
|
-
PHONE_NUMBER_NOT_VERIFIED:
|
|
337
|
-
PHONE_NUMBER_CANNOT_BE_UPDATED:
|
|
338
|
-
SEND_OTP_NOT_IMPLEMENTED:
|
|
333
|
+
OTP_EXPIRED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_EXPIRED">;
|
|
334
|
+
INVALID_OTP: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_OTP">;
|
|
335
|
+
TOO_MANY_ATTEMPTS: _$_better_auth_core_utils_error_codes0.RawError<"TOO_MANY_ATTEMPTS">;
|
|
336
|
+
INVALID_PHONE_NUMBER: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_PHONE_NUMBER">;
|
|
337
|
+
PHONE_NUMBER_EXIST: _$_better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_EXIST">;
|
|
338
|
+
PHONE_NUMBER_NOT_EXIST: _$_better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_NOT_EXIST">;
|
|
339
|
+
INVALID_PHONE_NUMBER_OR_PASSWORD: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_PHONE_NUMBER_OR_PASSWORD">;
|
|
340
|
+
UNEXPECTED_ERROR: _$_better_auth_core_utils_error_codes0.RawError<"UNEXPECTED_ERROR">;
|
|
341
|
+
OTP_NOT_FOUND: _$_better_auth_core_utils_error_codes0.RawError<"OTP_NOT_FOUND">;
|
|
342
|
+
PHONE_NUMBER_NOT_VERIFIED: _$_better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_NOT_VERIFIED">;
|
|
343
|
+
PHONE_NUMBER_CANNOT_BE_UPDATED: _$_better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_CANNOT_BE_UPDATED">;
|
|
344
|
+
SEND_OTP_NOT_IMPLEMENTED: _$_better_auth_core_utils_error_codes0.RawError<"SEND_OTP_NOT_IMPLEMENTED">;
|
|
339
345
|
};
|
|
340
346
|
};
|
|
341
347
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { User } from "../../types/models.mjs";
|
|
2
2
|
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
3
|
-
import "../../types/index.mjs";
|
|
4
3
|
import { schema } from "./schema.mjs";
|
|
5
4
|
import { Awaitable, GenericEndpointContext } from "@better-auth/core";
|
|
5
|
+
|
|
6
6
|
//#region src/plugins/phone-number/types.d.ts
|
|
7
7
|
interface UserWithPhoneNumber extends User {
|
|
8
8
|
phoneNumber: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
2
|
-
import "../../types/index.mjs";
|
|
3
2
|
import { WalletAddressSchema, schema } from "./schema.mjs";
|
|
4
3
|
import { ENSLookupArgs, ENSLookupResult, SIWEVerifyMessageArgs } from "./types.mjs";
|
|
4
|
+
import * as _$better_call0 from "better-call";
|
|
5
5
|
import * as z from "zod";
|
|
6
|
+
|
|
6
7
|
//#region src/plugins/siwe/index.d.ts
|
|
7
8
|
declare module "@better-auth/core" {
|
|
8
9
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -25,7 +26,7 @@ declare const siwe: (options: SIWEPluginOptions) => {
|
|
|
25
26
|
version: string;
|
|
26
27
|
schema: WalletAddressSchema;
|
|
27
28
|
endpoints: {
|
|
28
|
-
getSiweNonce:
|
|
29
|
+
getSiweNonce: _$better_call0.StrictEndpoint<"/siwe/nonce" | "/siwe/get-nonce", {
|
|
29
30
|
method: "POST";
|
|
30
31
|
body: z.ZodObject<{
|
|
31
32
|
walletAddress: z.ZodOptional<z.ZodString>;
|
|
@@ -35,7 +36,7 @@ declare const siwe: (options: SIWEPluginOptions) => {
|
|
|
35
36
|
}, {
|
|
36
37
|
nonce: string;
|
|
37
38
|
}>;
|
|
38
|
-
getNonce:
|
|
39
|
+
getNonce: _$better_call0.StrictEndpoint<"/siwe/nonce" | "/siwe/get-nonce", {
|
|
39
40
|
method: "POST";
|
|
40
41
|
body: z.ZodObject<{
|
|
41
42
|
walletAddress: z.ZodOptional<z.ZodString>;
|
|
@@ -45,7 +46,7 @@ declare const siwe: (options: SIWEPluginOptions) => {
|
|
|
45
46
|
}, {
|
|
46
47
|
nonce: string;
|
|
47
48
|
}>;
|
|
48
|
-
verifySiweMessage:
|
|
49
|
+
verifySiweMessage: _$better_call0.StrictEndpoint<"/siwe/verify", {
|
|
49
50
|
method: "POST";
|
|
50
51
|
body: z.ZodObject<{
|
|
51
52
|
message: z.ZodString;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LoginResult, TestCookie, TestHelpers, TestUtilsOptions } from "./types.mjs";
|
|
2
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
3
|
+
|
|
2
4
|
//#region src/plugins/test-utils/index.d.ts
|
|
3
5
|
declare module "@better-auth/core" {
|
|
4
6
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -48,7 +50,7 @@ declare module "@better-auth/core" {
|
|
|
48
50
|
declare const testUtils: (options?: TestUtilsOptions) => {
|
|
49
51
|
id: "test-utils";
|
|
50
52
|
version: string;
|
|
51
|
-
init(ctx:
|
|
53
|
+
init(ctx: _$_better_auth_core0.AuthContext): {
|
|
52
54
|
context: {
|
|
53
55
|
test: TestHelpers;
|
|
54
56
|
};
|
|
@@ -68,4 +70,4 @@ declare const testUtils: (options?: TestUtilsOptions) => {
|
|
|
68
70
|
options: TestUtilsOptions;
|
|
69
71
|
};
|
|
70
72
|
//#endregion
|
|
71
|
-
export {
|
|
73
|
+
export { testUtils };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { SecretConfig } from "../../../crypto/index.mjs";
|
|
2
2
|
import { UserWithTwoFactor } from "../types.mjs";
|
|
3
|
+
import * as _$better_call0 from "better-call";
|
|
3
4
|
import * as z from "zod";
|
|
5
|
+
|
|
4
6
|
//#region src/plugins/two-factor/backup-codes/index.d.ts
|
|
5
7
|
interface BackupCodeOptions {
|
|
6
8
|
/**
|
|
@@ -69,7 +71,7 @@ declare const backupCode2fa: (opts: BackupCodeOptions) => {
|
|
|
69
71
|
*
|
|
70
72
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-verify-backup-code)
|
|
71
73
|
*/
|
|
72
|
-
verifyBackupCode:
|
|
74
|
+
verifyBackupCode: _$better_call0.StrictEndpoint<"/two-factor/verify-backup-code", {
|
|
73
75
|
method: "POST";
|
|
74
76
|
body: z.ZodObject<{
|
|
75
77
|
code: z.ZodString;
|
|
@@ -195,14 +197,14 @@ declare const backupCode2fa: (opts: BackupCodeOptions) => {
|
|
|
195
197
|
*
|
|
196
198
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-generate-backup-codes)
|
|
197
199
|
*/
|
|
198
|
-
generateBackupCodes:
|
|
200
|
+
generateBackupCodes: _$better_call0.StrictEndpoint<"/two-factor/generate-backup-codes", {
|
|
199
201
|
method: "POST";
|
|
200
202
|
body: z.ZodObject<{
|
|
201
203
|
password: z.ZodOptional<z.ZodString>;
|
|
202
204
|
}, z.core.$strip> | z.ZodObject<{
|
|
203
205
|
password: z.ZodString;
|
|
204
206
|
}, z.core.$strip>;
|
|
205
|
-
use:
|
|
207
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
206
208
|
session: {
|
|
207
209
|
session: Record<string, any> & {
|
|
208
210
|
id: string;
|
|
@@ -274,7 +276,7 @@ declare const backupCode2fa: (opts: BackupCodeOptions) => {
|
|
|
274
276
|
*
|
|
275
277
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-view-backup-codes)
|
|
276
278
|
*/
|
|
277
|
-
viewBackupCodes:
|
|
279
|
+
viewBackupCodes: _$better_call0.StrictEndpoint<string, {
|
|
278
280
|
method: "POST";
|
|
279
281
|
body: z.ZodObject<{
|
|
280
282
|
userId: z.ZodCoercedString<unknown>;
|
|
@@ -4,6 +4,9 @@ import { TOTPOptions, totp2fa } from "./totp/index.mjs";
|
|
|
4
4
|
import { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor } from "./types.mjs";
|
|
5
5
|
import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
|
|
6
6
|
import { twoFactor } from "./index.mjs";
|
|
7
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
8
|
+
import * as _$_better_fetch_fetch0 from "@better-fetch/fetch";
|
|
9
|
+
|
|
7
10
|
//#region src/plugins/two-factor/client.d.ts
|
|
8
11
|
declare const twoFactorClient: (options?: {
|
|
9
12
|
/**
|
|
@@ -50,21 +53,21 @@ declare const twoFactorClient: (options?: {
|
|
|
50
53
|
id: string;
|
|
51
54
|
name: string;
|
|
52
55
|
hooks: {
|
|
53
|
-
onSuccess(context:
|
|
56
|
+
onSuccess(context: _$_better_fetch_fetch0.SuccessContext<any>): Promise<void>;
|
|
54
57
|
};
|
|
55
58
|
}[];
|
|
56
59
|
$ERROR_CODES: {
|
|
57
|
-
OTP_NOT_ENABLED:
|
|
58
|
-
OTP_HAS_EXPIRED:
|
|
59
|
-
TOTP_NOT_ENABLED:
|
|
60
|
-
TWO_FACTOR_NOT_ENABLED:
|
|
61
|
-
BACKUP_CODES_NOT_ENABLED:
|
|
62
|
-
INVALID_BACKUP_CODE:
|
|
63
|
-
INVALID_CODE:
|
|
64
|
-
TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:
|
|
65
|
-
ACCOUNT_TEMPORARILY_LOCKED:
|
|
66
|
-
INVALID_TWO_FACTOR_COOKIE:
|
|
60
|
+
OTP_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_NOT_ENABLED">;
|
|
61
|
+
OTP_HAS_EXPIRED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_HAS_EXPIRED">;
|
|
62
|
+
TOTP_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"TOTP_NOT_ENABLED">;
|
|
63
|
+
TWO_FACTOR_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"TWO_FACTOR_NOT_ENABLED">;
|
|
64
|
+
BACKUP_CODES_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"BACKUP_CODES_NOT_ENABLED">;
|
|
65
|
+
INVALID_BACKUP_CODE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_BACKUP_CODE">;
|
|
66
|
+
INVALID_CODE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_CODE">;
|
|
67
|
+
TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: _$_better_auth_core_utils_error_codes0.RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
|
|
68
|
+
ACCOUNT_TEMPORARILY_LOCKED: _$_better_auth_core_utils_error_codes0.RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
|
|
69
|
+
INVALID_TWO_FACTOR_COOKIE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_TWO_FACTOR_COOKIE">;
|
|
67
70
|
};
|
|
68
71
|
};
|
|
69
72
|
//#endregion
|
|
70
|
-
export {
|
|
73
|
+
export { twoFactorClient };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
1
3
|
//#region src/plugins/two-factor/error-code.d.ts
|
|
2
4
|
declare const TWO_FACTOR_ERROR_CODES: {
|
|
3
|
-
OTP_NOT_ENABLED:
|
|
4
|
-
OTP_HAS_EXPIRED:
|
|
5
|
-
TOTP_NOT_ENABLED:
|
|
6
|
-
TWO_FACTOR_NOT_ENABLED:
|
|
7
|
-
BACKUP_CODES_NOT_ENABLED:
|
|
8
|
-
INVALID_BACKUP_CODE:
|
|
9
|
-
INVALID_CODE:
|
|
10
|
-
TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:
|
|
11
|
-
ACCOUNT_TEMPORARILY_LOCKED:
|
|
12
|
-
INVALID_TWO_FACTOR_COOKIE:
|
|
5
|
+
OTP_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_NOT_ENABLED">;
|
|
6
|
+
OTP_HAS_EXPIRED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_HAS_EXPIRED">;
|
|
7
|
+
TOTP_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"TOTP_NOT_ENABLED">;
|
|
8
|
+
TWO_FACTOR_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"TWO_FACTOR_NOT_ENABLED">;
|
|
9
|
+
BACKUP_CODES_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"BACKUP_CODES_NOT_ENABLED">;
|
|
10
|
+
INVALID_BACKUP_CODE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_BACKUP_CODE">;
|
|
11
|
+
INVALID_CODE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_CODE">;
|
|
12
|
+
TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: _$_better_auth_core_utils_error_codes0.RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
|
|
13
|
+
ACCOUNT_TEMPORARILY_LOCKED: _$_better_auth_core_utils_error_codes0.RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
|
|
14
|
+
INVALID_TWO_FACTOR_COOKIE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_TWO_FACTOR_COOKIE">;
|
|
13
15
|
};
|
|
14
16
|
//#endregion
|
|
15
17
|
export { TWO_FACTOR_ERROR_CODES };
|
|
@@ -4,7 +4,11 @@ import { TOTPOptions, totp2fa } from "./totp/index.mjs";
|
|
|
4
4
|
import { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor } from "./types.mjs";
|
|
5
5
|
import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
|
|
6
6
|
import { twoFactorClient } from "./client.mjs";
|
|
7
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
8
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
9
|
+
import * as _$better_call0 from "better-call";
|
|
7
10
|
import * as z from "zod";
|
|
11
|
+
|
|
8
12
|
//#region src/plugins/two-factor/index.d.ts
|
|
9
13
|
declare module "@better-auth/core" {
|
|
10
14
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -32,7 +36,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
32
36
|
*
|
|
33
37
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-enable)
|
|
34
38
|
*/
|
|
35
|
-
enableTwoFactor:
|
|
39
|
+
enableTwoFactor: _$better_call0.StrictEndpoint<"/two-factor/enable", {
|
|
36
40
|
method: "POST";
|
|
37
41
|
body: z.ZodObject<{
|
|
38
42
|
password: z.ZodOptional<z.ZodString>;
|
|
@@ -41,7 +45,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
41
45
|
password: z.ZodString;
|
|
42
46
|
issuer: z.ZodOptional<z.ZodString>;
|
|
43
47
|
}, z.core.$strip>;
|
|
44
|
-
use:
|
|
48
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
45
49
|
session: {
|
|
46
50
|
session: Record<string, any> & {
|
|
47
51
|
id: string;
|
|
@@ -114,14 +118,14 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
114
118
|
*
|
|
115
119
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-disable)
|
|
116
120
|
*/
|
|
117
|
-
disableTwoFactor:
|
|
121
|
+
disableTwoFactor: _$better_call0.StrictEndpoint<"/two-factor/disable", {
|
|
118
122
|
method: "POST";
|
|
119
123
|
body: z.ZodObject<{
|
|
120
124
|
password: z.ZodOptional<z.ZodString>;
|
|
121
125
|
}, z.core.$strip> | z.ZodObject<{
|
|
122
126
|
password: z.ZodString;
|
|
123
127
|
}, z.core.$strip>;
|
|
124
|
-
use:
|
|
128
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
125
129
|
session: {
|
|
126
130
|
session: Record<string, any> & {
|
|
127
131
|
id: string;
|
|
@@ -170,7 +174,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
170
174
|
}, {
|
|
171
175
|
status: boolean;
|
|
172
176
|
}>;
|
|
173
|
-
verifyBackupCode:
|
|
177
|
+
verifyBackupCode: _$better_call0.StrictEndpoint<"/two-factor/verify-backup-code", {
|
|
174
178
|
method: "POST";
|
|
175
179
|
body: z.ZodObject<{
|
|
176
180
|
code: z.ZodString;
|
|
@@ -281,14 +285,14 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
281
285
|
image?: string | null | undefined;
|
|
282
286
|
}) | UserWithTwoFactor;
|
|
283
287
|
}>;
|
|
284
|
-
generateBackupCodes:
|
|
288
|
+
generateBackupCodes: _$better_call0.StrictEndpoint<"/two-factor/generate-backup-codes", {
|
|
285
289
|
method: "POST";
|
|
286
290
|
body: z.ZodObject<{
|
|
287
291
|
password: z.ZodOptional<z.ZodString>;
|
|
288
292
|
}, z.core.$strip> | z.ZodObject<{
|
|
289
293
|
password: z.ZodString;
|
|
290
294
|
}, z.core.$strip>;
|
|
291
|
-
use:
|
|
295
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
292
296
|
session: {
|
|
293
297
|
session: Record<string, any> & {
|
|
294
298
|
id: string;
|
|
@@ -347,7 +351,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
347
351
|
status: boolean;
|
|
348
352
|
backupCodes: string[];
|
|
349
353
|
}>;
|
|
350
|
-
viewBackupCodes:
|
|
354
|
+
viewBackupCodes: _$better_call0.StrictEndpoint<string, {
|
|
351
355
|
method: "POST";
|
|
352
356
|
body: z.ZodObject<{
|
|
353
357
|
userId: z.ZodCoercedString<unknown>;
|
|
@@ -356,7 +360,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
356
360
|
status: boolean;
|
|
357
361
|
backupCodes: string[];
|
|
358
362
|
}>;
|
|
359
|
-
sendTwoFactorOTP:
|
|
363
|
+
sendTwoFactorOTP: _$better_call0.StrictEndpoint<"/two-factor/send-otp", {
|
|
360
364
|
method: "POST";
|
|
361
365
|
body: z.ZodOptional<z.ZodObject<{
|
|
362
366
|
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -387,7 +391,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
387
391
|
}, {
|
|
388
392
|
status: boolean;
|
|
389
393
|
}>;
|
|
390
|
-
verifyTwoFactorOTP:
|
|
394
|
+
verifyTwoFactorOTP: _$better_call0.StrictEndpoint<"/two-factor/verify-otp", {
|
|
391
395
|
method: "POST";
|
|
392
396
|
body: z.ZodObject<{
|
|
393
397
|
code: z.ZodString;
|
|
@@ -476,7 +480,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
476
480
|
image?: string | null | undefined;
|
|
477
481
|
};
|
|
478
482
|
}>;
|
|
479
|
-
generateTOTP:
|
|
483
|
+
generateTOTP: _$better_call0.StrictEndpoint<string, {
|
|
480
484
|
method: "POST";
|
|
481
485
|
body: z.ZodObject<{
|
|
482
486
|
secret: z.ZodString;
|
|
@@ -507,9 +511,9 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
507
511
|
}, {
|
|
508
512
|
code: string;
|
|
509
513
|
}>;
|
|
510
|
-
getTOTPURI:
|
|
514
|
+
getTOTPURI: _$better_call0.StrictEndpoint<"/two-factor/get-totp-uri", {
|
|
511
515
|
method: "POST";
|
|
512
|
-
use:
|
|
516
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
513
517
|
session: {
|
|
514
518
|
session: Record<string, any> & {
|
|
515
519
|
id: string;
|
|
@@ -563,7 +567,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
563
567
|
}, {
|
|
564
568
|
totpURI: string;
|
|
565
569
|
}>;
|
|
566
|
-
verifyTOTP:
|
|
570
|
+
verifyTOTP: _$better_call0.StrictEndpoint<"/two-factor/verify-totp", {
|
|
567
571
|
method: "POST";
|
|
568
572
|
body: z.ZodObject<{
|
|
569
573
|
code: z.ZodString;
|
|
@@ -611,8 +615,8 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
611
615
|
options: NoInfer<O>;
|
|
612
616
|
hooks: {
|
|
613
617
|
after: {
|
|
614
|
-
matcher(context:
|
|
615
|
-
handler:
|
|
618
|
+
matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
|
|
619
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
616
620
|
twoFactorRedirect: boolean;
|
|
617
621
|
twoFactorMethods: string[];
|
|
618
622
|
} | undefined>>;
|
|
@@ -680,17 +684,17 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
|
|
|
680
684
|
max: number;
|
|
681
685
|
}[];
|
|
682
686
|
$ERROR_CODES: {
|
|
683
|
-
OTP_NOT_ENABLED:
|
|
684
|
-
OTP_HAS_EXPIRED:
|
|
685
|
-
TOTP_NOT_ENABLED:
|
|
686
|
-
TWO_FACTOR_NOT_ENABLED:
|
|
687
|
-
BACKUP_CODES_NOT_ENABLED:
|
|
688
|
-
INVALID_BACKUP_CODE:
|
|
689
|
-
INVALID_CODE:
|
|
690
|
-
TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:
|
|
691
|
-
ACCOUNT_TEMPORARILY_LOCKED:
|
|
692
|
-
INVALID_TWO_FACTOR_COOKIE:
|
|
687
|
+
OTP_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_NOT_ENABLED">;
|
|
688
|
+
OTP_HAS_EXPIRED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_HAS_EXPIRED">;
|
|
689
|
+
TOTP_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"TOTP_NOT_ENABLED">;
|
|
690
|
+
TWO_FACTOR_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"TWO_FACTOR_NOT_ENABLED">;
|
|
691
|
+
BACKUP_CODES_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"BACKUP_CODES_NOT_ENABLED">;
|
|
692
|
+
INVALID_BACKUP_CODE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_BACKUP_CODE">;
|
|
693
|
+
INVALID_CODE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_CODE">;
|
|
694
|
+
TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: _$_better_auth_core_utils_error_codes0.RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
|
|
695
|
+
ACCOUNT_TEMPORARILY_LOCKED: _$_better_auth_core_utils_error_codes0.RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
|
|
696
|
+
INVALID_TWO_FACTOR_COOKIE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_TWO_FACTOR_COOKIE">;
|
|
693
697
|
};
|
|
694
698
|
};
|
|
695
699
|
//#endregion
|
|
696
|
-
export {
|
|
700
|
+
export { BackupCodeOptions, OTPOptions, TOTPOptions, TWO_FACTOR_ERROR_CODES, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, backupCode2fa, encodeBackupCodes, generateBackupCodes, getBackupCodes, otp2fa, totp2fa, twoFactor, twoFactorClient, verifyBackupCode };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { UserWithTwoFactor } from "../types.mjs";
|
|
2
2
|
import { Awaitable, GenericEndpointContext } from "@better-auth/core";
|
|
3
|
+
import * as _$better_call0 from "better-call";
|
|
3
4
|
import * as z from "zod";
|
|
5
|
+
|
|
4
6
|
//#region src/plugins/two-factor/otp/index.d.ts
|
|
5
7
|
interface OTPOptions {
|
|
6
8
|
/**
|
|
@@ -73,7 +75,7 @@ declare const otp2fa: (options?: OTPOptions | undefined) => {
|
|
|
73
75
|
*
|
|
74
76
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-send-otp)
|
|
75
77
|
*/
|
|
76
|
-
sendTwoFactorOTP:
|
|
78
|
+
sendTwoFactorOTP: _$better_call0.StrictEndpoint<"/two-factor/send-otp", {
|
|
77
79
|
method: "POST";
|
|
78
80
|
body: z.ZodOptional<z.ZodObject<{
|
|
79
81
|
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -119,7 +121,7 @@ declare const otp2fa: (options?: OTPOptions | undefined) => {
|
|
|
119
121
|
*
|
|
120
122
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-verify-otp)
|
|
121
123
|
*/
|
|
122
|
-
verifyTwoFactorOTP:
|
|
124
|
+
verifyTwoFactorOTP: _$better_call0.StrictEndpoint<"/two-factor/verify-otp", {
|
|
123
125
|
method: "POST";
|
|
124
126
|
body: z.ZodObject<{
|
|
125
127
|
code: z.ZodString;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BackupCodeOptions } from "../backup-codes/index.mjs";
|
|
2
2
|
import { UserWithTwoFactor } from "../types.mjs";
|
|
3
|
+
import * as _$better_call0 from "better-call";
|
|
3
4
|
import * as z from "zod";
|
|
5
|
+
|
|
4
6
|
//#region src/plugins/two-factor/totp/index.d.ts
|
|
5
7
|
type TOTPOptions = {
|
|
6
8
|
/**
|
|
@@ -50,7 +52,7 @@ declare const totp2fa: (options?: TOTPOptions | undefined) => {
|
|
|
50
52
|
*
|
|
51
53
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#totp)
|
|
52
54
|
*/
|
|
53
|
-
generateTOTP:
|
|
55
|
+
generateTOTP: _$better_call0.StrictEndpoint<string, {
|
|
54
56
|
method: "POST";
|
|
55
57
|
body: z.ZodObject<{
|
|
56
58
|
secret: z.ZodString;
|
|
@@ -96,9 +98,9 @@ declare const totp2fa: (options?: TOTPOptions | undefined) => {
|
|
|
96
98
|
*
|
|
97
99
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#getting-totp-uri)
|
|
98
100
|
*/
|
|
99
|
-
getTOTPURI:
|
|
101
|
+
getTOTPURI: _$better_call0.StrictEndpoint<"/two-factor/get-totp-uri", {
|
|
100
102
|
method: "POST";
|
|
101
|
-
use:
|
|
103
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
102
104
|
session: {
|
|
103
105
|
session: Record<string, any> & {
|
|
104
106
|
id: string;
|
|
@@ -167,7 +169,7 @@ declare const totp2fa: (options?: TOTPOptions | undefined) => {
|
|
|
167
169
|
*
|
|
168
170
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#verifying-totp)
|
|
169
171
|
*/
|
|
170
|
-
verifyTOTP:
|
|
172
|
+
verifyTOTP: _$better_call0.StrictEndpoint<"/two-factor/verify-totp", {
|
|
171
173
|
method: "POST";
|
|
172
174
|
body: z.ZodObject<{
|
|
173
175
|
code: z.ZodString;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { User } from "../../types/models.mjs";
|
|
2
2
|
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
3
|
-
import "../../types/index.mjs";
|
|
4
3
|
import { BackupCodeOptions } from "./backup-codes/index.mjs";
|
|
5
4
|
import { OTPOptions } from "./otp/index.mjs";
|
|
6
5
|
import { schema } from "./schema.mjs";
|
|
7
6
|
import { TOTPOptions } from "./totp/index.mjs";
|
|
8
7
|
import { BetterAuthPlugin, LiteralString } from "@better-auth/core";
|
|
8
|
+
|
|
9
9
|
//#region src/plugins/two-factor/types.d.ts
|
|
10
10
|
interface TwoFactorOptions {
|
|
11
11
|
/**
|