better-auth 1.2.6-beta.4 → 1.2.6-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/drizzle-adapter/index.d.cts +1 -1
- package/dist/adapters/drizzle-adapter/index.d.mts +1 -1
- package/dist/adapters/drizzle-adapter/index.d.ts +1 -1
- package/dist/adapters/kysely-adapter/index.d.cts +1 -1
- package/dist/adapters/kysely-adapter/index.d.mts +1 -1
- package/dist/adapters/kysely-adapter/index.d.ts +1 -1
- package/dist/adapters/memory-adapter/index.d.cts +1 -1
- package/dist/adapters/memory-adapter/index.d.mts +1 -1
- package/dist/adapters/memory-adapter/index.d.ts +1 -1
- package/dist/adapters/mongodb-adapter/index.d.cts +1 -1
- package/dist/adapters/mongodb-adapter/index.d.mts +1 -1
- package/dist/adapters/mongodb-adapter/index.d.ts +1 -1
- package/dist/adapters/prisma-adapter/index.d.cts +1 -1
- package/dist/adapters/prisma-adapter/index.d.mts +1 -1
- package/dist/adapters/prisma-adapter/index.d.ts +1 -1
- package/dist/adapters/test.d.cts +1 -1
- package/dist/adapters/test.d.mts +1 -1
- package/dist/adapters/test.d.ts +1 -1
- package/dist/api/index.cjs +2 -2
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.mjs +3 -3
- package/dist/client/index.d.cts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/plugins/index.d.cts +2 -2
- package/dist/client/plugins/index.d.mts +2 -2
- package/dist/client/plugins/index.d.ts +2 -2
- package/dist/client/react/index.d.cts +1 -1
- package/dist/client/react/index.d.mts +1 -1
- package/dist/client/react/index.d.ts +1 -1
- package/dist/client/solid/index.d.cts +1 -1
- package/dist/client/solid/index.d.mts +1 -1
- package/dist/client/solid/index.d.ts +1 -1
- package/dist/client/svelte/index.d.cts +1 -1
- package/dist/client/svelte/index.d.mts +1 -1
- package/dist/client/svelte/index.d.ts +1 -1
- package/dist/client/vue/index.d.cts +1 -1
- package/dist/client/vue/index.d.mts +1 -1
- package/dist/client/vue/index.d.ts +1 -1
- package/dist/cookies/index.d.cts +1 -1
- package/dist/cookies/index.d.mts +1 -1
- package/dist/cookies/index.d.ts +1 -1
- package/dist/db/index.d.cts +2 -2
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.d.ts +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/integrations/next-js.cjs +4 -4
- package/dist/integrations/next-js.d.cts +1 -1
- package/dist/integrations/next-js.d.mts +1 -1
- package/dist/integrations/next-js.d.ts +1 -1
- package/dist/integrations/next-js.mjs +4 -4
- package/dist/integrations/node.d.cts +1 -1
- package/dist/integrations/node.d.mts +1 -1
- package/dist/integrations/node.d.ts +1 -1
- package/dist/integrations/svelte-kit.d.cts +1 -1
- package/dist/integrations/svelte-kit.d.mts +1 -1
- package/dist/integrations/svelte-kit.d.ts +1 -1
- package/dist/oauth2/index.cjs +2 -1
- package/dist/oauth2/index.d.cts +4 -3
- package/dist/oauth2/index.d.mts +4 -3
- package/dist/oauth2/index.d.ts +4 -3
- package/dist/oauth2/index.mjs +1 -1
- package/dist/plugins/admin/index.cjs +3 -3
- package/dist/plugins/admin/index.d.cts +284 -642
- package/dist/plugins/admin/index.d.mts +284 -642
- package/dist/plugins/admin/index.d.ts +284 -642
- package/dist/plugins/admin/index.mjs +3 -3
- package/dist/plugins/anonymous/index.cjs +2 -2
- package/dist/plugins/anonymous/index.d.cts +21 -34
- package/dist/plugins/anonymous/index.d.mts +21 -34
- package/dist/plugins/anonymous/index.d.ts +21 -34
- package/dist/plugins/anonymous/index.mjs +2 -2
- package/dist/plugins/bearer/index.cjs +2 -2
- package/dist/plugins/bearer/index.d.cts +1 -1
- package/dist/plugins/bearer/index.d.mts +1 -1
- package/dist/plugins/bearer/index.d.ts +1 -1
- package/dist/plugins/bearer/index.mjs +2 -2
- package/dist/plugins/custom-session/index.cjs +17 -6
- package/dist/plugins/custom-session/index.d.cts +23 -24
- package/dist/plugins/custom-session/index.d.mts +23 -24
- package/dist/plugins/custom-session/index.d.ts +23 -24
- package/dist/plugins/custom-session/index.mjs +17 -6
- package/dist/plugins/email-otp/index.cjs +2 -2
- package/dist/plugins/email-otp/index.d.cts +141 -260
- package/dist/plugins/email-otp/index.d.mts +141 -260
- package/dist/plugins/email-otp/index.d.ts +141 -260
- package/dist/plugins/email-otp/index.mjs +2 -2
- package/dist/plugins/generic-oauth/index.cjs +5 -6
- package/dist/plugins/generic-oauth/index.d.cts +64 -131
- package/dist/plugins/generic-oauth/index.d.mts +64 -131
- package/dist/plugins/generic-oauth/index.d.ts +64 -131
- package/dist/plugins/generic-oauth/index.mjs +5 -6
- package/dist/plugins/index.cjs +45 -13
- package/dist/plugins/index.d.cts +3 -3
- package/dist/plugins/index.d.mts +3 -3
- package/dist/plugins/index.d.ts +3 -3
- package/dist/plugins/index.mjs +45 -14
- package/dist/plugins/jwt/index.cjs +2 -2
- package/dist/plugins/jwt/index.d.cts +41 -108
- package/dist/plugins/jwt/index.d.mts +41 -108
- package/dist/plugins/jwt/index.d.ts +41 -108
- package/dist/plugins/jwt/index.mjs +2 -2
- package/dist/plugins/magic-link/index.cjs +2 -2
- package/dist/plugins/magic-link/index.d.cts +40 -82
- package/dist/plugins/magic-link/index.d.mts +40 -82
- package/dist/plugins/magic-link/index.d.ts +40 -82
- package/dist/plugins/magic-link/index.mjs +2 -2
- package/dist/plugins/multi-session/index.cjs +2 -2
- package/dist/plugins/multi-session/index.d.cts +61 -128
- package/dist/plugins/multi-session/index.d.mts +61 -128
- package/dist/plugins/multi-session/index.d.ts +61 -128
- package/dist/plugins/multi-session/index.mjs +2 -2
- package/dist/plugins/oauth-proxy/index.cjs +2 -2
- package/dist/plugins/oauth-proxy/index.d.cts +21 -41
- package/dist/plugins/oauth-proxy/index.d.mts +21 -41
- package/dist/plugins/oauth-proxy/index.d.ts +21 -41
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/index.cjs +2 -2
- package/dist/plugins/oidc-provider/index.d.cts +145 -158
- package/dist/plugins/oidc-provider/index.d.mts +145 -158
- package/dist/plugins/oidc-provider/index.d.ts +145 -158
- package/dist/plugins/oidc-provider/index.mjs +2 -2
- package/dist/plugins/one-tap/index.cjs +2 -2
- package/dist/plugins/one-tap/index.d.cts +20 -42
- package/dist/plugins/one-tap/index.d.mts +20 -42
- package/dist/plugins/one-tap/index.d.ts +20 -42
- package/dist/plugins/one-tap/index.mjs +2 -2
- package/dist/plugins/open-api/index.cjs +4 -2
- package/dist/plugins/open-api/index.d.cts +41 -20
- package/dist/plugins/open-api/index.d.mts +41 -20
- package/dist/plugins/open-api/index.d.ts +41 -20
- package/dist/plugins/open-api/index.mjs +4 -2
- package/dist/plugins/organization/index.cjs +3 -3
- package/dist/plugins/organization/index.d.cts +2143 -3685
- package/dist/plugins/organization/index.d.mts +2143 -3685
- package/dist/plugins/organization/index.d.ts +2143 -3685
- package/dist/plugins/organization/index.mjs +3 -3
- package/dist/plugins/passkey/index.cjs +2 -2
- package/dist/plugins/passkey/index.d.cts +146 -464
- package/dist/plugins/passkey/index.d.mts +146 -464
- package/dist/plugins/passkey/index.d.ts +146 -464
- package/dist/plugins/passkey/index.mjs +2 -2
- package/dist/plugins/phone-number/index.cjs +2 -2
- package/dist/plugins/phone-number/index.d.cts +103 -178
- package/dist/plugins/phone-number/index.d.mts +103 -178
- package/dist/plugins/phone-number/index.d.ts +103 -178
- package/dist/plugins/phone-number/index.mjs +2 -2
- package/dist/plugins/sso/index.cjs +3 -3
- package/dist/plugins/sso/index.d.cts +63 -206
- package/dist/plugins/sso/index.d.mts +63 -206
- package/dist/plugins/sso/index.d.ts +63 -206
- package/dist/plugins/sso/index.mjs +3 -3
- package/dist/plugins/two-factor/index.cjs +7 -5
- package/dist/plugins/two-factor/index.d.cts +238 -725
- package/dist/plugins/two-factor/index.d.mts +238 -725
- package/dist/plugins/two-factor/index.d.ts +238 -725
- package/dist/plugins/two-factor/index.mjs +7 -6
- package/dist/plugins/username/index.cjs +4 -4
- package/dist/plugins/username/index.d.cts +21 -44
- package/dist/plugins/username/index.d.mts +21 -44
- package/dist/plugins/username/index.d.ts +21 -44
- package/dist/plugins/username/index.mjs +4 -4
- package/dist/shared/{better-auth.-X_5SIE9.d.ts → better-auth.2p1C52nv.d.ts} +3 -3
- package/dist/shared/{better-auth.BsbUy_em.d.cts → better-auth.BArzzn5a.d.cts} +5354 -7954
- package/dist/shared/{better-auth.CjhKonVM.d.mts → better-auth.BDKSU3Dg.d.mts} +146 -205
- package/dist/shared/{better-auth.Dy3T8VFf.cjs → better-auth.BDYXUcLv.cjs} +1 -1
- package/dist/shared/{better-auth.BLFZHn6S.d.cts → better-auth.C5A8Vzv0.d.cts} +146 -205
- package/dist/shared/{better-auth.BVu0qf-P.mjs → better-auth.CFzfx-2c.mjs} +1 -1
- package/dist/shared/{better-auth.D5DEHFvt.cjs → better-auth.CN1HkXUY.cjs} +1 -1
- package/dist/shared/{better-auth.CXagCPAv.cjs → better-auth.CPKJJalM.cjs} +4 -4
- package/dist/shared/{better-auth.CsqL1BAE.mjs → better-auth.ClTSOgiD.mjs} +1 -1
- package/dist/shared/{better-auth.BLV8UOn8.cjs → better-auth.Cm29ZKNJ.cjs} +4 -2
- package/dist/shared/{better-auth.Bhu3YSmJ.mjs → better-auth.CmHTEIYA.mjs} +4 -4
- package/dist/shared/{better-auth.i71gRg2g.d.ts → better-auth.CouMuYtz.d.ts} +5354 -7954
- package/dist/shared/{better-auth.ulRwlmfz.d.ts → better-auth.CvCI1gIa.d.ts} +146 -205
- package/dist/shared/{better-auth.XIJlJT9f.mjs → better-auth.D4jH-sJA.mjs} +2 -2
- package/dist/shared/{better-auth.B5Z63CQV.d.mts → better-auth.DCCen_rd.d.mts} +5354 -7954
- package/dist/shared/{better-auth.B2THyVQH.mjs → better-auth.DCVeP5-W.mjs} +4 -3
- package/dist/shared/{better-auth.DkJ_Tcxu.d.cts → better-auth.Dy54W_9o.d.cts} +3 -3
- package/dist/shared/{better-auth.BGAbPcLi.d.mts → better-auth.YLWLGLEW.d.mts} +3 -3
- package/dist/shared/{better-auth.USxghgYQ.cjs → better-auth.m575EIBC.cjs} +1 -1
- package/dist/social-providers/index.cjs +1 -1
- package/dist/social-providers/index.mjs +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { U as User, I as InferOptionSchema, d as AuthEndpoint,
|
|
3
|
+
import { U as User, I as InferOptionSchema, d as AuthEndpoint, S as Session, G as GenericEndpointContext, H as HookEndpointContext } from '../../shared/better-auth.BArzzn5a.cjs';
|
|
4
4
|
import { L as LiteralString } from '../../shared/better-auth.Bi8FQwDD.cjs';
|
|
5
5
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
6
6
|
import '../../shared/better-auth.DpnaS1Ry.cjs';
|
|
@@ -168,6 +168,15 @@ interface TwoFactorTable {
|
|
|
168
168
|
enabled: boolean;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
declare const TWO_FACTOR_ERROR_CODES: {
|
|
172
|
+
readonly OTP_NOT_ENABLED: "OTP not enabled";
|
|
173
|
+
readonly OTP_HAS_EXPIRED: "OTP has expired";
|
|
174
|
+
readonly TOTP_NOT_ENABLED: "TOTP not enabled";
|
|
175
|
+
readonly TWO_FACTOR_NOT_ENABLED: "Two factor isn't enabled";
|
|
176
|
+
readonly BACKUP_CODES_NOT_ENABLED: "Backup codes aren't enabled";
|
|
177
|
+
readonly INVALID_BACKUP_CODE: "Invalid backup code";
|
|
178
|
+
};
|
|
179
|
+
|
|
171
180
|
declare const twoFactorClient: (options?: {
|
|
172
181
|
/**
|
|
173
182
|
* a redirect function to call if a user needs to verify
|
|
@@ -200,76 +209,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
200
209
|
id: "two-factor";
|
|
201
210
|
endpoints: {
|
|
202
211
|
enableTwoFactor: {
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
body: z.ZodObject<{
|
|
206
|
-
password: z.ZodString;
|
|
207
|
-
}, "strip", z.ZodTypeAny, {
|
|
208
|
-
password: string;
|
|
209
|
-
}, {
|
|
212
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
213
|
+
body: {
|
|
210
214
|
password: string;
|
|
211
|
-
}>;
|
|
212
|
-
use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
|
|
213
|
-
session: {
|
|
214
|
-
session: Record<string, any> & {
|
|
215
|
-
id: string;
|
|
216
|
-
createdAt: Date;
|
|
217
|
-
updatedAt: Date;
|
|
218
|
-
userId: string;
|
|
219
|
-
expiresAt: Date;
|
|
220
|
-
token: string;
|
|
221
|
-
ipAddress?: string | null | undefined;
|
|
222
|
-
userAgent?: string | null | undefined;
|
|
223
|
-
};
|
|
224
|
-
user: Record<string, any> & {
|
|
225
|
-
id: string;
|
|
226
|
-
name: string;
|
|
227
|
-
email: string;
|
|
228
|
-
emailVerified: boolean;
|
|
229
|
-
createdAt: Date;
|
|
230
|
-
updatedAt: Date;
|
|
231
|
-
image?: string | null | undefined;
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
}>)[];
|
|
235
|
-
metadata: {
|
|
236
|
-
openapi: {
|
|
237
|
-
summary: string;
|
|
238
|
-
description: string;
|
|
239
|
-
responses: {
|
|
240
|
-
200: {
|
|
241
|
-
description: string;
|
|
242
|
-
content: {
|
|
243
|
-
"application/json": {
|
|
244
|
-
schema: {
|
|
245
|
-
type: "object";
|
|
246
|
-
properties: {
|
|
247
|
-
totpURI: {
|
|
248
|
-
type: string;
|
|
249
|
-
description: string;
|
|
250
|
-
};
|
|
251
|
-
backupCodes: {
|
|
252
|
-
type: string;
|
|
253
|
-
items: {
|
|
254
|
-
type: string;
|
|
255
|
-
};
|
|
256
|
-
description: string;
|
|
257
|
-
};
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
};
|
|
261
|
-
};
|
|
262
|
-
};
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
215
|
};
|
|
266
216
|
} & {
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
}
|
|
217
|
+
method?: "POST" | undefined;
|
|
218
|
+
} & {
|
|
219
|
+
query?: Record<string, any> | undefined;
|
|
220
|
+
} & {
|
|
221
|
+
params?: Record<string, any>;
|
|
222
|
+
} & {
|
|
223
|
+
request?: Request;
|
|
224
|
+
} & {
|
|
225
|
+
headers?: HeadersInit;
|
|
226
|
+
} & {
|
|
227
|
+
asResponse?: boolean;
|
|
228
|
+
returnHeaders?: boolean;
|
|
229
|
+
use?: better_call.Middleware[];
|
|
230
|
+
path?: string;
|
|
231
|
+
} & {
|
|
232
|
+
asResponse?: AsResponse | undefined;
|
|
233
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
234
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
273
235
|
headers: Headers;
|
|
274
236
|
response: {
|
|
275
237
|
totpURI: string;
|
|
@@ -348,68 +310,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
348
310
|
path: "/two-factor/enable";
|
|
349
311
|
};
|
|
350
312
|
disableTwoFactor: {
|
|
351
|
-
<
|
|
352
|
-
|
|
353
|
-
body: z.ZodObject<{
|
|
354
|
-
password: z.ZodString;
|
|
355
|
-
}, "strip", z.ZodTypeAny, {
|
|
313
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
314
|
+
body: {
|
|
356
315
|
password: string;
|
|
357
|
-
}, {
|
|
358
|
-
password: string;
|
|
359
|
-
}>;
|
|
360
|
-
use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
|
|
361
|
-
session: {
|
|
362
|
-
session: Record<string, any> & {
|
|
363
|
-
id: string;
|
|
364
|
-
createdAt: Date;
|
|
365
|
-
updatedAt: Date;
|
|
366
|
-
userId: string;
|
|
367
|
-
expiresAt: Date;
|
|
368
|
-
token: string;
|
|
369
|
-
ipAddress?: string | null | undefined;
|
|
370
|
-
userAgent?: string | null | undefined;
|
|
371
|
-
};
|
|
372
|
-
user: Record<string, any> & {
|
|
373
|
-
id: string;
|
|
374
|
-
name: string;
|
|
375
|
-
email: string;
|
|
376
|
-
emailVerified: boolean;
|
|
377
|
-
createdAt: Date;
|
|
378
|
-
updatedAt: Date;
|
|
379
|
-
image?: string | null | undefined;
|
|
380
|
-
};
|
|
381
|
-
};
|
|
382
|
-
}>)[];
|
|
383
|
-
metadata: {
|
|
384
|
-
openapi: {
|
|
385
|
-
summary: string;
|
|
386
|
-
description: string;
|
|
387
|
-
responses: {
|
|
388
|
-
200: {
|
|
389
|
-
description: string;
|
|
390
|
-
content: {
|
|
391
|
-
"application/json": {
|
|
392
|
-
schema: {
|
|
393
|
-
type: "object";
|
|
394
|
-
properties: {
|
|
395
|
-
status: {
|
|
396
|
-
type: string;
|
|
397
|
-
};
|
|
398
|
-
};
|
|
399
|
-
};
|
|
400
|
-
};
|
|
401
|
-
};
|
|
402
|
-
};
|
|
403
|
-
};
|
|
404
|
-
};
|
|
405
316
|
};
|
|
406
317
|
} & {
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
}
|
|
318
|
+
method?: "POST" | undefined;
|
|
319
|
+
} & {
|
|
320
|
+
query?: Record<string, any> | undefined;
|
|
321
|
+
} & {
|
|
322
|
+
params?: Record<string, any>;
|
|
323
|
+
} & {
|
|
324
|
+
request?: Request;
|
|
325
|
+
} & {
|
|
326
|
+
headers?: HeadersInit;
|
|
327
|
+
} & {
|
|
328
|
+
asResponse?: boolean;
|
|
329
|
+
returnHeaders?: boolean;
|
|
330
|
+
use?: better_call.Middleware[];
|
|
331
|
+
path?: string;
|
|
332
|
+
} & {
|
|
333
|
+
asResponse?: AsResponse | undefined;
|
|
334
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
335
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
413
336
|
headers: Headers;
|
|
414
337
|
response: {
|
|
415
338
|
status: boolean;
|
|
@@ -478,99 +401,31 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
478
401
|
path: "/two-factor/disable";
|
|
479
402
|
};
|
|
480
403
|
verifyBackupCode: {
|
|
481
|
-
<
|
|
482
|
-
|
|
483
|
-
body: z.ZodObject<{
|
|
484
|
-
code: z.ZodString;
|
|
485
|
-
disableSession: z.ZodOptional<z.ZodBoolean>;
|
|
486
|
-
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
487
|
-
}, "strip", z.ZodTypeAny, {
|
|
488
|
-
code: string;
|
|
489
|
-
trustDevice?: boolean | undefined;
|
|
490
|
-
disableSession?: boolean | undefined;
|
|
491
|
-
}, {
|
|
404
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
405
|
+
body: {
|
|
492
406
|
code: string;
|
|
493
407
|
trustDevice?: boolean | undefined;
|
|
494
408
|
disableSession?: boolean | undefined;
|
|
495
|
-
}
|
|
496
|
-
use: ((inputContext: better_call.MiddlewareInputContext<{
|
|
497
|
-
body: z.ZodObject<{
|
|
498
|
-
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
499
|
-
}, "strip", z.ZodTypeAny, {
|
|
500
|
-
trustDevice?: boolean | undefined;
|
|
501
|
-
}, {
|
|
502
|
-
trustDevice?: boolean | undefined;
|
|
503
|
-
}>;
|
|
504
|
-
}>) => Promise<{
|
|
505
|
-
valid: (ctx: GenericEndpointContext) => Promise<{
|
|
506
|
-
token: string;
|
|
507
|
-
user: {
|
|
508
|
-
id: string;
|
|
509
|
-
email: string;
|
|
510
|
-
emailVerified: boolean;
|
|
511
|
-
name: string;
|
|
512
|
-
image: string | null | undefined;
|
|
513
|
-
createdAt: Date;
|
|
514
|
-
updatedAt: Date;
|
|
515
|
-
};
|
|
516
|
-
}>;
|
|
517
|
-
invalid: () => Promise<never>;
|
|
518
|
-
session: {
|
|
519
|
-
session: {
|
|
520
|
-
id: string;
|
|
521
|
-
createdAt: Date;
|
|
522
|
-
updatedAt: Date;
|
|
523
|
-
userId: string;
|
|
524
|
-
expiresAt: Date;
|
|
525
|
-
token: string;
|
|
526
|
-
ipAddress?: string | null | undefined;
|
|
527
|
-
userAgent?: string | null | undefined;
|
|
528
|
-
};
|
|
529
|
-
user: UserWithTwoFactor;
|
|
530
|
-
};
|
|
531
|
-
} | {
|
|
532
|
-
valid: (ctx: GenericEndpointContext) => Promise<{
|
|
533
|
-
token: string;
|
|
534
|
-
user: {
|
|
535
|
-
id: string;
|
|
536
|
-
email: string;
|
|
537
|
-
emailVerified: boolean;
|
|
538
|
-
name: string;
|
|
539
|
-
image: string | null | undefined;
|
|
540
|
-
createdAt: Date;
|
|
541
|
-
updatedAt: Date;
|
|
542
|
-
};
|
|
543
|
-
}>;
|
|
544
|
-
invalid: () => Promise<never>;
|
|
545
|
-
session: {
|
|
546
|
-
session: Record<string, any> & {
|
|
547
|
-
id: string;
|
|
548
|
-
createdAt: Date;
|
|
549
|
-
updatedAt: Date;
|
|
550
|
-
userId: string;
|
|
551
|
-
expiresAt: Date;
|
|
552
|
-
token: string;
|
|
553
|
-
ipAddress?: string | null | undefined;
|
|
554
|
-
userAgent?: string | null | undefined;
|
|
555
|
-
};
|
|
556
|
-
user: Record<string, any> & {
|
|
557
|
-
id: string;
|
|
558
|
-
name: string;
|
|
559
|
-
email: string;
|
|
560
|
-
emailVerified: boolean;
|
|
561
|
-
createdAt: Date;
|
|
562
|
-
updatedAt: Date;
|
|
563
|
-
image?: string | null | undefined;
|
|
564
|
-
};
|
|
565
|
-
};
|
|
566
|
-
}>)[];
|
|
409
|
+
};
|
|
567
410
|
} & {
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
}
|
|
411
|
+
method?: "POST" | undefined;
|
|
412
|
+
} & {
|
|
413
|
+
query?: Record<string, any> | undefined;
|
|
414
|
+
} & {
|
|
415
|
+
params?: Record<string, any>;
|
|
416
|
+
} & {
|
|
417
|
+
request?: Request;
|
|
418
|
+
} & {
|
|
419
|
+
headers?: HeadersInit;
|
|
420
|
+
} & {
|
|
421
|
+
asResponse?: boolean;
|
|
422
|
+
returnHeaders?: boolean;
|
|
423
|
+
use?: better_call.Middleware[];
|
|
424
|
+
path?: string;
|
|
425
|
+
} & {
|
|
426
|
+
asResponse?: AsResponse | undefined;
|
|
427
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
428
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
574
429
|
headers: Headers;
|
|
575
430
|
response: {
|
|
576
431
|
user: UserWithTwoFactor;
|
|
@@ -742,45 +597,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
742
597
|
path: "/two-factor/verify-backup-code";
|
|
743
598
|
};
|
|
744
599
|
generateBackupCodes: {
|
|
745
|
-
<
|
|
746
|
-
|
|
747
|
-
body: z.ZodObject<{
|
|
748
|
-
password: z.ZodString;
|
|
749
|
-
}, "strip", z.ZodTypeAny, {
|
|
600
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
601
|
+
body: {
|
|
750
602
|
password: string;
|
|
751
|
-
}
|
|
752
|
-
password: string;
|
|
753
|
-
}>;
|
|
754
|
-
use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
|
|
755
|
-
session: {
|
|
756
|
-
session: Record<string, any> & {
|
|
757
|
-
id: string;
|
|
758
|
-
createdAt: Date;
|
|
759
|
-
updatedAt: Date;
|
|
760
|
-
userId: string;
|
|
761
|
-
expiresAt: Date;
|
|
762
|
-
token: string;
|
|
763
|
-
ipAddress?: string | null | undefined;
|
|
764
|
-
userAgent?: string | null | undefined;
|
|
765
|
-
};
|
|
766
|
-
user: Record<string, any> & {
|
|
767
|
-
id: string;
|
|
768
|
-
name: string;
|
|
769
|
-
email: string;
|
|
770
|
-
emailVerified: boolean;
|
|
771
|
-
createdAt: Date;
|
|
772
|
-
updatedAt: Date;
|
|
773
|
-
image?: string | null | undefined;
|
|
774
|
-
};
|
|
775
|
-
};
|
|
776
|
-
}>)[];
|
|
603
|
+
};
|
|
777
604
|
} & {
|
|
778
|
-
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
}
|
|
605
|
+
method?: "POST" | undefined;
|
|
606
|
+
} & {
|
|
607
|
+
query?: Record<string, any> | undefined;
|
|
608
|
+
} & {
|
|
609
|
+
params?: Record<string, any>;
|
|
610
|
+
} & {
|
|
611
|
+
request?: Request;
|
|
612
|
+
} & {
|
|
613
|
+
headers?: HeadersInit;
|
|
614
|
+
} & {
|
|
615
|
+
asResponse?: boolean;
|
|
616
|
+
returnHeaders?: boolean;
|
|
617
|
+
use?: better_call.Middleware[];
|
|
618
|
+
path?: string;
|
|
619
|
+
} & {
|
|
620
|
+
asResponse?: AsResponse | undefined;
|
|
621
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
622
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
784
623
|
headers: Headers;
|
|
785
624
|
response: {
|
|
786
625
|
status: boolean;
|
|
@@ -828,25 +667,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
828
667
|
path: "/two-factor/generate-backup-codes";
|
|
829
668
|
};
|
|
830
669
|
viewBackupCodes: {
|
|
831
|
-
<
|
|
832
|
-
|
|
833
|
-
body: z.ZodObject<{
|
|
834
|
-
userId: z.ZodString;
|
|
835
|
-
}, "strip", z.ZodTypeAny, {
|
|
670
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
671
|
+
body: {
|
|
836
672
|
userId: string;
|
|
837
|
-
}, {
|
|
838
|
-
userId: string;
|
|
839
|
-
}>;
|
|
840
|
-
metadata: {
|
|
841
|
-
SERVER_ONLY: true;
|
|
842
673
|
};
|
|
843
674
|
} & {
|
|
844
|
-
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
}
|
|
675
|
+
method?: "GET" | undefined;
|
|
676
|
+
} & {
|
|
677
|
+
query?: Record<string, any> | undefined;
|
|
678
|
+
} & {
|
|
679
|
+
params?: Record<string, any>;
|
|
680
|
+
} & {
|
|
681
|
+
request?: Request;
|
|
682
|
+
} & {
|
|
683
|
+
headers?: HeadersInit;
|
|
684
|
+
} & {
|
|
685
|
+
asResponse?: boolean;
|
|
686
|
+
returnHeaders?: boolean;
|
|
687
|
+
use?: better_call.Middleware[];
|
|
688
|
+
path?: string;
|
|
689
|
+
} & {
|
|
690
|
+
asResponse?: AsResponse | undefined;
|
|
691
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
692
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
850
693
|
headers: Headers;
|
|
851
694
|
response: {
|
|
852
695
|
status: boolean;
|
|
@@ -874,244 +717,45 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
874
717
|
path: "/two-factor/view-backup-codes";
|
|
875
718
|
};
|
|
876
719
|
sendTwoFactorOTP: {
|
|
877
|
-
<
|
|
878
|
-
|
|
879
|
-
body: z.ZodOptional<z.ZodObject<{
|
|
880
|
-
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
881
|
-
}, "strip", z.ZodTypeAny, {
|
|
882
|
-
trustDevice?: boolean | undefined;
|
|
883
|
-
}, {
|
|
720
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
721
|
+
body?: {
|
|
884
722
|
trustDevice?: boolean | undefined;
|
|
885
|
-
}
|
|
886
|
-
use: ((inputContext: better_call.MiddlewareInputContext<{
|
|
887
|
-
body: z.ZodObject<{
|
|
888
|
-
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
889
|
-
}, "strip", z.ZodTypeAny, {
|
|
890
|
-
trustDevice?: boolean | undefined;
|
|
891
|
-
}, {
|
|
892
|
-
trustDevice?: boolean | undefined;
|
|
893
|
-
}>;
|
|
894
|
-
}>) => Promise<{
|
|
895
|
-
valid: (ctx: GenericEndpointContext) => Promise<{
|
|
896
|
-
token: string;
|
|
897
|
-
user: {
|
|
898
|
-
id: string;
|
|
899
|
-
email: string;
|
|
900
|
-
emailVerified: boolean;
|
|
901
|
-
name: string;
|
|
902
|
-
image: string | null | undefined;
|
|
903
|
-
createdAt: Date;
|
|
904
|
-
updatedAt: Date;
|
|
905
|
-
};
|
|
906
|
-
}>;
|
|
907
|
-
invalid: () => Promise<never>;
|
|
908
|
-
session: {
|
|
909
|
-
session: {
|
|
910
|
-
id: string;
|
|
911
|
-
createdAt: Date;
|
|
912
|
-
updatedAt: Date;
|
|
913
|
-
userId: string;
|
|
914
|
-
expiresAt: Date;
|
|
915
|
-
token: string;
|
|
916
|
-
ipAddress?: string | null | undefined;
|
|
917
|
-
userAgent?: string | null | undefined;
|
|
918
|
-
};
|
|
919
|
-
user: UserWithTwoFactor;
|
|
920
|
-
};
|
|
921
|
-
} | {
|
|
922
|
-
valid: (ctx: GenericEndpointContext) => Promise<{
|
|
923
|
-
token: string;
|
|
924
|
-
user: {
|
|
925
|
-
id: string;
|
|
926
|
-
email: string;
|
|
927
|
-
emailVerified: boolean;
|
|
928
|
-
name: string;
|
|
929
|
-
image: string | null | undefined;
|
|
930
|
-
createdAt: Date;
|
|
931
|
-
updatedAt: Date;
|
|
932
|
-
};
|
|
933
|
-
}>;
|
|
934
|
-
invalid: () => Promise<never>;
|
|
935
|
-
session: {
|
|
936
|
-
session: Record<string, any> & {
|
|
937
|
-
id: string;
|
|
938
|
-
createdAt: Date;
|
|
939
|
-
updatedAt: Date;
|
|
940
|
-
userId: string;
|
|
941
|
-
expiresAt: Date;
|
|
942
|
-
token: string;
|
|
943
|
-
ipAddress?: string | null | undefined;
|
|
944
|
-
userAgent?: string | null | undefined;
|
|
945
|
-
};
|
|
946
|
-
user: Record<string, any> & {
|
|
947
|
-
id: string;
|
|
948
|
-
name: string;
|
|
949
|
-
email: string;
|
|
950
|
-
emailVerified: boolean;
|
|
951
|
-
createdAt: Date;
|
|
952
|
-
updatedAt: Date;
|
|
953
|
-
image?: string | null | undefined;
|
|
954
|
-
};
|
|
955
|
-
};
|
|
956
|
-
}>)[];
|
|
957
|
-
metadata: {
|
|
958
|
-
openapi: {
|
|
959
|
-
summary: string;
|
|
960
|
-
description: string;
|
|
961
|
-
responses: {
|
|
962
|
-
200: {
|
|
963
|
-
description: string;
|
|
964
|
-
content: {
|
|
965
|
-
"application/json": {
|
|
966
|
-
schema: {
|
|
967
|
-
type: "object";
|
|
968
|
-
properties: {
|
|
969
|
-
status: {
|
|
970
|
-
type: string;
|
|
971
|
-
};
|
|
972
|
-
};
|
|
973
|
-
};
|
|
974
|
-
};
|
|
975
|
-
};
|
|
976
|
-
};
|
|
977
|
-
};
|
|
978
|
-
};
|
|
979
|
-
};
|
|
723
|
+
} | undefined;
|
|
980
724
|
} & {
|
|
981
|
-
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
}
|
|
725
|
+
method?: "POST" | undefined;
|
|
726
|
+
} & {
|
|
727
|
+
query?: Record<string, any> | undefined;
|
|
728
|
+
} & {
|
|
729
|
+
params?: Record<string, any>;
|
|
730
|
+
} & {
|
|
731
|
+
request?: Request;
|
|
732
|
+
} & {
|
|
733
|
+
headers?: HeadersInit;
|
|
734
|
+
} & {
|
|
735
|
+
asResponse?: boolean;
|
|
736
|
+
returnHeaders?: boolean;
|
|
737
|
+
use?: better_call.Middleware[];
|
|
738
|
+
path?: string;
|
|
739
|
+
} & {
|
|
740
|
+
asResponse?: AsResponse | undefined;
|
|
741
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
742
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
987
743
|
headers: Headers;
|
|
988
|
-
response: {
|
|
989
|
-
status: boolean;
|
|
990
|
-
};
|
|
991
|
-
} : {
|
|
992
|
-
status: boolean;
|
|
993
|
-
}>;
|
|
994
|
-
options: {
|
|
995
|
-
method: "POST";
|
|
996
|
-
body: z.ZodOptional<z.ZodObject<{
|
|
997
|
-
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
998
|
-
}, "strip", z.ZodTypeAny, {
|
|
999
|
-
trustDevice?: boolean | undefined;
|
|
1000
|
-
}, {
|
|
1001
|
-
trustDevice?: boolean | undefined;
|
|
1002
|
-
}>>;
|
|
1003
|
-
use: ((inputContext: better_call.MiddlewareInputContext<{
|
|
1004
|
-
body: z.ZodObject<{
|
|
1005
|
-
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
1006
|
-
}, "strip", z.ZodTypeAny, {
|
|
1007
|
-
trustDevice?: boolean | undefined;
|
|
1008
|
-
}, {
|
|
1009
|
-
trustDevice?: boolean | undefined;
|
|
1010
|
-
}>;
|
|
1011
|
-
}>) => Promise<{
|
|
1012
|
-
valid: (ctx: GenericEndpointContext) => Promise<{
|
|
1013
|
-
token: string;
|
|
1014
|
-
user: {
|
|
1015
|
-
id: string;
|
|
1016
|
-
email: string;
|
|
1017
|
-
emailVerified: boolean;
|
|
1018
|
-
name: string;
|
|
1019
|
-
image: string | null | undefined;
|
|
1020
|
-
createdAt: Date;
|
|
1021
|
-
updatedAt: Date;
|
|
1022
|
-
};
|
|
1023
|
-
}>;
|
|
1024
|
-
invalid: () => Promise<never>;
|
|
1025
|
-
session: {
|
|
1026
|
-
session: {
|
|
1027
|
-
id: string;
|
|
1028
|
-
createdAt: Date;
|
|
1029
|
-
updatedAt: Date;
|
|
1030
|
-
userId: string;
|
|
1031
|
-
expiresAt: Date;
|
|
1032
|
-
token: string;
|
|
1033
|
-
ipAddress?: string | null | undefined;
|
|
1034
|
-
userAgent?: string | null | undefined;
|
|
1035
|
-
};
|
|
1036
|
-
user: UserWithTwoFactor;
|
|
1037
|
-
};
|
|
1038
|
-
} | {
|
|
1039
|
-
valid: (ctx: GenericEndpointContext) => Promise<{
|
|
1040
|
-
token: string;
|
|
1041
|
-
user: {
|
|
1042
|
-
id: string;
|
|
1043
|
-
email: string;
|
|
1044
|
-
emailVerified: boolean;
|
|
1045
|
-
name: string;
|
|
1046
|
-
image: string | null | undefined;
|
|
1047
|
-
createdAt: Date;
|
|
1048
|
-
updatedAt: Date;
|
|
1049
|
-
};
|
|
1050
|
-
}>;
|
|
1051
|
-
invalid: () => Promise<never>;
|
|
1052
|
-
session: {
|
|
1053
|
-
session: Record<string, any> & {
|
|
1054
|
-
id: string;
|
|
1055
|
-
createdAt: Date;
|
|
1056
|
-
updatedAt: Date;
|
|
1057
|
-
userId: string;
|
|
1058
|
-
expiresAt: Date;
|
|
1059
|
-
token: string;
|
|
1060
|
-
ipAddress?: string | null | undefined;
|
|
1061
|
-
userAgent?: string | null | undefined;
|
|
1062
|
-
};
|
|
1063
|
-
user: Record<string, any> & {
|
|
1064
|
-
id: string;
|
|
1065
|
-
name: string;
|
|
1066
|
-
email: string;
|
|
1067
|
-
emailVerified: boolean;
|
|
1068
|
-
createdAt: Date;
|
|
1069
|
-
updatedAt: Date;
|
|
1070
|
-
image?: string | null | undefined;
|
|
1071
|
-
};
|
|
1072
|
-
};
|
|
1073
|
-
}>)[];
|
|
1074
|
-
metadata: {
|
|
1075
|
-
openapi: {
|
|
1076
|
-
summary: string;
|
|
1077
|
-
description: string;
|
|
1078
|
-
responses: {
|
|
1079
|
-
200: {
|
|
1080
|
-
description: string;
|
|
1081
|
-
content: {
|
|
1082
|
-
"application/json": {
|
|
1083
|
-
schema: {
|
|
1084
|
-
type: "object";
|
|
1085
|
-
properties: {
|
|
1086
|
-
status: {
|
|
1087
|
-
type: string;
|
|
1088
|
-
};
|
|
1089
|
-
};
|
|
1090
|
-
};
|
|
1091
|
-
};
|
|
1092
|
-
};
|
|
1093
|
-
};
|
|
1094
|
-
};
|
|
1095
|
-
};
|
|
744
|
+
response: {
|
|
745
|
+
status: boolean;
|
|
1096
746
|
};
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
};
|
|
1102
|
-
verifyTwoFactorOTP: {
|
|
1103
|
-
<C extends [better_call.InputContext<"/two-factor/verify-otp", {
|
|
747
|
+
} : {
|
|
748
|
+
status: boolean;
|
|
749
|
+
}>;
|
|
750
|
+
options: {
|
|
1104
751
|
method: "POST";
|
|
1105
|
-
body: z.ZodObject<{
|
|
1106
|
-
code: z.ZodString;
|
|
752
|
+
body: z.ZodOptional<z.ZodObject<{
|
|
1107
753
|
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
1108
754
|
}, "strip", z.ZodTypeAny, {
|
|
1109
|
-
code: string;
|
|
1110
755
|
trustDevice?: boolean | undefined;
|
|
1111
756
|
}, {
|
|
1112
|
-
code: string;
|
|
1113
757
|
trustDevice?: boolean | undefined;
|
|
1114
|
-
}
|
|
758
|
+
}>>;
|
|
1115
759
|
use: ((inputContext: better_call.MiddlewareInputContext<{
|
|
1116
760
|
body: z.ZodObject<{
|
|
1117
761
|
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1208,11 +852,34 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
1208
852
|
};
|
|
1209
853
|
} & {
|
|
1210
854
|
use: any[];
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
855
|
+
};
|
|
856
|
+
path: "/two-factor/send-otp";
|
|
857
|
+
};
|
|
858
|
+
verifyTwoFactorOTP: {
|
|
859
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
860
|
+
body: {
|
|
861
|
+
code: string;
|
|
862
|
+
trustDevice?: boolean | undefined;
|
|
863
|
+
};
|
|
864
|
+
} & {
|
|
865
|
+
method?: "POST" | undefined;
|
|
866
|
+
} & {
|
|
867
|
+
query?: Record<string, any> | undefined;
|
|
868
|
+
} & {
|
|
869
|
+
params?: Record<string, any>;
|
|
870
|
+
} & {
|
|
871
|
+
request?: Request;
|
|
872
|
+
} & {
|
|
873
|
+
headers?: HeadersInit;
|
|
874
|
+
} & {
|
|
875
|
+
asResponse?: boolean;
|
|
876
|
+
returnHeaders?: boolean;
|
|
877
|
+
use?: better_call.Middleware[];
|
|
878
|
+
path?: string;
|
|
879
|
+
} & {
|
|
880
|
+
asResponse?: AsResponse | undefined;
|
|
881
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
882
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
1216
883
|
headers: Headers;
|
|
1217
884
|
response: {
|
|
1218
885
|
token: string;
|
|
@@ -1350,61 +1017,27 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
1350
1017
|
path: "/two-factor/verify-otp";
|
|
1351
1018
|
};
|
|
1352
1019
|
generateTOTP: {
|
|
1353
|
-
<
|
|
1354
|
-
|
|
1355
|
-
use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
|
|
1356
|
-
session: {
|
|
1357
|
-
session: Record<string, any> & {
|
|
1358
|
-
id: string;
|
|
1359
|
-
createdAt: Date;
|
|
1360
|
-
updatedAt: Date;
|
|
1361
|
-
userId: string;
|
|
1362
|
-
expiresAt: Date;
|
|
1363
|
-
token: string;
|
|
1364
|
-
ipAddress?: string | null | undefined;
|
|
1365
|
-
userAgent?: string | null | undefined;
|
|
1366
|
-
};
|
|
1367
|
-
user: Record<string, any> & {
|
|
1368
|
-
id: string;
|
|
1369
|
-
name: string;
|
|
1370
|
-
email: string;
|
|
1371
|
-
emailVerified: boolean;
|
|
1372
|
-
createdAt: Date;
|
|
1373
|
-
updatedAt: Date;
|
|
1374
|
-
image?: string | null | undefined;
|
|
1375
|
-
};
|
|
1376
|
-
};
|
|
1377
|
-
}>)[];
|
|
1378
|
-
metadata: {
|
|
1379
|
-
openapi: {
|
|
1380
|
-
summary: string;
|
|
1381
|
-
description: string;
|
|
1382
|
-
responses: {
|
|
1383
|
-
200: {
|
|
1384
|
-
description: string;
|
|
1385
|
-
content: {
|
|
1386
|
-
"application/json": {
|
|
1387
|
-
schema: {
|
|
1388
|
-
type: "object";
|
|
1389
|
-
properties: {
|
|
1390
|
-
code: {
|
|
1391
|
-
type: string;
|
|
1392
|
-
};
|
|
1393
|
-
};
|
|
1394
|
-
};
|
|
1395
|
-
};
|
|
1396
|
-
};
|
|
1397
|
-
};
|
|
1398
|
-
};
|
|
1399
|
-
};
|
|
1400
|
-
};
|
|
1020
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
1021
|
+
body?: undefined;
|
|
1401
1022
|
} & {
|
|
1402
|
-
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
}
|
|
1023
|
+
method?: "POST" | undefined;
|
|
1024
|
+
} & {
|
|
1025
|
+
query?: Record<string, any> | undefined;
|
|
1026
|
+
} & {
|
|
1027
|
+
params?: Record<string, any>;
|
|
1028
|
+
} & {
|
|
1029
|
+
request?: Request;
|
|
1030
|
+
} & {
|
|
1031
|
+
headers?: HeadersInit;
|
|
1032
|
+
} & {
|
|
1033
|
+
asResponse?: boolean;
|
|
1034
|
+
returnHeaders?: boolean;
|
|
1035
|
+
use?: better_call.Middleware[];
|
|
1036
|
+
path?: string;
|
|
1037
|
+
} & {
|
|
1038
|
+
asResponse?: AsResponse | undefined;
|
|
1039
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
1040
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
1408
1041
|
headers: Headers;
|
|
1409
1042
|
response: {
|
|
1410
1043
|
code: string;
|
|
@@ -1466,68 +1099,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
1466
1099
|
path: "/totp/generate";
|
|
1467
1100
|
};
|
|
1468
1101
|
getTOTPURI: {
|
|
1469
|
-
<
|
|
1470
|
-
|
|
1471
|
-
use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
|
|
1472
|
-
session: {
|
|
1473
|
-
session: Record<string, any> & {
|
|
1474
|
-
id: string;
|
|
1475
|
-
createdAt: Date;
|
|
1476
|
-
updatedAt: Date;
|
|
1477
|
-
userId: string;
|
|
1478
|
-
expiresAt: Date;
|
|
1479
|
-
token: string;
|
|
1480
|
-
ipAddress?: string | null | undefined;
|
|
1481
|
-
userAgent?: string | null | undefined;
|
|
1482
|
-
};
|
|
1483
|
-
user: Record<string, any> & {
|
|
1484
|
-
id: string;
|
|
1485
|
-
name: string;
|
|
1486
|
-
email: string;
|
|
1487
|
-
emailVerified: boolean;
|
|
1488
|
-
createdAt: Date;
|
|
1489
|
-
updatedAt: Date;
|
|
1490
|
-
image?: string | null | undefined;
|
|
1491
|
-
};
|
|
1492
|
-
};
|
|
1493
|
-
}>)[];
|
|
1494
|
-
body: z.ZodObject<{
|
|
1495
|
-
password: z.ZodString;
|
|
1496
|
-
}, "strip", z.ZodTypeAny, {
|
|
1497
|
-
password: string;
|
|
1498
|
-
}, {
|
|
1102
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
1103
|
+
body: {
|
|
1499
1104
|
password: string;
|
|
1500
|
-
}>;
|
|
1501
|
-
metadata: {
|
|
1502
|
-
openapi: {
|
|
1503
|
-
summary: string;
|
|
1504
|
-
description: string;
|
|
1505
|
-
responses: {
|
|
1506
|
-
200: {
|
|
1507
|
-
description: string;
|
|
1508
|
-
content: {
|
|
1509
|
-
"application/json": {
|
|
1510
|
-
schema: {
|
|
1511
|
-
type: "object";
|
|
1512
|
-
properties: {
|
|
1513
|
-
totpURI: {
|
|
1514
|
-
type: string;
|
|
1515
|
-
};
|
|
1516
|
-
};
|
|
1517
|
-
};
|
|
1518
|
-
};
|
|
1519
|
-
};
|
|
1520
|
-
};
|
|
1521
|
-
};
|
|
1522
|
-
};
|
|
1523
1105
|
};
|
|
1524
1106
|
} & {
|
|
1525
|
-
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
}
|
|
1107
|
+
method?: "POST" | undefined;
|
|
1108
|
+
} & {
|
|
1109
|
+
query?: Record<string, any> | undefined;
|
|
1110
|
+
} & {
|
|
1111
|
+
params?: Record<string, any>;
|
|
1112
|
+
} & {
|
|
1113
|
+
request?: Request;
|
|
1114
|
+
} & {
|
|
1115
|
+
headers?: HeadersInit;
|
|
1116
|
+
} & {
|
|
1117
|
+
asResponse?: boolean;
|
|
1118
|
+
returnHeaders?: boolean;
|
|
1119
|
+
use?: better_call.Middleware[];
|
|
1120
|
+
path?: string;
|
|
1121
|
+
} & {
|
|
1122
|
+
asResponse?: AsResponse | undefined;
|
|
1123
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
1124
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
1531
1125
|
headers: Headers;
|
|
1532
1126
|
response: {
|
|
1533
1127
|
totpURI: string;
|
|
@@ -1596,119 +1190,30 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
1596
1190
|
path: "/two-factor/get-totp-uri";
|
|
1597
1191
|
};
|
|
1598
1192
|
verifyTOTP: {
|
|
1599
|
-
<
|
|
1600
|
-
|
|
1601
|
-
body: z.ZodObject<{
|
|
1602
|
-
code: z.ZodString;
|
|
1603
|
-
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
1604
|
-
}, "strip", z.ZodTypeAny, {
|
|
1605
|
-
code: string;
|
|
1606
|
-
trustDevice?: boolean | undefined;
|
|
1607
|
-
}, {
|
|
1193
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
1194
|
+
body: {
|
|
1608
1195
|
code: string;
|
|
1609
1196
|
trustDevice?: boolean | undefined;
|
|
1610
|
-
}>;
|
|
1611
|
-
use: ((inputContext: better_call.MiddlewareInputContext<{
|
|
1612
|
-
body: z.ZodObject<{
|
|
1613
|
-
trustDevice: z.ZodOptional<z.ZodBoolean>;
|
|
1614
|
-
}, "strip", z.ZodTypeAny, {
|
|
1615
|
-
trustDevice?: boolean | undefined;
|
|
1616
|
-
}, {
|
|
1617
|
-
trustDevice?: boolean | undefined;
|
|
1618
|
-
}>;
|
|
1619
|
-
}>) => Promise<{
|
|
1620
|
-
valid: (ctx: GenericEndpointContext) => Promise<{
|
|
1621
|
-
token: string;
|
|
1622
|
-
user: {
|
|
1623
|
-
id: string;
|
|
1624
|
-
email: string;
|
|
1625
|
-
emailVerified: boolean;
|
|
1626
|
-
name: string;
|
|
1627
|
-
image: string | null | undefined;
|
|
1628
|
-
createdAt: Date;
|
|
1629
|
-
updatedAt: Date;
|
|
1630
|
-
};
|
|
1631
|
-
}>;
|
|
1632
|
-
invalid: () => Promise<never>;
|
|
1633
|
-
session: {
|
|
1634
|
-
session: {
|
|
1635
|
-
id: string;
|
|
1636
|
-
createdAt: Date;
|
|
1637
|
-
updatedAt: Date;
|
|
1638
|
-
userId: string;
|
|
1639
|
-
expiresAt: Date;
|
|
1640
|
-
token: string;
|
|
1641
|
-
ipAddress?: string | null | undefined;
|
|
1642
|
-
userAgent?: string | null | undefined;
|
|
1643
|
-
};
|
|
1644
|
-
user: UserWithTwoFactor;
|
|
1645
|
-
};
|
|
1646
|
-
} | {
|
|
1647
|
-
valid: (ctx: GenericEndpointContext) => Promise<{
|
|
1648
|
-
token: string;
|
|
1649
|
-
user: {
|
|
1650
|
-
id: string;
|
|
1651
|
-
email: string;
|
|
1652
|
-
emailVerified: boolean;
|
|
1653
|
-
name: string;
|
|
1654
|
-
image: string | null | undefined;
|
|
1655
|
-
createdAt: Date;
|
|
1656
|
-
updatedAt: Date;
|
|
1657
|
-
};
|
|
1658
|
-
}>;
|
|
1659
|
-
invalid: () => Promise<never>;
|
|
1660
|
-
session: {
|
|
1661
|
-
session: Record<string, any> & {
|
|
1662
|
-
id: string;
|
|
1663
|
-
createdAt: Date;
|
|
1664
|
-
updatedAt: Date;
|
|
1665
|
-
userId: string;
|
|
1666
|
-
expiresAt: Date;
|
|
1667
|
-
token: string;
|
|
1668
|
-
ipAddress?: string | null | undefined;
|
|
1669
|
-
userAgent?: string | null | undefined;
|
|
1670
|
-
};
|
|
1671
|
-
user: Record<string, any> & {
|
|
1672
|
-
id: string;
|
|
1673
|
-
name: string;
|
|
1674
|
-
email: string;
|
|
1675
|
-
emailVerified: boolean;
|
|
1676
|
-
createdAt: Date;
|
|
1677
|
-
updatedAt: Date;
|
|
1678
|
-
image?: string | null | undefined;
|
|
1679
|
-
};
|
|
1680
|
-
};
|
|
1681
|
-
}>)[];
|
|
1682
|
-
metadata: {
|
|
1683
|
-
openapi: {
|
|
1684
|
-
summary: string;
|
|
1685
|
-
description: string;
|
|
1686
|
-
responses: {
|
|
1687
|
-
200: {
|
|
1688
|
-
description: string;
|
|
1689
|
-
content: {
|
|
1690
|
-
"application/json": {
|
|
1691
|
-
schema: {
|
|
1692
|
-
type: "object";
|
|
1693
|
-
properties: {
|
|
1694
|
-
status: {
|
|
1695
|
-
type: string;
|
|
1696
|
-
};
|
|
1697
|
-
};
|
|
1698
|
-
};
|
|
1699
|
-
};
|
|
1700
|
-
};
|
|
1701
|
-
};
|
|
1702
|
-
};
|
|
1703
|
-
};
|
|
1704
1197
|
};
|
|
1705
1198
|
} & {
|
|
1706
|
-
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
}
|
|
1199
|
+
method?: "POST" | undefined;
|
|
1200
|
+
} & {
|
|
1201
|
+
query?: Record<string, any> | undefined;
|
|
1202
|
+
} & {
|
|
1203
|
+
params?: Record<string, any>;
|
|
1204
|
+
} & {
|
|
1205
|
+
request?: Request;
|
|
1206
|
+
} & {
|
|
1207
|
+
headers?: HeadersInit;
|
|
1208
|
+
} & {
|
|
1209
|
+
asResponse?: boolean;
|
|
1210
|
+
returnHeaders?: boolean;
|
|
1211
|
+
use?: better_call.Middleware[];
|
|
1212
|
+
path?: string;
|
|
1213
|
+
} & {
|
|
1214
|
+
asResponse?: AsResponse | undefined;
|
|
1215
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
1216
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
1712
1217
|
headers: Headers;
|
|
1713
1218
|
response: {
|
|
1714
1219
|
token: string;
|
|
@@ -1895,6 +1400,14 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
|
|
|
1895
1400
|
window: number;
|
|
1896
1401
|
max: number;
|
|
1897
1402
|
}[];
|
|
1403
|
+
$ERROR_CODES: {
|
|
1404
|
+
readonly OTP_NOT_ENABLED: "OTP not enabled";
|
|
1405
|
+
readonly OTP_HAS_EXPIRED: "OTP has expired";
|
|
1406
|
+
readonly TOTP_NOT_ENABLED: "TOTP not enabled";
|
|
1407
|
+
readonly TWO_FACTOR_NOT_ENABLED: "Two factor isn't enabled";
|
|
1408
|
+
readonly BACKUP_CODES_NOT_ENABLED: "Backup codes aren't enabled";
|
|
1409
|
+
readonly INVALID_BACKUP_CODE: "Invalid backup code";
|
|
1410
|
+
};
|
|
1898
1411
|
};
|
|
1899
1412
|
|
|
1900
|
-
export { type TwoFactorOptions, type TwoFactorProvider, type TwoFactorTable, type UserWithTwoFactor, twoFactor, twoFactorClient };
|
|
1413
|
+
export { TWO_FACTOR_ERROR_CODES, type TwoFactorOptions, type TwoFactorProvider, type TwoFactorTable, type UserWithTwoFactor, twoFactor, twoFactorClient };
|