better-auth 1.2.5-beta.4 → 1.2.5-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.
Files changed (235) hide show
  1. package/dist/adapters/drizzle-adapter/index.cjs +1 -1
  2. package/dist/adapters/drizzle-adapter/index.d.cts +2 -2
  3. package/dist/adapters/drizzle-adapter/index.d.mts +2 -2
  4. package/dist/adapters/drizzle-adapter/index.d.ts +2 -2
  5. package/dist/adapters/drizzle-adapter/index.mjs +1 -1
  6. package/dist/adapters/kysely-adapter/index.cjs +2 -2
  7. package/dist/adapters/kysely-adapter/index.d.cts +2 -2
  8. package/dist/adapters/kysely-adapter/index.d.mts +2 -2
  9. package/dist/adapters/kysely-adapter/index.d.ts +2 -2
  10. package/dist/adapters/kysely-adapter/index.mjs +2 -2
  11. package/dist/adapters/memory-adapter/index.cjs +2 -2
  12. package/dist/adapters/memory-adapter/index.d.cts +2 -2
  13. package/dist/adapters/memory-adapter/index.d.mts +2 -2
  14. package/dist/adapters/memory-adapter/index.d.ts +2 -2
  15. package/dist/adapters/memory-adapter/index.mjs +2 -2
  16. package/dist/adapters/mongodb-adapter/index.cjs +1 -1
  17. package/dist/adapters/mongodb-adapter/index.d.cts +2 -2
  18. package/dist/adapters/mongodb-adapter/index.d.mts +2 -2
  19. package/dist/adapters/mongodb-adapter/index.d.ts +2 -2
  20. package/dist/adapters/mongodb-adapter/index.mjs +1 -1
  21. package/dist/adapters/prisma-adapter/index.cjs +1 -1
  22. package/dist/adapters/prisma-adapter/index.d.cts +2 -2
  23. package/dist/adapters/prisma-adapter/index.d.mts +2 -2
  24. package/dist/adapters/prisma-adapter/index.d.ts +2 -2
  25. package/dist/adapters/prisma-adapter/index.mjs +1 -1
  26. package/dist/adapters/test.d.cts +2 -2
  27. package/dist/adapters/test.d.mts +2 -2
  28. package/dist/adapters/test.d.ts +2 -2
  29. package/dist/api/index.cjs +10 -5
  30. package/dist/api/index.d.cts +2 -2
  31. package/dist/api/index.d.mts +2 -2
  32. package/dist/api/index.d.ts +2 -2
  33. package/dist/api/index.mjs +11 -6
  34. package/dist/client/index.cjs +1 -1
  35. package/dist/client/index.d.cts +2 -2
  36. package/dist/client/index.d.mts +2 -2
  37. package/dist/client/index.d.ts +2 -2
  38. package/dist/client/index.mjs +1 -1
  39. package/dist/client/plugins/index.cjs +3 -1
  40. package/dist/client/plugins/index.d.cts +6 -4
  41. package/dist/client/plugins/index.d.mts +6 -4
  42. package/dist/client/plugins/index.d.ts +6 -4
  43. package/dist/client/plugins/index.mjs +3 -1
  44. package/dist/client/react/index.cjs +1 -1
  45. package/dist/client/react/index.d.cts +2 -2
  46. package/dist/client/react/index.d.mts +2 -2
  47. package/dist/client/react/index.d.ts +2 -2
  48. package/dist/client/react/index.mjs +1 -1
  49. package/dist/client/solid/index.cjs +1 -1
  50. package/dist/client/solid/index.d.cts +2 -2
  51. package/dist/client/solid/index.d.mts +2 -2
  52. package/dist/client/solid/index.d.ts +2 -2
  53. package/dist/client/solid/index.mjs +1 -1
  54. package/dist/client/svelte/index.cjs +1 -1
  55. package/dist/client/svelte/index.d.cts +2 -2
  56. package/dist/client/svelte/index.d.mts +2 -2
  57. package/dist/client/svelte/index.d.ts +2 -2
  58. package/dist/client/svelte/index.mjs +1 -1
  59. package/dist/client/vue/index.cjs +1 -1
  60. package/dist/client/vue/index.d.cts +2 -2
  61. package/dist/client/vue/index.d.mts +2 -2
  62. package/dist/client/vue/index.d.ts +2 -2
  63. package/dist/client/vue/index.mjs +1 -1
  64. package/dist/cookies/index.d.cts +2 -2
  65. package/dist/cookies/index.d.mts +2 -2
  66. package/dist/cookies/index.d.ts +2 -2
  67. package/dist/db/index.cjs +4 -4
  68. package/dist/db/index.d.cts +3 -3
  69. package/dist/db/index.d.mts +3 -3
  70. package/dist/db/index.d.ts +3 -3
  71. package/dist/db/index.mjs +4 -4
  72. package/dist/index.cjs +7 -7
  73. package/dist/index.d.cts +3 -3
  74. package/dist/index.d.mts +3 -3
  75. package/dist/index.d.ts +3 -3
  76. package/dist/index.mjs +8 -8
  77. package/dist/integrations/next-js.cjs +6 -6
  78. package/dist/integrations/next-js.d.cts +3 -11
  79. package/dist/integrations/next-js.d.mts +3 -11
  80. package/dist/integrations/next-js.d.ts +3 -11
  81. package/dist/integrations/next-js.mjs +6 -6
  82. package/dist/integrations/node.d.cts +2 -2
  83. package/dist/integrations/node.d.mts +2 -2
  84. package/dist/integrations/node.d.ts +2 -2
  85. package/dist/integrations/svelte-kit.d.cts +2 -2
  86. package/dist/integrations/svelte-kit.d.mts +2 -2
  87. package/dist/integrations/svelte-kit.d.ts +2 -2
  88. package/dist/oauth2/index.cjs +2 -2
  89. package/dist/oauth2/index.d.cts +14 -6
  90. package/dist/oauth2/index.d.mts +14 -6
  91. package/dist/oauth2/index.d.ts +14 -6
  92. package/dist/oauth2/index.mjs +2 -2
  93. package/dist/plugins/admin/index.cjs +5 -5
  94. package/dist/plugins/admin/index.d.cts +615 -295
  95. package/dist/plugins/admin/index.d.mts +615 -295
  96. package/dist/plugins/admin/index.d.ts +615 -295
  97. package/dist/plugins/admin/index.mjs +5 -5
  98. package/dist/plugins/anonymous/index.cjs +5 -5
  99. package/dist/plugins/anonymous/index.d.cts +33 -23
  100. package/dist/plugins/anonymous/index.d.mts +33 -23
  101. package/dist/plugins/anonymous/index.d.ts +33 -23
  102. package/dist/plugins/anonymous/index.mjs +5 -5
  103. package/dist/plugins/bearer/index.cjs +4 -4
  104. package/dist/plugins/bearer/index.d.cts +4 -20
  105. package/dist/plugins/bearer/index.d.mts +4 -20
  106. package/dist/plugins/bearer/index.d.ts +4 -20
  107. package/dist/plugins/bearer/index.mjs +4 -4
  108. package/dist/plugins/custom-session/index.cjs +4 -4
  109. package/dist/plugins/custom-session/index.d.cts +22 -15
  110. package/dist/plugins/custom-session/index.d.mts +22 -15
  111. package/dist/plugins/custom-session/index.d.ts +22 -15
  112. package/dist/plugins/custom-session/index.mjs +4 -4
  113. package/dist/plugins/email-otp/index.cjs +4 -4
  114. package/dist/plugins/email-otp/index.d.cts +241 -95
  115. package/dist/plugins/email-otp/index.d.mts +241 -95
  116. package/dist/plugins/email-otp/index.d.ts +241 -95
  117. package/dist/plugins/email-otp/index.mjs +4 -4
  118. package/dist/plugins/generic-oauth/index.cjs +20 -17
  119. package/dist/plugins/generic-oauth/index.d.cts +129 -50
  120. package/dist/plugins/generic-oauth/index.d.mts +129 -50
  121. package/dist/plugins/generic-oauth/index.d.ts +129 -50
  122. package/dist/plugins/generic-oauth/index.mjs +20 -17
  123. package/dist/plugins/index.cjs +11 -11
  124. package/dist/plugins/index.d.cts +3 -3
  125. package/dist/plugins/index.d.mts +3 -3
  126. package/dist/plugins/index.d.ts +3 -3
  127. package/dist/plugins/index.mjs +12 -12
  128. package/dist/plugins/jwt/index.cjs +4 -4
  129. package/dist/plugins/jwt/index.d.cts +105 -44
  130. package/dist/plugins/jwt/index.d.mts +105 -44
  131. package/dist/plugins/jwt/index.d.ts +105 -44
  132. package/dist/plugins/jwt/index.mjs +4 -4
  133. package/dist/plugins/magic-link/index.cjs +4 -4
  134. package/dist/plugins/magic-link/index.d.cts +77 -33
  135. package/dist/plugins/magic-link/index.d.mts +77 -33
  136. package/dist/plugins/magic-link/index.d.ts +77 -33
  137. package/dist/plugins/magic-link/index.mjs +4 -4
  138. package/dist/plugins/multi-session/index.cjs +5 -5
  139. package/dist/plugins/multi-session/index.d.cts +123 -65
  140. package/dist/plugins/multi-session/index.d.mts +123 -65
  141. package/dist/plugins/multi-session/index.d.ts +123 -65
  142. package/dist/plugins/multi-session/index.mjs +5 -5
  143. package/dist/plugins/oauth-proxy/index.cjs +4 -4
  144. package/dist/plugins/oauth-proxy/index.d.cts +42 -41
  145. package/dist/plugins/oauth-proxy/index.d.mts +42 -41
  146. package/dist/plugins/oauth-proxy/index.d.ts +42 -41
  147. package/dist/plugins/oauth-proxy/index.mjs +4 -4
  148. package/dist/plugins/oidc-provider/index.cjs +17 -11
  149. package/dist/plugins/oidc-provider/index.d.cts +173 -117
  150. package/dist/plugins/oidc-provider/index.d.mts +173 -117
  151. package/dist/plugins/oidc-provider/index.d.ts +173 -117
  152. package/dist/plugins/oidc-provider/index.mjs +17 -11
  153. package/dist/plugins/one-tap/index.cjs +5 -5
  154. package/dist/plugins/one-tap/index.d.cts +39 -12
  155. package/dist/plugins/one-tap/index.d.mts +39 -12
  156. package/dist/plugins/one-tap/index.d.ts +39 -12
  157. package/dist/plugins/one-tap/index.mjs +5 -5
  158. package/dist/plugins/open-api/index.cjs +4 -4
  159. package/dist/plugins/open-api/index.d.cts +15 -26
  160. package/dist/plugins/open-api/index.d.mts +15 -26
  161. package/dist/plugins/open-api/index.d.ts +15 -26
  162. package/dist/plugins/open-api/index.mjs +4 -4
  163. package/dist/plugins/organization/index.cjs +5 -5
  164. package/dist/plugins/organization/index.d.cts +4277 -4932
  165. package/dist/plugins/organization/index.d.mts +4277 -4932
  166. package/dist/plugins/organization/index.d.ts +4277 -4932
  167. package/dist/plugins/organization/index.mjs +5 -5
  168. package/dist/plugins/passkey/index.cjs +4 -4
  169. package/dist/plugins/passkey/index.d.cts +449 -136
  170. package/dist/plugins/passkey/index.d.mts +449 -136
  171. package/dist/plugins/passkey/index.d.ts +449 -136
  172. package/dist/plugins/passkey/index.mjs +4 -4
  173. package/dist/plugins/phone-number/index.cjs +4 -4
  174. package/dist/plugins/phone-number/index.d.cts +164 -64
  175. package/dist/plugins/phone-number/index.d.mts +164 -64
  176. package/dist/plugins/phone-number/index.d.ts +164 -64
  177. package/dist/plugins/phone-number/index.mjs +4 -4
  178. package/dist/plugins/sso/index.cjs +4 -4
  179. package/dist/plugins/sso/index.d.cts +199 -49
  180. package/dist/plugins/sso/index.d.mts +199 -49
  181. package/dist/plugins/sso/index.d.ts +199 -49
  182. package/dist/plugins/sso/index.mjs +4 -4
  183. package/dist/plugins/two-factor/index.cjs +6 -6
  184. package/dist/plugins/two-factor/index.d.cts +731 -233
  185. package/dist/plugins/two-factor/index.d.mts +731 -233
  186. package/dist/plugins/two-factor/index.d.ts +731 -233
  187. package/dist/plugins/two-factor/index.mjs +6 -6
  188. package/dist/plugins/username/index.cjs +5 -5
  189. package/dist/plugins/username/index.d.cts +43 -23
  190. package/dist/plugins/username/index.d.mts +43 -23
  191. package/dist/plugins/username/index.d.ts +43 -23
  192. package/dist/plugins/username/index.mjs +5 -5
  193. package/dist/shared/{better-auth.DpK5DyQT.cjs → better-auth.1GtLBK1J.cjs} +5 -5
  194. package/dist/shared/{better-auth.Dz0hfDVL.d.cts → better-auth.2fbYHU01.d.mts} +186 -115
  195. package/dist/shared/{better-auth.xcEiilVu.d.ts → better-auth.Al7ra9Pe.d.cts} +186 -115
  196. package/dist/shared/{better-auth.BiRM8Fdy.cjs → better-auth.B3unKFue.cjs} +2 -2
  197. package/dist/shared/{better-auth.kkBzxQJx.d.ts → better-auth.BODzPfJo.d.ts} +10299 -11599
  198. package/dist/shared/{better-auth.CbXAPXob.mjs → better-auth.BdyOG_p4.mjs} +1 -1
  199. package/dist/shared/{better-auth.DWb95UJA.d.ts → better-auth.BjXInNL7.d.ts} +1 -1
  200. package/dist/shared/{better-auth.D26n-znb.d.cts → better-auth.BkL9ntGY.d.cts} +10299 -11599
  201. package/dist/shared/{better-auth.B36e4YUo.d.cts → better-auth.BkREA_U6.d.cts} +99 -18
  202. package/dist/shared/{better-auth.HHZU10im.mjs → better-auth.BnRFp-t0.mjs} +1 -1
  203. package/dist/shared/{better-auth.CHyZMcYK.cjs → better-auth.C5H9XEzZ.cjs} +2 -2
  204. package/dist/shared/{better-auth.C678re3w.d.mts → better-auth.C7O0617V.d.mts} +1 -1
  205. package/dist/shared/{better-auth.BJVJYVcJ.mjs → better-auth.CKCPM9Oy.mjs} +2 -2
  206. package/dist/shared/{better-auth.BgAsaHGJ.d.mts → better-auth.CV08HOs_.d.ts} +186 -115
  207. package/dist/shared/{better-auth.2gyOPXIw.d.ts → better-auth.CVEUIYlu.d.ts} +99 -18
  208. package/dist/shared/{better-auth.CUEbBDI6.mjs → better-auth.CbBX7Xla.mjs} +3 -3
  209. package/dist/shared/{better-auth.C24Bzw4w.mjs → better-auth.CepcSj5H.mjs} +2 -2
  210. package/dist/shared/{better-auth.C00ERbVB.cjs → better-auth.ChassmKE.cjs} +11 -4
  211. package/dist/shared/{better-auth.C7bUpbPE.d.mts → better-auth.CmWesETc.d.mts} +99 -18
  212. package/dist/shared/{better-auth.D8LeJoj0.mjs → better-auth.DC8JQbiE.mjs} +1 -1
  213. package/dist/shared/{better-auth.DZnoWLte.cjs → better-auth.DWHWPllD.cjs} +1 -1
  214. package/dist/shared/{better-auth.CSVqSIae.mjs → better-auth.DYm-YVE1.mjs} +1 -1
  215. package/dist/shared/{better-auth.BgoXd7dr.d.mts → better-auth.D_6ikAPh.d.mts} +10299 -11599
  216. package/dist/shared/{better-auth.DdjqxOIu.cjs → better-auth.DgXCgiHI.cjs} +22 -8
  217. package/dist/shared/{better-auth.D7syfoJW.mjs → better-auth.DiMBK1Ep.mjs} +22 -8
  218. package/dist/shared/{better-auth.lwzD09PV.cjs → better-auth.DqLjzBlO.cjs} +1 -1
  219. package/dist/shared/{better-auth.CHHC_PJT.cjs → better-auth.QbbyHMYf.cjs} +1 -1
  220. package/dist/shared/{better-auth.BN2jUYPL.cjs → better-auth.R2B_T2k0.cjs} +1 -1
  221. package/dist/shared/{better-auth.CPv7iscr.d.cts → better-auth.RZCibiKy.d.cts} +1 -1
  222. package/dist/shared/{better-auth.C6ZiueUc.mjs → better-auth.UO_GAdaM.mjs} +5 -5
  223. package/dist/shared/{better-auth.BddF2Yaz.cjs → better-auth.X0ynzeu1.cjs} +3 -3
  224. package/dist/shared/{better-auth.BdiSabiO.cjs → better-auth.aci1hpij.cjs} +11 -11
  225. package/dist/shared/{better-auth.CJ1_dCz5.mjs → better-auth.lijknCkI.mjs} +11 -11
  226. package/dist/shared/{better-auth.CrWUABzd.mjs → better-auth.vdKrG2Zp.mjs} +11 -4
  227. package/dist/social-providers/index.cjs +43 -18
  228. package/dist/social-providers/index.d.cts +1 -1
  229. package/dist/social-providers/index.d.mts +1 -1
  230. package/dist/social-providers/index.d.ts +1 -1
  231. package/dist/social-providers/index.mjs +43 -18
  232. package/dist/types/index.d.cts +3 -3
  233. package/dist/types/index.d.mts +3 -3
  234. package/dist/types/index.d.ts +3 -3
  235. package/package.json +3 -3
@@ -1,10 +1,10 @@
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, S as Session, G as GenericEndpointContext, H as HookEndpointContext } from '../../shared/better-auth.BgoXd7dr.mjs';
3
+ import { U as User, I as InferOptionSchema, d as AuthEndpoint, G as GenericEndpointContext, S as Session, H as HookEndpointContext } from '../../shared/better-auth.D_6ikAPh.mjs';
4
4
  import { L as LiteralString } from '../../shared/better-auth.Bi8FQwDD.mjs';
5
5
  import * as _better_fetch_fetch from '@better-fetch/fetch';
6
6
  import 'kysely';
7
- import '../../shared/better-auth.C7bUpbPE.mjs';
7
+ import '../../shared/better-auth.CmWesETc.mjs';
8
8
  import 'jose';
9
9
  import 'better-sqlite3';
10
10
 
@@ -200,20 +200,72 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
200
200
  id: "two-factor";
201
201
  endpoints: {
202
202
  enableTwoFactor: {
203
- <C extends [{
204
- body: {
203
+ <C extends [better_call.InputContext<"/two-factor/enable", {
204
+ method: "POST";
205
+ body: z.ZodObject<{
206
+ password: z.ZodString;
207
+ }, "strip", z.ZodTypeAny, {
205
208
  password: string;
209
+ }, {
210
+ 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
+ };
206
265
  };
207
- method?: "POST" | undefined;
208
- query?: Record<string, any> | undefined;
209
- params?: Record<string, any> | undefined;
210
- request?: Request | undefined;
211
- headers?: HeadersInit | undefined;
212
- asResponse?: boolean | undefined;
213
- returnHeaders?: boolean | undefined;
214
- use?: better_call.Middleware[] | undefined;
215
- path?: string | undefined;
216
- }]>(...inputCtx: C): Promise<C extends [{
266
+ } & {
267
+ use: any[];
268
+ }>]>(...inputCtx: C): Promise<C extends [{
217
269
  asResponse: true;
218
270
  }] ? Response : C extends [{
219
271
  returnHeaders: true;
@@ -236,15 +288,7 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
236
288
  }, {
237
289
  password: string;
238
290
  }>;
239
- use: ((inputContext: {
240
- body?: any;
241
- query?: Record<string, any> | undefined;
242
- request?: Request | undefined;
243
- headers?: Headers | undefined;
244
- asResponse?: boolean | undefined;
245
- returnHeaders?: boolean | undefined;
246
- use?: better_call.Middleware[] | undefined;
247
- }) => Promise<{
291
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
248
292
  session: {
249
293
  session: Record<string, any> & {
250
294
  id: string;
@@ -304,20 +348,64 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
304
348
  path: "/two-factor/enable";
305
349
  };
306
350
  disableTwoFactor: {
307
- <C extends [{
308
- body: {
351
+ <C extends [better_call.InputContext<"/two-factor/disable", {
352
+ method: "POST";
353
+ body: z.ZodObject<{
354
+ password: z.ZodString;
355
+ }, "strip", z.ZodTypeAny, {
356
+ password: string;
357
+ }, {
309
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
+ };
310
405
  };
311
- method?: "POST" | undefined;
312
- query?: Record<string, any> | undefined;
313
- params?: Record<string, any> | undefined;
314
- request?: Request | undefined;
315
- headers?: HeadersInit | undefined;
316
- asResponse?: boolean | undefined;
317
- returnHeaders?: boolean | undefined;
318
- use?: better_call.Middleware[] | undefined;
319
- path?: string | undefined;
320
- }]>(...inputCtx: C): Promise<C extends [{
406
+ } & {
407
+ use: any[];
408
+ }>]>(...inputCtx: C): Promise<C extends [{
321
409
  asResponse: true;
322
410
  }] ? Response : C extends [{
323
411
  returnHeaders: true;
@@ -338,15 +426,7 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
338
426
  }, {
339
427
  password: string;
340
428
  }>;
341
- use: ((inputContext: {
342
- body?: any;
343
- query?: Record<string, any> | undefined;
344
- request?: Request | undefined;
345
- headers?: Headers | undefined;
346
- asResponse?: boolean | undefined;
347
- returnHeaders?: boolean | undefined;
348
- use?: better_call.Middleware[] | undefined;
349
- }) => Promise<{
429
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
350
430
  session: {
351
431
  session: Record<string, any> & {
352
432
  id: string;
@@ -398,22 +478,95 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
398
478
  path: "/two-factor/disable";
399
479
  };
400
480
  verifyBackupCode: {
401
- <C extends [{
402
- body: {
481
+ <C extends [better_call.InputContext<"/two-factor/verify-backup-code", {
482
+ method: "POST";
483
+ body: z.ZodObject<{
484
+ code: z.ZodString;
485
+ disableSession: z.ZodOptional<z.ZodBoolean>;
486
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
487
+ }, "strip", z.ZodTypeAny, {
403
488
  code: string;
404
489
  trustDevice?: boolean | undefined;
405
490
  disableSession?: boolean | undefined;
406
- };
407
- method?: "POST" | undefined;
408
- query?: Record<string, any> | undefined;
409
- params?: Record<string, any> | undefined;
410
- request?: Request | undefined;
411
- headers?: HeadersInit | undefined;
412
- asResponse?: boolean | undefined;
413
- returnHeaders?: boolean | undefined;
414
- use?: better_call.Middleware[] | undefined;
415
- path?: string | undefined;
416
- }]>(...inputCtx: C): Promise<C extends [{
491
+ }, {
492
+ code: string;
493
+ trustDevice?: boolean | undefined;
494
+ 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
+ }>)[];
567
+ } & {
568
+ use: any[];
569
+ }>]>(...inputCtx: C): Promise<C extends [{
417
570
  asResponse: true;
418
571
  }] ? Response : C extends [{
419
572
  returnHeaders: true;
@@ -512,17 +665,15 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
512
665
  trustDevice?: boolean | undefined;
513
666
  disableSession?: boolean | undefined;
514
667
  }>;
515
- use: ((inputContext: {
516
- body: {
668
+ use: ((inputContext: better_call.MiddlewareInputContext<{
669
+ body: z.ZodObject<{
670
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
671
+ }, "strip", z.ZodTypeAny, {
517
672
  trustDevice?: boolean | undefined;
518
- };
519
- query?: Record<string, any> | undefined;
520
- request?: Request | undefined;
521
- headers?: Headers | undefined;
522
- asResponse?: boolean | undefined;
523
- returnHeaders?: boolean | undefined;
524
- use?: better_call.Middleware[] | undefined;
525
- }) => Promise<{
673
+ }, {
674
+ trustDevice?: boolean | undefined;
675
+ }>;
676
+ }>) => Promise<{
526
677
  valid: (ctx: GenericEndpointContext) => Promise<{
527
678
  token: string;
528
679
  user: {
@@ -591,20 +742,41 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
591
742
  path: "/two-factor/verify-backup-code";
592
743
  };
593
744
  generateBackupCodes: {
594
- <C extends [{
595
- body: {
745
+ <C extends [better_call.InputContext<"/two-factor/generate-backup-codes", {
746
+ method: "POST";
747
+ body: z.ZodObject<{
748
+ password: z.ZodString;
749
+ }, "strip", z.ZodTypeAny, {
596
750
  password: string;
597
- };
598
- method?: "POST" | undefined;
599
- query?: Record<string, any> | undefined;
600
- params?: Record<string, any> | undefined;
601
- request?: Request | undefined;
602
- headers?: HeadersInit | undefined;
603
- asResponse?: boolean | undefined;
604
- returnHeaders?: boolean | undefined;
605
- use?: better_call.Middleware[] | undefined;
606
- path?: string | undefined;
607
- }]>(...inputCtx: C): Promise<C extends [{
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
+ }>)[];
777
+ } & {
778
+ use: any[];
779
+ }>]>(...inputCtx: C): Promise<C extends [{
608
780
  asResponse: true;
609
781
  }] ? Response : C extends [{
610
782
  returnHeaders: true;
@@ -627,15 +799,7 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
627
799
  }, {
628
800
  password: string;
629
801
  }>;
630
- use: ((inputContext: {
631
- body?: any;
632
- query?: Record<string, any> | undefined;
633
- request?: Request | undefined;
634
- headers?: Headers | undefined;
635
- asResponse?: boolean | undefined;
636
- returnHeaders?: boolean | undefined;
637
- use?: better_call.Middleware[] | undefined;
638
- }) => Promise<{
802
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
639
803
  session: {
640
804
  session: Record<string, any> & {
641
805
  id: string;
@@ -664,20 +828,21 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
664
828
  path: "/two-factor/generate-backup-codes";
665
829
  };
666
830
  viewBackupCodes: {
667
- <C extends [{
668
- body: {
831
+ <C extends [better_call.InputContext<"/two-factor/view-backup-codes", {
832
+ method: "GET";
833
+ body: z.ZodObject<{
834
+ userId: z.ZodString;
835
+ }, "strip", z.ZodTypeAny, {
669
836
  userId: string;
837
+ }, {
838
+ userId: string;
839
+ }>;
840
+ metadata: {
841
+ SERVER_ONLY: true;
670
842
  };
671
- method?: "GET" | undefined;
672
- query?: Record<string, any> | undefined;
673
- params?: Record<string, any> | undefined;
674
- request?: Request | undefined;
675
- headers?: HeadersInit | undefined;
676
- asResponse?: boolean | undefined;
677
- returnHeaders?: boolean | undefined;
678
- use?: better_call.Middleware[] | undefined;
679
- path?: string | undefined;
680
- }]>(...inputCtx: C): Promise<C extends [{
843
+ } & {
844
+ use: any[];
845
+ }>]>(...inputCtx: C): Promise<C extends [{
681
846
  asResponse: true;
682
847
  }] ? Response : C extends [{
683
848
  returnHeaders: true;
@@ -709,32 +874,7 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
709
874
  path: "/two-factor/view-backup-codes";
710
875
  };
711
876
  sendTwoFactorOTP: {
712
- <C extends [({
713
- body?: {
714
- trustDevice?: boolean | undefined;
715
- } | undefined;
716
- method?: "POST" | undefined;
717
- query?: Record<string, any> | undefined;
718
- params?: Record<string, any> | undefined;
719
- request?: Request | undefined;
720
- headers?: HeadersInit | undefined;
721
- asResponse?: boolean | undefined;
722
- returnHeaders?: boolean | undefined;
723
- use?: better_call.Middleware[] | undefined;
724
- path?: string | undefined;
725
- } | undefined)?]>(...inputCtx: C): Promise<C extends [{
726
- asResponse: true;
727
- }] ? Response : C extends [{
728
- returnHeaders: true;
729
- }] ? {
730
- headers: Headers;
731
- response: {
732
- status: boolean;
733
- };
734
- } : {
735
- status: boolean;
736
- }>;
737
- options: {
877
+ <C extends [(better_call.InputContext<"/two-factor/send-otp", {
738
878
  method: "POST";
739
879
  body: z.ZodOptional<z.ZodObject<{
740
880
  trustDevice: z.ZodOptional<z.ZodBoolean>;
@@ -743,17 +883,15 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
743
883
  }, {
744
884
  trustDevice?: boolean | undefined;
745
885
  }>>;
746
- use: ((inputContext: {
747
- body: {
886
+ use: ((inputContext: better_call.MiddlewareInputContext<{
887
+ body: z.ZodObject<{
888
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
889
+ }, "strip", z.ZodTypeAny, {
748
890
  trustDevice?: boolean | undefined;
749
- };
750
- query?: Record<string, any> | undefined;
751
- request?: Request | undefined;
752
- headers?: Headers | undefined;
753
- asResponse?: boolean | undefined;
754
- returnHeaders?: boolean | undefined;
755
- use?: better_call.Middleware[] | undefined;
756
- }) => Promise<{
891
+ }, {
892
+ trustDevice?: boolean | undefined;
893
+ }>;
894
+ }>) => Promise<{
757
895
  valid: (ctx: GenericEndpointContext) => Promise<{
758
896
  token: string;
759
897
  user: {
@@ -841,25 +979,236 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
841
979
  };
842
980
  } & {
843
981
  use: any[];
844
- };
982
+ }> | undefined)?]>(...inputCtx: C): Promise<C extends [{
983
+ asResponse: true;
984
+ }] ? Response : C extends [{
985
+ returnHeaders: true;
986
+ }] ? {
987
+ 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
+ };
1096
+ };
1097
+ } & {
1098
+ use: any[];
1099
+ };
845
1100
  path: "/two-factor/send-otp";
846
1101
  };
847
1102
  verifyTwoFactorOTP: {
848
- <C extends [{
849
- body: {
1103
+ <C extends [better_call.InputContext<"/two-factor/verify-otp", {
1104
+ method: "POST";
1105
+ body: z.ZodObject<{
1106
+ code: z.ZodString;
1107
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
1108
+ }, "strip", z.ZodTypeAny, {
1109
+ code: string;
1110
+ trustDevice?: boolean | undefined;
1111
+ }, {
850
1112
  code: string;
851
1113
  trustDevice?: boolean | undefined;
1114
+ }>;
1115
+ use: ((inputContext: better_call.MiddlewareInputContext<{
1116
+ body: z.ZodObject<{
1117
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
1118
+ }, "strip", z.ZodTypeAny, {
1119
+ trustDevice?: boolean | undefined;
1120
+ }, {
1121
+ trustDevice?: boolean | undefined;
1122
+ }>;
1123
+ }>) => Promise<{
1124
+ valid: (ctx: GenericEndpointContext) => Promise<{
1125
+ token: string;
1126
+ user: {
1127
+ id: string;
1128
+ email: string;
1129
+ emailVerified: boolean;
1130
+ name: string;
1131
+ image: string | null | undefined;
1132
+ createdAt: Date;
1133
+ updatedAt: Date;
1134
+ };
1135
+ }>;
1136
+ invalid: () => Promise<never>;
1137
+ session: {
1138
+ session: {
1139
+ id: string;
1140
+ createdAt: Date;
1141
+ updatedAt: Date;
1142
+ userId: string;
1143
+ expiresAt: Date;
1144
+ token: string;
1145
+ ipAddress?: string | null | undefined;
1146
+ userAgent?: string | null | undefined;
1147
+ };
1148
+ user: UserWithTwoFactor;
1149
+ };
1150
+ } | {
1151
+ valid: (ctx: GenericEndpointContext) => Promise<{
1152
+ token: string;
1153
+ user: {
1154
+ id: string;
1155
+ email: string;
1156
+ emailVerified: boolean;
1157
+ name: string;
1158
+ image: string | null | undefined;
1159
+ createdAt: Date;
1160
+ updatedAt: Date;
1161
+ };
1162
+ }>;
1163
+ invalid: () => Promise<never>;
1164
+ session: {
1165
+ session: Record<string, any> & {
1166
+ id: string;
1167
+ createdAt: Date;
1168
+ updatedAt: Date;
1169
+ userId: string;
1170
+ expiresAt: Date;
1171
+ token: string;
1172
+ ipAddress?: string | null | undefined;
1173
+ userAgent?: string | null | undefined;
1174
+ };
1175
+ user: Record<string, any> & {
1176
+ id: string;
1177
+ name: string;
1178
+ email: string;
1179
+ emailVerified: boolean;
1180
+ createdAt: Date;
1181
+ updatedAt: Date;
1182
+ image?: string | null | undefined;
1183
+ };
1184
+ };
1185
+ }>)[];
1186
+ metadata: {
1187
+ openapi: {
1188
+ summary: string;
1189
+ description: string;
1190
+ responses: {
1191
+ 200: {
1192
+ description: string;
1193
+ content: {
1194
+ "application/json": {
1195
+ schema: {
1196
+ type: "object";
1197
+ properties: {
1198
+ status: {
1199
+ type: string;
1200
+ };
1201
+ };
1202
+ };
1203
+ };
1204
+ };
1205
+ };
1206
+ };
1207
+ };
852
1208
  };
853
- method?: "POST" | undefined;
854
- query?: Record<string, any> | undefined;
855
- params?: Record<string, any> | undefined;
856
- request?: Request | undefined;
857
- headers?: HeadersInit | undefined;
858
- asResponse?: boolean | undefined;
859
- returnHeaders?: boolean | undefined;
860
- use?: better_call.Middleware[] | undefined;
861
- path?: string | undefined;
862
- }]>(...inputCtx: C): Promise<C extends [{
1209
+ } & {
1210
+ use: any[];
1211
+ }>]>(...inputCtx: C): Promise<C extends [{
863
1212
  asResponse: true;
864
1213
  }] ? Response : C extends [{
865
1214
  returnHeaders: true;
@@ -901,17 +1250,15 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
901
1250
  code: string;
902
1251
  trustDevice?: boolean | undefined;
903
1252
  }>;
904
- use: ((inputContext: {
905
- body: {
1253
+ use: ((inputContext: better_call.MiddlewareInputContext<{
1254
+ body: z.ZodObject<{
1255
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
1256
+ }, "strip", z.ZodTypeAny, {
906
1257
  trustDevice?: boolean | undefined;
907
- };
908
- query?: Record<string, any> | undefined;
909
- request?: Request | undefined;
910
- headers?: Headers | undefined;
911
- asResponse?: boolean | undefined;
912
- returnHeaders?: boolean | undefined;
913
- use?: better_call.Middleware[] | undefined;
914
- }) => Promise<{
1258
+ }, {
1259
+ trustDevice?: boolean | undefined;
1260
+ }>;
1261
+ }>) => Promise<{
915
1262
  valid: (ctx: GenericEndpointContext) => Promise<{
916
1263
  token: string;
917
1264
  user: {
@@ -1003,18 +1350,57 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1003
1350
  path: "/two-factor/verify-otp";
1004
1351
  };
1005
1352
  generateTOTP: {
1006
- <C extends [({
1007
- body?: undefined;
1008
- method?: "POST" | undefined;
1009
- query?: Record<string, any> | undefined;
1010
- params?: Record<string, any> | undefined;
1011
- request?: Request | undefined;
1012
- headers?: HeadersInit | undefined;
1013
- asResponse?: boolean | undefined;
1014
- returnHeaders?: boolean | undefined;
1015
- use?: better_call.Middleware[] | undefined;
1016
- path?: string | undefined;
1017
- } | undefined)?]>(...inputCtx: C): Promise<C extends [{
1353
+ <C extends [(better_call.InputContext<"/totp/generate", {
1354
+ method: "POST";
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
+ };
1401
+ } & {
1402
+ use: any[];
1403
+ }> | undefined)?]>(...inputCtx: C): Promise<C extends [{
1018
1404
  asResponse: true;
1019
1405
  }] ? Response : C extends [{
1020
1406
  returnHeaders: true;
@@ -1028,15 +1414,7 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1028
1414
  }>;
1029
1415
  options: {
1030
1416
  method: "POST";
1031
- use: ((inputContext: {
1032
- body?: any;
1033
- query?: Record<string, any> | undefined;
1034
- request?: Request | undefined;
1035
- headers?: Headers | undefined;
1036
- asResponse?: boolean | undefined;
1037
- returnHeaders?: boolean | undefined;
1038
- use?: better_call.Middleware[] | undefined;
1039
- }) => Promise<{
1417
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1040
1418
  session: {
1041
1419
  session: Record<string, any> & {
1042
1420
  id: string;
@@ -1088,20 +1466,64 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1088
1466
  path: "/totp/generate";
1089
1467
  };
1090
1468
  getTOTPURI: {
1091
- <C extends [{
1092
- body: {
1469
+ <C extends [better_call.InputContext<"/two-factor/get-totp-uri", {
1470
+ method: "POST";
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
+ }, {
1093
1499
  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
+ };
1094
1523
  };
1095
- method?: "POST" | undefined;
1096
- query?: Record<string, any> | undefined;
1097
- params?: Record<string, any> | undefined;
1098
- request?: Request | undefined;
1099
- headers?: HeadersInit | undefined;
1100
- asResponse?: boolean | undefined;
1101
- returnHeaders?: boolean | undefined;
1102
- use?: better_call.Middleware[] | undefined;
1103
- path?: string | undefined;
1104
- }]>(...inputCtx: C): Promise<C extends [{
1524
+ } & {
1525
+ use: any[];
1526
+ }>]>(...inputCtx: C): Promise<C extends [{
1105
1527
  asResponse: true;
1106
1528
  }] ? Response : C extends [{
1107
1529
  returnHeaders: true;
@@ -1115,15 +1537,7 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1115
1537
  }>;
1116
1538
  options: {
1117
1539
  method: "POST";
1118
- use: ((inputContext: {
1119
- body?: any;
1120
- query?: Record<string, any> | undefined;
1121
- request?: Request | undefined;
1122
- headers?: Headers | undefined;
1123
- asResponse?: boolean | undefined;
1124
- returnHeaders?: boolean | undefined;
1125
- use?: better_call.Middleware[] | undefined;
1126
- }) => Promise<{
1540
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1127
1541
  session: {
1128
1542
  session: Record<string, any> & {
1129
1543
  id: string;
@@ -1182,21 +1596,115 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1182
1596
  path: "/two-factor/get-totp-uri";
1183
1597
  };
1184
1598
  verifyTOTP: {
1185
- <C extends [{
1186
- body: {
1599
+ <C extends [better_call.InputContext<"/two-factor/verify-totp", {
1600
+ method: "POST";
1601
+ body: z.ZodObject<{
1602
+ code: z.ZodString;
1603
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
1604
+ }, "strip", z.ZodTypeAny, {
1187
1605
  code: string;
1188
1606
  trustDevice?: boolean | undefined;
1607
+ }, {
1608
+ code: string;
1609
+ 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
+ };
1189
1704
  };
1190
- method?: "POST" | undefined;
1191
- query?: Record<string, any> | undefined;
1192
- params?: Record<string, any> | undefined;
1193
- request?: Request | undefined;
1194
- headers?: HeadersInit | undefined;
1195
- asResponse?: boolean | undefined;
1196
- returnHeaders?: boolean | undefined;
1197
- use?: better_call.Middleware[] | undefined;
1198
- path?: string | undefined;
1199
- }]>(...inputCtx: C): Promise<C extends [{
1705
+ } & {
1706
+ use: any[];
1707
+ }>]>(...inputCtx: C): Promise<C extends [{
1200
1708
  asResponse: true;
1201
1709
  }] ? Response : C extends [{
1202
1710
  returnHeaders: true;
@@ -1238,17 +1746,15 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1238
1746
  code: string;
1239
1747
  trustDevice?: boolean | undefined;
1240
1748
  }>;
1241
- use: ((inputContext: {
1242
- body: {
1749
+ use: ((inputContext: better_call.MiddlewareInputContext<{
1750
+ body: z.ZodObject<{
1751
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
1752
+ }, "strip", z.ZodTypeAny, {
1243
1753
  trustDevice?: boolean | undefined;
1244
- };
1245
- query?: Record<string, any> | undefined;
1246
- request?: Request | undefined;
1247
- headers?: Headers | undefined;
1248
- asResponse?: boolean | undefined;
1249
- returnHeaders?: boolean | undefined;
1250
- use?: better_call.Middleware[] | undefined;
1251
- }) => Promise<{
1754
+ }, {
1755
+ trustDevice?: boolean | undefined;
1756
+ }>;
1757
+ }>) => Promise<{
1252
1758
  valid: (ctx: GenericEndpointContext) => Promise<{
1253
1759
  token: string;
1254
1760
  user: {
@@ -1344,15 +1850,7 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1344
1850
  hooks: {
1345
1851
  after: {
1346
1852
  matcher(context: HookEndpointContext): boolean;
1347
- handler: (inputContext: {
1348
- body?: any;
1349
- query?: Record<string, any> | undefined;
1350
- request?: Request | undefined;
1351
- headers?: Headers | undefined;
1352
- asResponse?: boolean | undefined;
1353
- returnHeaders?: boolean | undefined;
1354
- use?: better_call.Middleware[] | undefined;
1355
- }) => Promise<{
1853
+ handler: (inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1356
1854
  twoFactorRedirect: boolean;
1357
1855
  } | undefined>;
1358
1856
  }[];