better-auth 1.6.26 → 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 +508 -505
- package/dist/api/middlewares/authorization.d.mts +10 -14
- 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 +16 -13
- 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 +10 -8
- package/dist/api/routes/session.d.mts +32 -30
- package/dist/api/routes/session.mjs +2 -3
- 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 +5 -4
- package/dist/api/routes/update-user.d.mts +19 -18
- 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 +59 -46
- 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 +137 -132
- 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 +19 -15
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +8 -5
- 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 +76 -69
- 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 +45 -41
- 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 +12 -9
- 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 +6 -3
- 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 +12 -11
- 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 +12 -8
- 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 +20 -18
- 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 +7 -6
- 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 +33 -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 +147 -27
- package/dist/plugins/organization/routes/crud-invites.d.mts +186 -65
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +178 -56
- package/dist/plugins/organization/routes/crud-members.mjs +1 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +130 -57
- package/dist/plugins/organization/routes/crud-team.d.mts +235 -66
- 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 +7 -5
- 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 +36 -32
- package/dist/plugins/two-factor/otp/index.d.mts +4 -2
- package/dist/plugins/two-factor/totp/index.d.mts +7 -5
- 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 +12 -11
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { EmailOTPOptions } from "./types.mjs";
|
|
2
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
3
|
+
import * as _$_better_auth_core_db0 from "@better-auth/core/db";
|
|
4
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
5
|
+
import * as _$better_call0 from "better-call";
|
|
6
|
+
import * as _$zod from "zod";
|
|
7
|
+
import * as _$zod_v4_core0 from "zod/v4/core";
|
|
8
|
+
|
|
2
9
|
//#region src/plugins/email-otp/index.d.ts
|
|
3
10
|
declare module "@better-auth/core" {
|
|
4
11
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -10,11 +17,11 @@ declare module "@better-auth/core" {
|
|
|
10
17
|
declare const emailOTP: (options: EmailOTPOptions) => {
|
|
11
18
|
id: "email-otp";
|
|
12
19
|
version: string;
|
|
13
|
-
init(ctx:
|
|
20
|
+
init(ctx: _$_better_auth_core0.AuthContext): {
|
|
14
21
|
options: {
|
|
15
22
|
emailVerification: {
|
|
16
23
|
sendVerificationEmail(data: {
|
|
17
|
-
user:
|
|
24
|
+
user: _$_better_auth_core_db0.User;
|
|
18
25
|
url: string;
|
|
19
26
|
token: string;
|
|
20
27
|
}, request: Request | undefined): Promise<void>;
|
|
@@ -22,18 +29,18 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
22
29
|
};
|
|
23
30
|
} | undefined;
|
|
24
31
|
endpoints: {
|
|
25
|
-
sendVerificationOTP:
|
|
32
|
+
sendVerificationOTP: _$better_call0.StrictEndpoint<"/email-otp/send-verification-otp", {
|
|
26
33
|
method: "POST";
|
|
27
|
-
use: (
|
|
28
|
-
body:
|
|
29
|
-
email:
|
|
30
|
-
type:
|
|
34
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[];
|
|
35
|
+
body: _$zod.ZodObject<{
|
|
36
|
+
email: _$zod.ZodString;
|
|
37
|
+
type: _$zod.ZodEnum<{
|
|
31
38
|
"sign-in": "sign-in";
|
|
32
39
|
"change-email": "change-email";
|
|
33
40
|
"email-verification": "email-verification";
|
|
34
41
|
"forget-password": "forget-password";
|
|
35
42
|
}>;
|
|
36
|
-
},
|
|
43
|
+
}, _$zod_v4_core0.$strip>;
|
|
37
44
|
metadata: {
|
|
38
45
|
openapi: {
|
|
39
46
|
operationId: string;
|
|
@@ -60,17 +67,17 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
60
67
|
}, {
|
|
61
68
|
success: boolean;
|
|
62
69
|
}>;
|
|
63
|
-
createVerificationOTP:
|
|
70
|
+
createVerificationOTP: _$better_call0.StrictEndpoint<string, {
|
|
64
71
|
method: "POST";
|
|
65
|
-
body:
|
|
66
|
-
email:
|
|
67
|
-
type:
|
|
72
|
+
body: _$zod.ZodObject<{
|
|
73
|
+
email: _$zod.ZodString;
|
|
74
|
+
type: _$zod.ZodEnum<{
|
|
68
75
|
"sign-in": "sign-in";
|
|
69
76
|
"change-email": "change-email";
|
|
70
77
|
"email-verification": "email-verification";
|
|
71
78
|
"forget-password": "forget-password";
|
|
72
79
|
}>;
|
|
73
|
-
},
|
|
80
|
+
}, _$zod_v4_core0.$strip>;
|
|
74
81
|
metadata: {
|
|
75
82
|
openapi: {
|
|
76
83
|
operationId: string;
|
|
@@ -90,17 +97,17 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
90
97
|
};
|
|
91
98
|
};
|
|
92
99
|
}, string>;
|
|
93
|
-
getVerificationOTP:
|
|
100
|
+
getVerificationOTP: _$better_call0.StrictEndpoint<string, {
|
|
94
101
|
method: "GET";
|
|
95
|
-
query:
|
|
96
|
-
email:
|
|
97
|
-
type:
|
|
102
|
+
query: _$zod.ZodObject<{
|
|
103
|
+
email: _$zod.ZodString;
|
|
104
|
+
type: _$zod.ZodEnum<{
|
|
98
105
|
"sign-in": "sign-in";
|
|
99
106
|
"change-email": "change-email";
|
|
100
107
|
"email-verification": "email-verification";
|
|
101
108
|
"forget-password": "forget-password";
|
|
102
109
|
}>;
|
|
103
|
-
},
|
|
110
|
+
}, _$zod_v4_core0.$strip>;
|
|
104
111
|
metadata: {
|
|
105
112
|
openapi: {
|
|
106
113
|
operationId: string;
|
|
@@ -132,18 +139,18 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
132
139
|
} | {
|
|
133
140
|
otp: string;
|
|
134
141
|
}>;
|
|
135
|
-
checkVerificationOTP:
|
|
142
|
+
checkVerificationOTP: _$better_call0.StrictEndpoint<"/email-otp/check-verification-otp", {
|
|
136
143
|
method: "POST";
|
|
137
|
-
body:
|
|
138
|
-
email:
|
|
139
|
-
type:
|
|
144
|
+
body: _$zod.ZodObject<{
|
|
145
|
+
email: _$zod.ZodString;
|
|
146
|
+
type: _$zod.ZodEnum<{
|
|
140
147
|
"sign-in": "sign-in";
|
|
141
148
|
"change-email": "change-email";
|
|
142
149
|
"email-verification": "email-verification";
|
|
143
150
|
"forget-password": "forget-password";
|
|
144
151
|
}>;
|
|
145
|
-
otp:
|
|
146
|
-
},
|
|
152
|
+
otp: _$zod.ZodString;
|
|
153
|
+
}, _$zod_v4_core0.$strip>;
|
|
147
154
|
metadata: {
|
|
148
155
|
openapi: {
|
|
149
156
|
operationId: string;
|
|
@@ -170,12 +177,12 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
170
177
|
}, {
|
|
171
178
|
success: boolean;
|
|
172
179
|
}>;
|
|
173
|
-
verifyEmailOTP:
|
|
180
|
+
verifyEmailOTP: _$better_call0.StrictEndpoint<"/email-otp/verify-email", {
|
|
174
181
|
method: "POST";
|
|
175
|
-
body:
|
|
176
|
-
email:
|
|
177
|
-
otp:
|
|
178
|
-
},
|
|
182
|
+
body: _$zod.ZodObject<{
|
|
183
|
+
email: _$zod.ZodString;
|
|
184
|
+
otp: _$zod.ZodString;
|
|
185
|
+
}, _$zod_v4_core0.$strip>;
|
|
179
186
|
metadata: {
|
|
180
187
|
openapi: {
|
|
181
188
|
description: string;
|
|
@@ -234,14 +241,14 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
234
241
|
image?: string | null | undefined;
|
|
235
242
|
} & Record<string, any>;
|
|
236
243
|
}>;
|
|
237
|
-
signInEmailOTP:
|
|
244
|
+
signInEmailOTP: _$better_call0.StrictEndpoint<"/sign-in/email-otp", {
|
|
238
245
|
method: "POST";
|
|
239
|
-
body:
|
|
240
|
-
email:
|
|
241
|
-
otp:
|
|
242
|
-
name:
|
|
243
|
-
image:
|
|
244
|
-
},
|
|
246
|
+
body: _$zod.ZodIntersection<_$zod.ZodObject<{
|
|
247
|
+
email: _$zod.ZodString;
|
|
248
|
+
otp: _$zod.ZodString;
|
|
249
|
+
name: _$zod.ZodOptional<_$zod.ZodString>;
|
|
250
|
+
image: _$zod.ZodOptional<_$zod.ZodString>;
|
|
251
|
+
}, _$zod_v4_core0.$strip>, _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodAny>>;
|
|
245
252
|
metadata: {
|
|
246
253
|
openapi: {
|
|
247
254
|
operationId: string;
|
|
@@ -282,11 +289,11 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
282
289
|
image?: string | null | undefined;
|
|
283
290
|
};
|
|
284
291
|
}>;
|
|
285
|
-
requestPasswordResetEmailOTP:
|
|
292
|
+
requestPasswordResetEmailOTP: _$better_call0.StrictEndpoint<"/email-otp/request-password-reset", {
|
|
286
293
|
method: "POST";
|
|
287
|
-
body:
|
|
288
|
-
email:
|
|
289
|
-
},
|
|
294
|
+
body: _$zod.ZodObject<{
|
|
295
|
+
email: _$zod.ZodString;
|
|
296
|
+
}, _$zod_v4_core0.$strip>;
|
|
290
297
|
metadata: {
|
|
291
298
|
openapi: {
|
|
292
299
|
operationId: string;
|
|
@@ -314,11 +321,11 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
314
321
|
}, {
|
|
315
322
|
success: boolean;
|
|
316
323
|
}>;
|
|
317
|
-
forgetPasswordEmailOTP:
|
|
324
|
+
forgetPasswordEmailOTP: _$better_call0.StrictEndpoint<"/forget-password/email-otp", {
|
|
318
325
|
method: "POST";
|
|
319
|
-
body:
|
|
320
|
-
email:
|
|
321
|
-
},
|
|
326
|
+
body: _$zod.ZodObject<{
|
|
327
|
+
email: _$zod.ZodString;
|
|
328
|
+
}, _$zod_v4_core0.$strip>;
|
|
322
329
|
metadata: {
|
|
323
330
|
openapi: {
|
|
324
331
|
operationId: string;
|
|
@@ -346,13 +353,13 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
346
353
|
}, {
|
|
347
354
|
success: boolean;
|
|
348
355
|
}>;
|
|
349
|
-
resetPasswordEmailOTP:
|
|
356
|
+
resetPasswordEmailOTP: _$better_call0.StrictEndpoint<"/email-otp/reset-password", {
|
|
350
357
|
method: "POST";
|
|
351
|
-
body:
|
|
352
|
-
email:
|
|
353
|
-
otp:
|
|
354
|
-
password:
|
|
355
|
-
},
|
|
358
|
+
body: _$zod.ZodObject<{
|
|
359
|
+
email: _$zod.ZodString;
|
|
360
|
+
otp: _$zod.ZodString;
|
|
361
|
+
password: _$zod.ZodString;
|
|
362
|
+
}, _$zod_v4_core0.$strip>;
|
|
356
363
|
metadata: {
|
|
357
364
|
openapi: {
|
|
358
365
|
operationId: string;
|
|
@@ -379,13 +386,13 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
379
386
|
}, {
|
|
380
387
|
success: boolean;
|
|
381
388
|
}>;
|
|
382
|
-
requestEmailChangeEmailOTP:
|
|
389
|
+
requestEmailChangeEmailOTP: _$better_call0.StrictEndpoint<"/email-otp/request-email-change", {
|
|
383
390
|
method: "POST";
|
|
384
|
-
body:
|
|
385
|
-
newEmail:
|
|
386
|
-
otp:
|
|
387
|
-
},
|
|
388
|
-
use: (
|
|
391
|
+
body: _$zod.ZodObject<{
|
|
392
|
+
newEmail: _$zod.ZodString;
|
|
393
|
+
otp: _$zod.ZodOptional<_$zod.ZodString>;
|
|
394
|
+
}, _$zod_v4_core0.$strip>;
|
|
395
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
389
396
|
session: {
|
|
390
397
|
session: Record<string, any> & {
|
|
391
398
|
id: string;
|
|
@@ -407,7 +414,7 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
407
414
|
image?: string | null | undefined;
|
|
408
415
|
};
|
|
409
416
|
};
|
|
410
|
-
}
|
|
417
|
+
}>>[];
|
|
411
418
|
metadata: {
|
|
412
419
|
openapi: {
|
|
413
420
|
operationId: string;
|
|
@@ -434,13 +441,13 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
434
441
|
}, {
|
|
435
442
|
success: boolean;
|
|
436
443
|
}>;
|
|
437
|
-
changeEmailEmailOTP:
|
|
444
|
+
changeEmailEmailOTP: _$better_call0.StrictEndpoint<"/email-otp/change-email", {
|
|
438
445
|
method: "POST";
|
|
439
|
-
body:
|
|
440
|
-
newEmail:
|
|
441
|
-
otp:
|
|
442
|
-
},
|
|
443
|
-
use: (
|
|
446
|
+
body: _$zod.ZodObject<{
|
|
447
|
+
newEmail: _$zod.ZodString;
|
|
448
|
+
otp: _$zod.ZodString;
|
|
449
|
+
}, _$zod_v4_core0.$strip>;
|
|
450
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
444
451
|
session: {
|
|
445
452
|
session: Record<string, any> & {
|
|
446
453
|
id: string;
|
|
@@ -462,7 +469,7 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
462
469
|
image?: string | null | undefined;
|
|
463
470
|
};
|
|
464
471
|
};
|
|
465
|
-
}
|
|
472
|
+
}>>[];
|
|
466
473
|
metadata: {
|
|
467
474
|
openapi: {
|
|
468
475
|
operationId: string;
|
|
@@ -492,8 +499,8 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
492
499
|
};
|
|
493
500
|
hooks: {
|
|
494
501
|
after: {
|
|
495
|
-
matcher(context:
|
|
496
|
-
handler: (inputContext:
|
|
502
|
+
matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
|
|
503
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
497
504
|
}[];
|
|
498
505
|
};
|
|
499
506
|
rateLimit: ({
|
|
@@ -535,9 +542,9 @@ declare const emailOTP: (options: EmailOTPOptions) => {
|
|
|
535
542
|
})[];
|
|
536
543
|
options: EmailOTPOptions;
|
|
537
544
|
$ERROR_CODES: {
|
|
538
|
-
OTP_EXPIRED:
|
|
539
|
-
INVALID_OTP:
|
|
540
|
-
TOO_MANY_ATTEMPTS:
|
|
545
|
+
OTP_EXPIRED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_EXPIRED">;
|
|
546
|
+
INVALID_OTP: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_OTP">;
|
|
547
|
+
TOO_MANY_ATTEMPTS: _$_better_auth_core_utils_error_codes0.RawError<"TOO_MANY_ATTEMPTS">;
|
|
541
548
|
};
|
|
542
549
|
};
|
|
543
550
|
//#endregion
|
|
@@ -9,24 +9,25 @@ import { OktaOptions, okta } from "./providers/okta.mjs";
|
|
|
9
9
|
import { PatreonOptions, patreon } from "./providers/patreon.mjs";
|
|
10
10
|
import { SlackOptions, slack } from "./providers/slack.mjs";
|
|
11
11
|
import { YandexOptions, yandex } from "./providers/yandex.mjs";
|
|
12
|
-
import "./providers/index.mjs";
|
|
13
12
|
import { BaseOAuthProviderOptions, genericOAuth } from "./index.mjs";
|
|
14
13
|
import { GENERIC_OAUTH_ERROR_CODES } from "./error-codes.mjs";
|
|
14
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
15
|
+
|
|
15
16
|
//#region src/plugins/generic-oauth/client.d.ts
|
|
16
17
|
declare const genericOAuthClient: () => {
|
|
17
18
|
id: "generic-oauth-client";
|
|
18
19
|
version: string;
|
|
19
20
|
$InferServerPlugin: ReturnType<typeof genericOAuth>;
|
|
20
21
|
$ERROR_CODES: {
|
|
21
|
-
INVALID_OAUTH_CONFIGURATION:
|
|
22
|
-
TOKEN_URL_NOT_FOUND:
|
|
23
|
-
PROVIDER_CONFIG_NOT_FOUND:
|
|
24
|
-
PROVIDER_ID_REQUIRED:
|
|
25
|
-
INVALID_OAUTH_CONFIG:
|
|
26
|
-
SESSION_REQUIRED:
|
|
27
|
-
ISSUER_MISMATCH:
|
|
28
|
-
ISSUER_MISSING:
|
|
22
|
+
INVALID_OAUTH_CONFIGURATION: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_OAUTH_CONFIGURATION">;
|
|
23
|
+
TOKEN_URL_NOT_FOUND: _$_better_auth_core_utils_error_codes0.RawError<"TOKEN_URL_NOT_FOUND">;
|
|
24
|
+
PROVIDER_CONFIG_NOT_FOUND: _$_better_auth_core_utils_error_codes0.RawError<"PROVIDER_CONFIG_NOT_FOUND">;
|
|
25
|
+
PROVIDER_ID_REQUIRED: _$_better_auth_core_utils_error_codes0.RawError<"PROVIDER_ID_REQUIRED">;
|
|
26
|
+
INVALID_OAUTH_CONFIG: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_OAUTH_CONFIG">;
|
|
27
|
+
SESSION_REQUIRED: _$_better_auth_core_utils_error_codes0.RawError<"SESSION_REQUIRED">;
|
|
28
|
+
ISSUER_MISMATCH: _$_better_auth_core_utils_error_codes0.RawError<"ISSUER_MISMATCH">;
|
|
29
|
+
ISSUER_MISSING: _$_better_auth_core_utils_error_codes0.RawError<"ISSUER_MISSING">;
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
32
|
//#endregion
|
|
32
|
-
export {
|
|
33
|
+
export { genericOAuthClient };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
1
3
|
//#region src/plugins/generic-oauth/error-codes.d.ts
|
|
2
4
|
declare const GENERIC_OAUTH_ERROR_CODES: {
|
|
3
|
-
INVALID_OAUTH_CONFIGURATION:
|
|
4
|
-
TOKEN_URL_NOT_FOUND:
|
|
5
|
-
PROVIDER_CONFIG_NOT_FOUND:
|
|
6
|
-
PROVIDER_ID_REQUIRED:
|
|
7
|
-
INVALID_OAUTH_CONFIG:
|
|
8
|
-
SESSION_REQUIRED:
|
|
9
|
-
ISSUER_MISMATCH:
|
|
10
|
-
ISSUER_MISSING:
|
|
5
|
+
INVALID_OAUTH_CONFIGURATION: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_OAUTH_CONFIGURATION">;
|
|
6
|
+
TOKEN_URL_NOT_FOUND: _$_better_auth_core_utils_error_codes0.RawError<"TOKEN_URL_NOT_FOUND">;
|
|
7
|
+
PROVIDER_CONFIG_NOT_FOUND: _$_better_auth_core_utils_error_codes0.RawError<"PROVIDER_CONFIG_NOT_FOUND">;
|
|
8
|
+
PROVIDER_ID_REQUIRED: _$_better_auth_core_utils_error_codes0.RawError<"PROVIDER_ID_REQUIRED">;
|
|
9
|
+
INVALID_OAUTH_CONFIG: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_OAUTH_CONFIG">;
|
|
10
|
+
SESSION_REQUIRED: _$_better_auth_core_utils_error_codes0.RawError<"SESSION_REQUIRED">;
|
|
11
|
+
ISSUER_MISMATCH: _$_better_auth_core_utils_error_codes0.RawError<"ISSUER_MISMATCH">;
|
|
12
|
+
ISSUER_MISSING: _$_better_auth_core_utils_error_codes0.RawError<"ISSUER_MISSING">;
|
|
11
13
|
};
|
|
12
14
|
//#endregion
|
|
13
15
|
export { GENERIC_OAUTH_ERROR_CODES };
|
|
@@ -9,9 +9,14 @@ import { OktaOptions, okta } from "./providers/okta.mjs";
|
|
|
9
9
|
import { PatreonOptions, patreon } from "./providers/patreon.mjs";
|
|
10
10
|
import { SlackOptions, slack } from "./providers/slack.mjs";
|
|
11
11
|
import { YandexOptions, yandex } from "./providers/yandex.mjs";
|
|
12
|
-
import "./providers/index.mjs";
|
|
13
12
|
import { AuthContext } from "@better-auth/core";
|
|
13
|
+
import * as _$_better_auth_core_oauth20 from "@better-auth/core/oauth2";
|
|
14
14
|
import { OAuthProvider } from "@better-auth/core/oauth2";
|
|
15
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
16
|
+
import * as _$better_call0 from "better-call";
|
|
17
|
+
import * as _$zod from "zod";
|
|
18
|
+
import * as _$zod_v4_core0 from "zod/v4/core";
|
|
19
|
+
|
|
15
20
|
//#region src/plugins/generic-oauth/index.d.ts
|
|
16
21
|
declare module "@better-auth/core" {
|
|
17
22
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -25,8 +30,7 @@ declare module "@better-auth/core" {
|
|
|
25
30
|
* Extracts common fields from GenericOAuthConfig and makes clientSecret required.
|
|
26
31
|
*/
|
|
27
32
|
type BaseOAuthProviderOptions = Omit<Pick<GenericOAuthConfig, "clientId" | "clientSecret" | "scopes" | "redirectURI" | "pkce" | "disableImplicitSignUp" | "disableSignUp" | "overrideUserInfo">, "clientSecret"> & {
|
|
28
|
-
/** OAuth client secret (required for provider options) */
|
|
29
|
-
clientSecret: string;
|
|
33
|
+
/** OAuth client secret (required for provider options) */clientSecret: string;
|
|
30
34
|
};
|
|
31
35
|
/**
|
|
32
36
|
* A generic OAuth plugin that can be used to add OAuth support to any provider
|
|
@@ -36,22 +40,22 @@ declare const genericOAuth: (options: GenericOAuthOptions) => {
|
|
|
36
40
|
version: string;
|
|
37
41
|
init: (ctx: AuthContext) => {
|
|
38
42
|
context: {
|
|
39
|
-
socialProviders: OAuthProvider<Record<string, any>, Partial<
|
|
43
|
+
socialProviders: OAuthProvider<Record<string, any>, Partial<_$_better_auth_core_oauth20.ProviderOptions<any>>>[];
|
|
40
44
|
};
|
|
41
45
|
};
|
|
42
46
|
endpoints: {
|
|
43
|
-
signInWithOAuth2:
|
|
47
|
+
signInWithOAuth2: _$better_call0.StrictEndpoint<"/sign-in/oauth2", {
|
|
44
48
|
method: "POST";
|
|
45
|
-
body:
|
|
46
|
-
providerId:
|
|
47
|
-
callbackURL:
|
|
48
|
-
errorCallbackURL:
|
|
49
|
-
newUserCallbackURL:
|
|
50
|
-
disableRedirect:
|
|
51
|
-
scopes:
|
|
52
|
-
requestSignUp:
|
|
53
|
-
additionalData:
|
|
54
|
-
},
|
|
49
|
+
body: _$zod.ZodObject<{
|
|
50
|
+
providerId: _$zod.ZodString;
|
|
51
|
+
callbackURL: _$zod.ZodOptional<_$zod.ZodString>;
|
|
52
|
+
errorCallbackURL: _$zod.ZodOptional<_$zod.ZodString>;
|
|
53
|
+
newUserCallbackURL: _$zod.ZodOptional<_$zod.ZodString>;
|
|
54
|
+
disableRedirect: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
55
|
+
scopes: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
56
|
+
requestSignUp: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
57
|
+
additionalData: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodAny>>;
|
|
58
|
+
}, _$zod_v4_core0.$strip>;
|
|
55
59
|
metadata: {
|
|
56
60
|
openapi: {
|
|
57
61
|
description: string;
|
|
@@ -81,15 +85,15 @@ declare const genericOAuth: (options: GenericOAuthOptions) => {
|
|
|
81
85
|
url: string;
|
|
82
86
|
redirect: boolean;
|
|
83
87
|
}>;
|
|
84
|
-
oAuth2Callback:
|
|
88
|
+
oAuth2Callback: _$better_call0.StrictEndpoint<"/oauth2/callback/:providerId", {
|
|
85
89
|
method: "GET";
|
|
86
|
-
query:
|
|
87
|
-
code:
|
|
88
|
-
error:
|
|
89
|
-
error_description:
|
|
90
|
-
state:
|
|
91
|
-
iss:
|
|
92
|
-
},
|
|
90
|
+
query: _$zod.ZodObject<{
|
|
91
|
+
code: _$zod.ZodOptional<_$zod.ZodString>;
|
|
92
|
+
error: _$zod.ZodOptional<_$zod.ZodString>;
|
|
93
|
+
error_description: _$zod.ZodOptional<_$zod.ZodString>;
|
|
94
|
+
state: _$zod.ZodOptional<_$zod.ZodString>;
|
|
95
|
+
iss: _$zod.ZodOptional<_$zod.ZodString>;
|
|
96
|
+
}, _$zod_v4_core0.$strip>;
|
|
93
97
|
metadata: {
|
|
94
98
|
allowedMediaTypes: string[];
|
|
95
99
|
openapi: {
|
|
@@ -115,15 +119,15 @@ declare const genericOAuth: (options: GenericOAuthOptions) => {
|
|
|
115
119
|
scope: "server";
|
|
116
120
|
};
|
|
117
121
|
}, never>;
|
|
118
|
-
oAuth2LinkAccount:
|
|
122
|
+
oAuth2LinkAccount: _$better_call0.StrictEndpoint<"/oauth2/link", {
|
|
119
123
|
method: "POST";
|
|
120
|
-
body:
|
|
121
|
-
providerId:
|
|
122
|
-
callbackURL:
|
|
123
|
-
scopes:
|
|
124
|
-
errorCallbackURL:
|
|
125
|
-
},
|
|
126
|
-
use: (
|
|
124
|
+
body: _$zod.ZodObject<{
|
|
125
|
+
providerId: _$zod.ZodString;
|
|
126
|
+
callbackURL: _$zod.ZodString;
|
|
127
|
+
scopes: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
128
|
+
errorCallbackURL: _$zod.ZodOptional<_$zod.ZodString>;
|
|
129
|
+
}, _$zod_v4_core0.$strip>;
|
|
130
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
127
131
|
session: {
|
|
128
132
|
session: Record<string, any> & {
|
|
129
133
|
id: string;
|
|
@@ -145,7 +149,7 @@ declare const genericOAuth: (options: GenericOAuthOptions) => {
|
|
|
145
149
|
image?: string | null | undefined;
|
|
146
150
|
};
|
|
147
151
|
};
|
|
148
|
-
}
|
|
152
|
+
}>>[];
|
|
149
153
|
metadata: {
|
|
150
154
|
openapi: {
|
|
151
155
|
description: string;
|
|
@@ -183,15 +187,15 @@ declare const genericOAuth: (options: GenericOAuthOptions) => {
|
|
|
183
187
|
};
|
|
184
188
|
options: GenericOAuthOptions;
|
|
185
189
|
$ERROR_CODES: {
|
|
186
|
-
INVALID_OAUTH_CONFIGURATION:
|
|
187
|
-
TOKEN_URL_NOT_FOUND:
|
|
188
|
-
PROVIDER_CONFIG_NOT_FOUND:
|
|
189
|
-
PROVIDER_ID_REQUIRED:
|
|
190
|
-
INVALID_OAUTH_CONFIG:
|
|
191
|
-
SESSION_REQUIRED:
|
|
192
|
-
ISSUER_MISMATCH:
|
|
193
|
-
ISSUER_MISSING:
|
|
190
|
+
INVALID_OAUTH_CONFIGURATION: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_OAUTH_CONFIGURATION">;
|
|
191
|
+
TOKEN_URL_NOT_FOUND: _$_better_auth_core_utils_error_codes0.RawError<"TOKEN_URL_NOT_FOUND">;
|
|
192
|
+
PROVIDER_CONFIG_NOT_FOUND: _$_better_auth_core_utils_error_codes0.RawError<"PROVIDER_CONFIG_NOT_FOUND">;
|
|
193
|
+
PROVIDER_ID_REQUIRED: _$_better_auth_core_utils_error_codes0.RawError<"PROVIDER_ID_REQUIRED">;
|
|
194
|
+
INVALID_OAUTH_CONFIG: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_OAUTH_CONFIG">;
|
|
195
|
+
SESSION_REQUIRED: _$_better_auth_core_utils_error_codes0.RawError<"SESSION_REQUIRED">;
|
|
196
|
+
ISSUER_MISMATCH: _$_better_auth_core_utils_error_codes0.RawError<"ISSUER_MISMATCH">;
|
|
197
|
+
ISSUER_MISSING: _$_better_auth_core_utils_error_codes0.RawError<"ISSUER_MISSING">;
|
|
194
198
|
};
|
|
195
199
|
};
|
|
196
200
|
//#endregion
|
|
197
|
-
export {
|
|
201
|
+
export { Auth0Options, BaseOAuthProviderOptions, type GenericOAuthConfig, type GenericOAuthOptions, GumroadOptions, HubSpotOptions, KeycloakOptions, LineOptions, MicrosoftEntraIdOptions, OktaOptions, PatreonOptions, SlackOptions, YandexOptions, auth0, genericOAuth, gumroad, hubspot, keycloak, line, microsoftEntraId, okta, patreon, slack, yandex };
|
|
@@ -7,5 +7,4 @@ import { MicrosoftEntraIdOptions, microsoftEntraId } from "./microsoft-entra-id.
|
|
|
7
7
|
import { OktaOptions, okta } from "./okta.mjs";
|
|
8
8
|
import { PatreonOptions, patreon } from "./patreon.mjs";
|
|
9
9
|
import { SlackOptions, slack } from "./slack.mjs";
|
|
10
|
-
import { YandexOptions, yandex } from "./yandex.mjs";
|
|
11
|
-
export { type Auth0Options, type GumroadOptions, type HubSpotOptions, type KeycloakOptions, type LineOptions, type MicrosoftEntraIdOptions, type OktaOptions, type PatreonOptions, type SlackOptions, type YandexOptions, auth0, gumroad, hubspot, keycloak, line, microsoftEntraId, okta, patreon, slack, yandex };
|
|
10
|
+
import { YandexOptions, yandex } from "./yandex.mjs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
2
2
|
import { User } from "@better-auth/core/db";
|
|
3
3
|
import { OAuth2Tokens, OAuth2UserInfo } from "@better-auth/core/oauth2";
|
|
4
|
+
|
|
4
5
|
//#region src/plugins/generic-oauth/types.d.ts
|
|
5
6
|
interface GenericOAuthOptions {
|
|
6
7
|
/**
|
|
@@ -69,7 +70,7 @@ interface GenericOAuthConfig {
|
|
|
69
70
|
responseType?: string | undefined;
|
|
70
71
|
/**
|
|
71
72
|
* The response mode to use for the authorization code request.
|
|
72
|
-
|
|
73
|
+
*/
|
|
73
74
|
responseMode?: ("query" | "form_post") | undefined;
|
|
74
75
|
/**
|
|
75
76
|
* Prompt parameter for the authorization request.
|