@gatwech/auth 1.0.0-beta.18

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 (422) hide show
  1. package/README.md +31 -0
  2. package/dist/access-BO2g7QVe.mjs +45 -0
  3. package/dist/access-C6O_osEz.mjs +79 -0
  4. package/dist/access-DT1f6l5k.mjs +51 -0
  5. package/dist/adapter-factory-BZ2Qiqpn.mjs +640 -0
  6. package/dist/adapters/drizzle-adapter/index.d.mts +47 -0
  7. package/dist/adapters/drizzle-adapter/index.mjs +208 -0
  8. package/dist/adapters/index.d.mts +132 -0
  9. package/dist/adapters/index.mjs +18 -0
  10. package/dist/adapters/kysely-adapter/index.d.mts +47 -0
  11. package/dist/adapters/kysely-adapter/index.mjs +11 -0
  12. package/dist/adapters/memory-adapter/index.d.mts +14 -0
  13. package/dist/adapters/memory-adapter/index.mjs +154 -0
  14. package/dist/adapters/mongodb-adapter/index.d.mts +35 -0
  15. package/dist/adapters/mongodb-adapter/index.mjs +315 -0
  16. package/dist/adapters/prisma-adapter/index.d.mts +34 -0
  17. package/dist/adapters/prisma-adapter/index.mjs +159 -0
  18. package/dist/adapters/test.d.mts +81 -0
  19. package/dist/adapters/test.mjs +793 -0
  20. package/dist/admin-Bcq53Nwj.mjs +743 -0
  21. package/dist/admin-DtfO1PLg.d.mts +1689 -0
  22. package/dist/anonymous-CRt1imBW.mjs +107 -0
  23. package/dist/api/index.d.mts +6 -0
  24. package/dist/api/index.mjs +17 -0
  25. package/dist/api-0pR_I-Nx.mjs +3139 -0
  26. package/dist/auth-CBUoBX6o.mjs +233 -0
  27. package/dist/bearer-Djf_awfo.mjs +63 -0
  28. package/dist/bun-sqlite-dialect-CeNvMaZz.mjs +155 -0
  29. package/dist/captcha-BqaMxlKC.mjs +178 -0
  30. package/dist/chunk-BK_LfMhE.mjs +40 -0
  31. package/dist/client/index.d.mts +186 -0
  32. package/dist/client/index.mjs +7 -0
  33. package/dist/client/plugins/index.d.mts +949 -0
  34. package/dist/client/plugins/index.mjs +539 -0
  35. package/dist/client/react/index.d.mts +179 -0
  36. package/dist/client/react/index.mjs +69 -0
  37. package/dist/client-BOX93C3d.d.mts +1250 -0
  38. package/dist/client-CNY0tn9g.d.mts +628 -0
  39. package/dist/client-CygJhqeB.mjs +29 -0
  40. package/dist/client-WiN43tAS.mjs +17 -0
  41. package/dist/client-aExCkfwm.mjs +30 -0
  42. package/dist/cookies/index.d.mts +7 -0
  43. package/dist/cookies/index.mjs +7 -0
  44. package/dist/cookies-cJObLwn1.mjs +597 -0
  45. package/dist/crypto/index.d.mts +44 -0
  46. package/dist/crypto/index.mjs +4 -0
  47. package/dist/crypto-Bb42eMrH.mjs +70 -0
  48. package/dist/custom-session-L3t7ecsd.mjs +67 -0
  49. package/dist/date-Cx2yCiC4.mjs +115 -0
  50. package/dist/db/index.d.mts +7 -0
  51. package/dist/db/index.mjs +15 -0
  52. package/dist/db-BrstmDhc.mjs +1124 -0
  53. package/dist/device-authorization-V4s3h4Mj.mjs +557 -0
  54. package/dist/dialect-CeddeGHf.mjs +72 -0
  55. package/dist/email-otp-BtDHSw14.mjs +592 -0
  56. package/dist/esm-C-QicDNz.mjs +4090 -0
  57. package/dist/generic-oauth-CL5X27ZI.mjs +445 -0
  58. package/dist/get-request-ip-DSjrEpGo.mjs +27 -0
  59. package/dist/get-tables-BQP7YW9c.mjs +249 -0
  60. package/dist/has-permission-BpAr7uCn.mjs +14 -0
  61. package/dist/haveibeenpwned-cMpJvmzI.mjs +43 -0
  62. package/dist/helper-tmxW3BHj.d.mts +21 -0
  63. package/dist/index-34ONrP8l.d.mts +503 -0
  64. package/dist/index-65G5U5DB-DSdjzreF.d.mts +2543 -0
  65. package/dist/index-B-XKqFvY.d.mts +30 -0
  66. package/dist/index-B3n8e37d.d.mts +165 -0
  67. package/dist/index-BBm8nQ9Q.d.mts +42 -0
  68. package/dist/index-BHoQlf7a.d.mts +7699 -0
  69. package/dist/index-BYMI9r_d.d.mts +257 -0
  70. package/dist/index-BqhKCbPH.d.mts +36 -0
  71. package/dist/index-Buhn3hkR.d.mts +433 -0
  72. package/dist/index-C-u1h_WX.d.mts +174 -0
  73. package/dist/index-C7fQuk-V.d.mts +41 -0
  74. package/dist/index-CM-CFWwr.d.mts +1919 -0
  75. package/dist/index-CuFzhoS6.d.mts +359 -0
  76. package/dist/index-Cxi7TbLE.d.mts +11347 -0
  77. package/dist/index-DB7t8whN.d.mts +1 -0
  78. package/dist/index-DKNNV1kb.d.mts +626 -0
  79. package/dist/index-DR0xXno9.d.mts +113 -0
  80. package/dist/index-D_k662QG.d.mts +833 -0
  81. package/dist/index-DaBcikv9.d.mts +118 -0
  82. package/dist/index-DlaMq1nb.d.mts +955 -0
  83. package/dist/index-DoXZYQpq.d.mts +290 -0
  84. package/dist/index-G6V0Z_Mn.d.mts +125 -0
  85. package/dist/index-z0KSvE5i.d.mts +246 -0
  86. package/dist/index-zjjNBRY2.d.mts +95 -0
  87. package/dist/index.d.mts +12 -0
  88. package/dist/index.mjs +33 -0
  89. package/dist/integrations/next-js.d.mts +21 -0
  90. package/dist/integrations/next-js.mjs +62 -0
  91. package/dist/integrations/node.d.mts +15 -0
  92. package/dist/integrations/node.mjs +15 -0
  93. package/dist/integrations/react-start.d.mts +15 -0
  94. package/dist/integrations/react-start.mjs +46 -0
  95. package/dist/json-D0TBLy4q.mjs +24 -0
  96. package/dist/jwt-CmxZAGe2.mjs +94 -0
  97. package/dist/jwt-lHV4QHpD.mjs +387 -0
  98. package/dist/kysely-adapter-DpzYO8Yf.mjs +181 -0
  99. package/dist/magic-link-Bk-ueorR.mjs +176 -0
  100. package/dist/misc-beA1w3XV.mjs +7 -0
  101. package/dist/multi-session-DRrLKrg9.mjs +144 -0
  102. package/dist/node-sqlite-dialect-BcKxBQnm.mjs +155 -0
  103. package/dist/oauth-proxy-D1sWh9B_.mjs +133 -0
  104. package/dist/oauth2/index.d.mts +60 -0
  105. package/dist/oauth2/index.mjs +19 -0
  106. package/dist/one-tap-DMswkTEc.mjs +113 -0
  107. package/dist/organization-BArHO_5v.mjs +3857 -0
  108. package/dist/parser-DcrIEuXE.mjs +73 -0
  109. package/dist/passkey-CcD4CnhM.mjs +558 -0
  110. package/dist/password-sVC4nePO.mjs +25 -0
  111. package/dist/permission-DLYUF3cW.mjs +15 -0
  112. package/dist/phone-number-rHDIlh-2.mjs +485 -0
  113. package/dist/plugin-helper-4L-lzsjZ.mjs +16 -0
  114. package/dist/plugins/access/index.d.mts +3 -0
  115. package/dist/plugins/access/index.mjs +3 -0
  116. package/dist/plugins/admin/access/index.d.mts +116 -0
  117. package/dist/plugins/admin/access/index.mjs +4 -0
  118. package/dist/plugins/admin/index.d.mts +9 -0
  119. package/dist/plugins/admin/index.mjs +22 -0
  120. package/dist/plugins/anonymous/index.d.mts +7 -0
  121. package/dist/plugins/anonymous/index.mjs +18 -0
  122. package/dist/plugins/bearer/index.d.mts +2 -0
  123. package/dist/plugins/bearer/index.mjs +8 -0
  124. package/dist/plugins/captcha/index.d.mts +2 -0
  125. package/dist/plugins/captcha/index.mjs +4 -0
  126. package/dist/plugins/custom-session/index.d.mts +7 -0
  127. package/dist/plugins/custom-session/index.mjs +19 -0
  128. package/dist/plugins/device-authorization/index.d.mts +4 -0
  129. package/dist/plugins/device-authorization/index.mjs +18 -0
  130. package/dist/plugins/email-otp/index.d.mts +3 -0
  131. package/dist/plugins/email-otp/index.mjs +19 -0
  132. package/dist/plugins/generic-oauth/index.d.mts +7 -0
  133. package/dist/plugins/generic-oauth/index.mjs +18 -0
  134. package/dist/plugins/haveibeenpwned/index.d.mts +2 -0
  135. package/dist/plugins/haveibeenpwned/index.mjs +18 -0
  136. package/dist/plugins/index.d.mts +139 -0
  137. package/dist/plugins/index.mjs +47 -0
  138. package/dist/plugins/jwt/index.d.mts +7 -0
  139. package/dist/plugins/jwt/index.mjs +18 -0
  140. package/dist/plugins/magic-link/index.d.mts +2 -0
  141. package/dist/plugins/magic-link/index.mjs +18 -0
  142. package/dist/plugins/multi-session/index.d.mts +3 -0
  143. package/dist/plugins/multi-session/index.mjs +18 -0
  144. package/dist/plugins/oauth-proxy/index.d.mts +2 -0
  145. package/dist/plugins/oauth-proxy/index.mjs +18 -0
  146. package/dist/plugins/one-tap/index.d.mts +2 -0
  147. package/dist/plugins/one-tap/index.mjs +18 -0
  148. package/dist/plugins/one-time-token/index.d.mts +7 -0
  149. package/dist/plugins/one-time-token/index.mjs +47 -0
  150. package/dist/plugins/organization/access/index.d.mts +4 -0
  151. package/dist/plugins/organization/access/index.mjs +4 -0
  152. package/dist/plugins/organization/index.d.mts +9 -0
  153. package/dist/plugins/organization/index.mjs +22 -0
  154. package/dist/plugins/passkey/index.d.mts +7 -0
  155. package/dist/plugins/passkey/index.mjs +18 -0
  156. package/dist/plugins/phone-number/index.d.mts +7 -0
  157. package/dist/plugins/phone-number/index.mjs +18 -0
  158. package/dist/plugins/two-factor/index.d.mts +7 -0
  159. package/dist/plugins/two-factor/index.mjs +20 -0
  160. package/dist/plugins/username/index.d.mts +4 -0
  161. package/dist/plugins/username/index.mjs +18 -0
  162. package/dist/plugins-3jfNste3.mjs +1544 -0
  163. package/dist/plugins-hFZT3hmK.d.mts +14 -0
  164. package/dist/promise-8rrEHRXd.mjs +23154 -0
  165. package/dist/proxy-CL9PZXJA.mjs +441 -0
  166. package/dist/session-Dgp133Yt.mjs +413 -0
  167. package/dist/social-providers/index.d.mts +1 -0
  168. package/dist/social-providers/index.mjs +3 -0
  169. package/dist/src/adapters/adapter-factory/index.d.ts +10 -0
  170. package/dist/src/adapters/adapter-factory/types.d.ts +124 -0
  171. package/dist/src/adapters/create-test-suite.d.ts +97 -0
  172. package/dist/src/adapters/drizzle-adapter/drizzle-adapter.d.ts +43 -0
  173. package/dist/src/adapters/drizzle-adapter/index.d.ts +1 -0
  174. package/dist/src/adapters/drizzle-adapter/test/generate-schema.d.ts +12 -0
  175. package/dist/src/adapters/index.d.ts +21 -0
  176. package/dist/src/adapters/kysely-adapter/bun-sqlite-dialect.d.ts +58 -0
  177. package/dist/src/adapters/kysely-adapter/dialect.d.ts +13 -0
  178. package/dist/src/adapters/kysely-adapter/index.d.ts +3 -0
  179. package/dist/src/adapters/kysely-adapter/kysely-adapter.d.ts +32 -0
  180. package/dist/src/adapters/kysely-adapter/node-sqlite-dialect.d.ts +58 -0
  181. package/dist/src/adapters/kysely-adapter/types.d.ts +1 -0
  182. package/dist/src/adapters/memory-adapter/index.d.ts +1 -0
  183. package/dist/src/adapters/memory-adapter/memory-adapter.d.ts +9 -0
  184. package/dist/src/adapters/mongodb-adapter/index.d.ts +1 -0
  185. package/dist/src/adapters/mongodb-adapter/mongodb-adapter.d.ts +31 -0
  186. package/dist/src/adapters/prisma-adapter/index.d.ts +1 -0
  187. package/dist/src/adapters/prisma-adapter/prisma-adapter.d.ts +32 -0
  188. package/dist/src/adapters/prisma-adapter/test/auth.d.ts +3 -0
  189. package/dist/src/adapters/prisma-adapter/test/generate-auth-config.d.ts +2 -0
  190. package/dist/src/adapters/prisma-adapter/test/generate-prisma-schema.d.ts +3 -0
  191. package/dist/src/adapters/prisma-adapter/test/get-prisma-client.d.ts +7 -0
  192. package/dist/src/adapters/prisma-adapter/test/push-prisma-schema.d.ts +1 -0
  193. package/dist/src/adapters/test-adapter.d.ts +61 -0
  194. package/dist/src/adapters/test.d.ts +78 -0
  195. package/dist/src/adapters/tests/auth-flow.d.ts +22 -0
  196. package/dist/src/adapters/tests/index.d.ts +5 -0
  197. package/dist/src/adapters/tests/normal.d.ts +87 -0
  198. package/dist/src/adapters/tests/number-id.d.ts +17 -0
  199. package/dist/src/adapters/tests/performance.d.ts +24 -0
  200. package/dist/src/adapters/tests/transactions.d.ts +20 -0
  201. package/dist/src/adapters/utils.d.ts +3 -0
  202. package/dist/src/api/index.d.ts +7150 -0
  203. package/dist/src/api/middlewares/index.d.ts +2 -0
  204. package/dist/src/api/middlewares/oauth.d.ts +15 -0
  205. package/dist/src/api/middlewares/origin-check.d.ts +8 -0
  206. package/dist/src/api/rate-limiter/index.d.ts +13 -0
  207. package/dist/src/api/routes/account.d.ts +623 -0
  208. package/dist/src/api/routes/callback.d.ts +68 -0
  209. package/dist/src/api/routes/email-verification.d.ts +266 -0
  210. package/dist/src/api/routes/error.d.ts +51 -0
  211. package/dist/src/api/routes/index.d.ts +11 -0
  212. package/dist/src/api/routes/ok.d.ts +61 -0
  213. package/dist/src/api/routes/reset-password.d.ts +203 -0
  214. package/dist/src/api/routes/session.d.ts +586 -0
  215. package/dist/src/api/routes/sign-in.d.ts +298 -0
  216. package/dist/src/api/routes/sign-out.d.ts +59 -0
  217. package/dist/src/api/routes/sign-up.d.ts +625 -0
  218. package/dist/src/api/routes/update-user.d.ts +862 -0
  219. package/dist/src/api/to-auth-endpoints.d.ts +3 -0
  220. package/dist/src/auth.d.ts +25 -0
  221. package/dist/src/client/broadcast-channel.d.ts +12 -0
  222. package/dist/src/client/config.d.ts +85 -0
  223. package/dist/src/client/fetch-plugins.d.ts +14 -0
  224. package/dist/src/client/index.d.ts +15 -0
  225. package/dist/src/client/parser.d.ts +12 -0
  226. package/dist/src/client/path-to-object.d.ts +63 -0
  227. package/dist/src/client/plugins/index.d.ts +21 -0
  228. package/dist/src/client/plugins/infer-plugin.d.ts +11 -0
  229. package/dist/src/client/proxy.d.ts +8 -0
  230. package/dist/src/client/query.d.ts +16 -0
  231. package/dist/src/client/react/index.d.ts +130 -0
  232. package/dist/src/client/react/react-store.d.ts +43 -0
  233. package/dist/src/client/session-atom.d.ts +18 -0
  234. package/dist/src/client/session-refresh.d.ts +17 -0
  235. package/dist/src/client/test-plugin.d.ts +147 -0
  236. package/dist/src/client/types.d.ts +49 -0
  237. package/dist/src/client/vanilla.d.ts +124 -0
  238. package/dist/src/cookies/check-cookies.d.ts +4 -0
  239. package/dist/src/cookies/cookie-utils.d.ts +16 -0
  240. package/dist/src/cookies/index.d.ts +56 -0
  241. package/dist/src/cookies/session-store.d.ts +43 -0
  242. package/dist/src/crypto/buffer.d.ts +4 -0
  243. package/dist/src/crypto/index.d.ts +14 -0
  244. package/dist/src/crypto/jwt.d.ts +4 -0
  245. package/dist/src/crypto/password.d.ts +5 -0
  246. package/dist/src/crypto/random.d.ts +1 -0
  247. package/dist/src/db/field.d.ts +97 -0
  248. package/dist/src/db/get-migration.d.ts +18 -0
  249. package/dist/src/db/get-schema.d.ts +6 -0
  250. package/dist/src/db/get-tables.d.ts +3 -0
  251. package/dist/src/db/index.d.ts +10 -0
  252. package/dist/src/db/internal-adapter.d.ts +9 -0
  253. package/dist/src/db/schema.d.ts +76 -0
  254. package/dist/src/db/to-zod.d.ts +31 -0
  255. package/dist/src/db/utils.d.ts +6 -0
  256. package/dist/src/db/with-hooks.d.ts +27 -0
  257. package/dist/src/index.d.ts +14 -0
  258. package/dist/src/init.d.ts +2 -0
  259. package/dist/src/integrations/next-js.d.ts +15 -0
  260. package/dist/src/integrations/node.d.ts +6 -0
  261. package/dist/src/integrations/react-start.d.ts +9 -0
  262. package/dist/src/oauth2/index.d.ts +4 -0
  263. package/dist/src/oauth2/link-account.d.ts +41 -0
  264. package/dist/src/oauth2/state.d.ts +21 -0
  265. package/dist/src/oauth2/utils.d.ts +3 -0
  266. package/dist/src/plugins/access/access.d.ts +25 -0
  267. package/dist/src/plugins/access/index.d.ts +2 -0
  268. package/dist/src/plugins/access/types.d.ts +14 -0
  269. package/dist/src/plugins/additional-fields/client.d.ts +91 -0
  270. package/dist/src/plugins/admin/access/index.d.ts +1 -0
  271. package/dist/src/plugins/admin/access/statement.d.ts +110 -0
  272. package/dist/src/plugins/admin/admin.d.ts +1570 -0
  273. package/dist/src/plugins/admin/client.d.ts +62 -0
  274. package/dist/src/plugins/admin/error-codes.d.ts +21 -0
  275. package/dist/src/plugins/admin/has-permission.d.ts +21 -0
  276. package/dist/src/plugins/admin/index.d.ts +2 -0
  277. package/dist/src/plugins/admin/schema.d.ts +36 -0
  278. package/dist/src/plugins/admin/types.d.ts +77 -0
  279. package/dist/src/plugins/anonymous/client.d.ts +8 -0
  280. package/dist/src/plugins/anonymous/index.d.ts +159 -0
  281. package/dist/src/plugins/api-key/client.d.ts +11 -0
  282. package/dist/src/plugins/api-key/index.d.ts +1431 -0
  283. package/dist/src/plugins/api-key/rate-limit.d.ts +20 -0
  284. package/dist/src/plugins/api-key/routes/create-api-key.d.ts +244 -0
  285. package/dist/src/plugins/api-key/routes/delete-all-expired-api-keys.d.ts +45 -0
  286. package/dist/src/plugins/api-key/routes/delete-api-key.d.ts +112 -0
  287. package/dist/src/plugins/api-key/routes/get-api-key.d.ts +234 -0
  288. package/dist/src/plugins/api-key/routes/index.d.ts +1136 -0
  289. package/dist/src/plugins/api-key/routes/list-api-keys.d.ts +231 -0
  290. package/dist/src/plugins/api-key/routes/update-api-key.d.ts +235 -0
  291. package/dist/src/plugins/api-key/routes/verify-api-key.d.ts +80 -0
  292. package/dist/src/plugins/api-key/schema.d.ts +188 -0
  293. package/dist/src/plugins/api-key/types.d.ts +285 -0
  294. package/dist/src/plugins/bearer/index.d.ts +31 -0
  295. package/dist/src/plugins/captcha/constants.d.ts +9 -0
  296. package/dist/src/plugins/captcha/error-codes.d.ts +9 -0
  297. package/dist/src/plugins/captcha/index.d.ts +7 -0
  298. package/dist/src/plugins/captcha/types.d.ts +23 -0
  299. package/dist/src/plugins/captcha/utils.d.ts +1 -0
  300. package/dist/src/plugins/captcha/verify-handlers/captchafox.d.ts +11 -0
  301. package/dist/src/plugins/captcha/verify-handlers/cloudflare-turnstile.d.ts +10 -0
  302. package/dist/src/plugins/captcha/verify-handlers/google-recaptcha.d.ts +11 -0
  303. package/dist/src/plugins/captcha/verify-handlers/h-captcha.d.ts +11 -0
  304. package/dist/src/plugins/captcha/verify-handlers/index.d.ts +4 -0
  305. package/dist/src/plugins/custom-session/client.d.ts +12 -0
  306. package/dist/src/plugins/custom-session/index.d.ts +89 -0
  307. package/dist/src/plugins/device-authorization/client.d.ts +12 -0
  308. package/dist/src/plugins/device-authorization/index.d.ts +568 -0
  309. package/dist/src/plugins/device-authorization/schema.d.ts +56 -0
  310. package/dist/src/plugins/email-otp/client.d.ts +9 -0
  311. package/dist/src/plugins/email-otp/index.d.ts +826 -0
  312. package/dist/src/plugins/email-otp/utils.d.ts +2 -0
  313. package/dist/src/plugins/generic-oauth/client.d.ts +5 -0
  314. package/dist/src/plugins/generic-oauth/index.d.ts +428 -0
  315. package/dist/src/plugins/haveibeenpwned/index.d.ts +25 -0
  316. package/dist/src/plugins/index.d.ts +28 -0
  317. package/dist/src/plugins/jwt/adapter.d.ts +8 -0
  318. package/dist/src/plugins/jwt/client.d.ts +5 -0
  319. package/dist/src/plugins/jwt/index.d.ts +276 -0
  320. package/dist/src/plugins/jwt/schema.d.ts +18 -0
  321. package/dist/src/plugins/jwt/sign.d.ts +8 -0
  322. package/dist/src/plugins/jwt/types.d.ts +175 -0
  323. package/dist/src/plugins/jwt/utils.d.ts +46 -0
  324. package/dist/src/plugins/last-login-method/client.d.ts +34 -0
  325. package/dist/src/plugins/last-login-method/index.d.ts +103 -0
  326. package/dist/src/plugins/magic-link/client.d.ts +5 -0
  327. package/dist/src/plugins/magic-link/index.d.ts +253 -0
  328. package/dist/src/plugins/magic-link/utils.d.ts +1 -0
  329. package/dist/src/plugins/multi-session/client.d.ts +9 -0
  330. package/dist/src/plugins/multi-session/index.d.ts +284 -0
  331. package/dist/src/plugins/oauth-proxy/index.d.ts +119 -0
  332. package/dist/src/plugins/one-tap/client.d.ts +81 -0
  333. package/dist/src/plugins/one-tap/index.d.ts +114 -0
  334. package/dist/src/plugins/one-time-token/client.d.ts +5 -0
  335. package/dist/src/plugins/one-time-token/index.d.ts +170 -0
  336. package/dist/src/plugins/one-time-token/utils.d.ts +1 -0
  337. package/dist/src/plugins/organization/access/index.d.ts +1 -0
  338. package/dist/src/plugins/organization/access/statement.d.ts +241 -0
  339. package/dist/src/plugins/organization/adapter.d.ts +685 -0
  340. package/dist/src/plugins/organization/call.d.ts +55 -0
  341. package/dist/src/plugins/organization/client.d.ts +344 -0
  342. package/dist/src/plugins/organization/error-codes.d.ts +58 -0
  343. package/dist/src/plugins/organization/has-permission.d.ts +13 -0
  344. package/dist/src/plugins/organization/index.d.ts +4 -0
  345. package/dist/src/plugins/organization/organization.d.ts +412 -0
  346. package/dist/src/plugins/organization/permission.d.ts +27 -0
  347. package/dist/src/plugins/organization/routes/crud-access-control.d.ts +701 -0
  348. package/dist/src/plugins/organization/routes/crud-invites.d.ts +1522 -0
  349. package/dist/src/plugins/organization/routes/crud-members.d.ts +1220 -0
  350. package/dist/src/plugins/organization/routes/crud-org.d.ts +1399 -0
  351. package/dist/src/plugins/organization/routes/crud-team.d.ts +1323 -0
  352. package/dist/src/plugins/organization/schema.d.ts +366 -0
  353. package/dist/src/plugins/organization/types.d.ts +737 -0
  354. package/dist/src/plugins/passkey/client.d.ts +190 -0
  355. package/dist/src/plugins/passkey/error-codes.d.ts +9 -0
  356. package/dist/src/plugins/passkey/index.d.ts +838 -0
  357. package/dist/src/plugins/passkey/schema.d.ts +50 -0
  358. package/dist/src/plugins/passkey/types.d.ts +69 -0
  359. package/dist/src/plugins/passkey/utils.d.ts +2 -0
  360. package/dist/src/plugins/phone-number/client.d.ts +9 -0
  361. package/dist/src/plugins/phone-number/index.d.ts +622 -0
  362. package/dist/src/plugins/phone-number/phone-number-error.d.ts +10 -0
  363. package/dist/src/plugins/two-factor/backup-codes/index.d.ts +387 -0
  364. package/dist/src/plugins/two-factor/client.d.ts +28 -0
  365. package/dist/src/plugins/two-factor/constant.d.ts +2 -0
  366. package/dist/src/plugins/two-factor/error-code.d.ts +11 -0
  367. package/dist/src/plugins/two-factor/index.d.ts +1014 -0
  368. package/dist/src/plugins/two-factor/otp/index.d.ts +282 -0
  369. package/dist/src/plugins/two-factor/schema.d.ts +35 -0
  370. package/dist/src/plugins/two-factor/totp/index.d.ts +298 -0
  371. package/dist/src/plugins/two-factor/types.d.ts +50 -0
  372. package/dist/src/plugins/two-factor/utils.d.ts +1 -0
  373. package/dist/src/plugins/two-factor/verify-two-factor.d.ts +59 -0
  374. package/dist/src/plugins/username/client.d.ts +5 -0
  375. package/dist/src/plugins/username/error-codes.d.ts +10 -0
  376. package/dist/src/plugins/username/index.d.ts +313 -0
  377. package/dist/src/plugins/username/schema.d.ts +27 -0
  378. package/dist/src/social-providers/index.d.ts +1 -0
  379. package/dist/src/test-utils/headers.d.ts +5 -0
  380. package/dist/src/test-utils/index.d.ts +2 -0
  381. package/dist/src/test-utils/test-instance.d.ts +17849 -0
  382. package/dist/src/types/adapter.d.ts +21 -0
  383. package/dist/src/types/api.d.ts +29 -0
  384. package/dist/src/types/helper.d.ts +32 -0
  385. package/dist/src/types/index.d.ts +7 -0
  386. package/dist/src/types/models.d.ts +13 -0
  387. package/dist/src/types/plugins.d.ts +14 -0
  388. package/dist/src/utils/await-object.d.ts +3 -0
  389. package/dist/src/utils/boolean.d.ts +1 -0
  390. package/dist/src/utils/clone.d.ts +1 -0
  391. package/dist/src/utils/constants.d.ts +1 -0
  392. package/dist/src/utils/date.d.ts +1 -0
  393. package/dist/src/utils/ensure-utc.d.ts +1 -0
  394. package/dist/src/utils/get-request-ip.d.ts +2 -0
  395. package/dist/src/utils/hashing.d.ts +6 -0
  396. package/dist/src/utils/hide-metadata.d.ts +3 -0
  397. package/dist/src/utils/id.d.ts +1 -0
  398. package/dist/src/utils/import-util.d.ts +1 -0
  399. package/dist/src/utils/index.d.ts +5 -0
  400. package/dist/src/utils/is-atom.d.ts +2 -0
  401. package/dist/src/utils/is-promise.d.ts +1 -0
  402. package/dist/src/utils/json.d.ts +1 -0
  403. package/dist/src/utils/merger.d.ts +1 -0
  404. package/dist/src/utils/middleware-response.d.ts +8 -0
  405. package/dist/src/utils/misc.d.ts +1 -0
  406. package/dist/src/utils/password.d.ts +6 -0
  407. package/dist/src/utils/plugin-helper.d.ts +5 -0
  408. package/dist/src/utils/shim.d.ts +3 -0
  409. package/dist/src/utils/time.d.ts +4 -0
  410. package/dist/src/utils/url.d.ts +4 -0
  411. package/dist/src/utils/wildcard.d.ts +45 -0
  412. package/dist/test-utils/index.d.mts +17870 -0
  413. package/dist/test-utils/index.mjs +272 -0
  414. package/dist/two-factor-ClUXxom2.mjs +914 -0
  415. package/dist/types/index.d.mts +6 -0
  416. package/dist/types/index.mjs +3 -0
  417. package/dist/types-B1OL7hyf.d.mts +4 -0
  418. package/dist/types-Bjn15Uy6.mjs +1 -0
  419. package/dist/url-VB2gAbTI.mjs +59 -0
  420. package/dist/username-DiGklOGl.mjs +278 -0
  421. package/dist/utils-SOMB4Px5.mjs +132 -0
  422. package/package.json +447 -0
@@ -0,0 +1,1014 @@
1
+ import * as z from "zod";
2
+ import type { TwoFactorOptions } from "./types";
3
+ export * from "./error-code";
4
+ export declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
5
+ id: "two-factor";
6
+ endpoints: {
7
+ /**
8
+ * ### Endpoint
9
+ *
10
+ * POST `/two-factor/enable`
11
+ *
12
+ * ### API Methods
13
+ *
14
+ * **server:**
15
+ * `auth.api.enableTwoFactor`
16
+ *
17
+ * **client:**
18
+ * `authClient.twoFactor.enable`
19
+ *
20
+ * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/2fa#api-method-two-factor-enable)
21
+ */
22
+ enableTwoFactor: {
23
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
24
+ body: {
25
+ password: string;
26
+ issuer?: string | undefined;
27
+ };
28
+ } & {
29
+ method?: "POST" | undefined;
30
+ } & {
31
+ query?: Record<string, any> | undefined;
32
+ } & {
33
+ params?: Record<string, any>;
34
+ } & {
35
+ request?: Request;
36
+ } & {
37
+ headers?: HeadersInit;
38
+ } & {
39
+ asResponse?: boolean;
40
+ returnHeaders?: boolean;
41
+ use?: import("better-call").Middleware[];
42
+ path?: string;
43
+ } & {
44
+ asResponse?: AsResponse | undefined;
45
+ returnHeaders?: ReturnHeaders | undefined;
46
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
47
+ headers: Headers;
48
+ response: {
49
+ totpURI: string;
50
+ backupCodes: string[];
51
+ };
52
+ } : {
53
+ totpURI: string;
54
+ backupCodes: string[];
55
+ }>;
56
+ options: {
57
+ method: "POST";
58
+ body: z.ZodObject<{
59
+ password: z.ZodString;
60
+ issuer: z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strip>;
62
+ use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
63
+ session: {
64
+ session: Record<string, any> & {
65
+ id: string;
66
+ createdAt: Date;
67
+ updatedAt: Date;
68
+ userId: string;
69
+ expiresAt: Date;
70
+ token: string;
71
+ ipAddress?: string | null | undefined;
72
+ userAgent?: string | null | undefined;
73
+ };
74
+ user: Record<string, any> & {
75
+ id: string;
76
+ createdAt: Date;
77
+ updatedAt: Date;
78
+ email: string;
79
+ emailVerified: boolean;
80
+ name: string;
81
+ image?: string | null | undefined;
82
+ };
83
+ };
84
+ }>)[];
85
+ metadata: {
86
+ openapi: {
87
+ summary: string;
88
+ description: string;
89
+ responses: {
90
+ 200: {
91
+ description: string;
92
+ content: {
93
+ "application/json": {
94
+ schema: {
95
+ type: "object";
96
+ properties: {
97
+ totpURI: {
98
+ type: string;
99
+ description: string;
100
+ };
101
+ backupCodes: {
102
+ type: string;
103
+ items: {
104
+ type: string;
105
+ };
106
+ description: string;
107
+ };
108
+ };
109
+ };
110
+ };
111
+ };
112
+ };
113
+ };
114
+ };
115
+ };
116
+ } & {
117
+ use: any[];
118
+ };
119
+ path: "/two-factor/enable";
120
+ };
121
+ /**
122
+ * ### Endpoint
123
+ *
124
+ * POST `/two-factor/disable`
125
+ *
126
+ * ### API Methods
127
+ *
128
+ * **server:**
129
+ * `auth.api.disableTwoFactor`
130
+ *
131
+ * **client:**
132
+ * `authClient.twoFactor.disable`
133
+ *
134
+ * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/2fa#api-method-two-factor-disable)
135
+ */
136
+ disableTwoFactor: {
137
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
138
+ body: {
139
+ password: string;
140
+ };
141
+ } & {
142
+ method?: "POST" | undefined;
143
+ } & {
144
+ query?: Record<string, any> | undefined;
145
+ } & {
146
+ params?: Record<string, any>;
147
+ } & {
148
+ request?: Request;
149
+ } & {
150
+ headers?: HeadersInit;
151
+ } & {
152
+ asResponse?: boolean;
153
+ returnHeaders?: boolean;
154
+ use?: import("better-call").Middleware[];
155
+ path?: string;
156
+ } & {
157
+ asResponse?: AsResponse | undefined;
158
+ returnHeaders?: ReturnHeaders | undefined;
159
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
160
+ headers: Headers;
161
+ response: {
162
+ status: boolean;
163
+ };
164
+ } : {
165
+ status: boolean;
166
+ }>;
167
+ options: {
168
+ method: "POST";
169
+ body: z.ZodObject<{
170
+ password: z.ZodString;
171
+ }, z.core.$strip>;
172
+ use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
173
+ session: {
174
+ session: Record<string, any> & {
175
+ id: string;
176
+ createdAt: Date;
177
+ updatedAt: Date;
178
+ userId: string;
179
+ expiresAt: Date;
180
+ token: string;
181
+ ipAddress?: string | null | undefined;
182
+ userAgent?: string | null | undefined;
183
+ };
184
+ user: Record<string, any> & {
185
+ id: string;
186
+ createdAt: Date;
187
+ updatedAt: Date;
188
+ email: string;
189
+ emailVerified: boolean;
190
+ name: string;
191
+ image?: string | null | undefined;
192
+ };
193
+ };
194
+ }>)[];
195
+ metadata: {
196
+ openapi: {
197
+ summary: string;
198
+ description: string;
199
+ responses: {
200
+ 200: {
201
+ description: string;
202
+ content: {
203
+ "application/json": {
204
+ schema: {
205
+ type: "object";
206
+ properties: {
207
+ status: {
208
+ type: string;
209
+ };
210
+ };
211
+ };
212
+ };
213
+ };
214
+ };
215
+ };
216
+ };
217
+ };
218
+ } & {
219
+ use: any[];
220
+ };
221
+ path: "/two-factor/disable";
222
+ };
223
+ verifyBackupCode: {
224
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
225
+ body: {
226
+ code: string;
227
+ disableSession?: boolean | undefined;
228
+ trustDevice?: boolean | undefined;
229
+ };
230
+ } & {
231
+ method?: "POST" | undefined;
232
+ } & {
233
+ query?: Record<string, any> | undefined;
234
+ } & {
235
+ params?: Record<string, any>;
236
+ } & {
237
+ request?: Request;
238
+ } & {
239
+ headers?: HeadersInit;
240
+ } & {
241
+ asResponse?: boolean;
242
+ returnHeaders?: boolean;
243
+ use?: import("better-call").Middleware[];
244
+ path?: string;
245
+ } & {
246
+ asResponse?: AsResponse | undefined;
247
+ returnHeaders?: ReturnHeaders | undefined;
248
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
249
+ headers: Headers;
250
+ response: {
251
+ token: string | undefined;
252
+ user: {
253
+ id: string;
254
+ email: string;
255
+ emailVerified: boolean;
256
+ name: string;
257
+ image: string | null | undefined;
258
+ createdAt: Date;
259
+ updatedAt: Date;
260
+ };
261
+ };
262
+ } : {
263
+ token: string | undefined;
264
+ user: {
265
+ id: string;
266
+ email: string;
267
+ emailVerified: boolean;
268
+ name: string;
269
+ image: string | null | undefined;
270
+ createdAt: Date;
271
+ updatedAt: Date;
272
+ };
273
+ }>;
274
+ options: {
275
+ method: "POST";
276
+ body: z.ZodObject<{
277
+ code: z.ZodString;
278
+ disableSession: z.ZodOptional<z.ZodBoolean>;
279
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
280
+ }, z.core.$strip>;
281
+ metadata: {
282
+ openapi: {
283
+ description: string;
284
+ responses: {
285
+ "200": {
286
+ description: string;
287
+ content: {
288
+ "application/json": {
289
+ schema: {
290
+ type: "object";
291
+ properties: {
292
+ user: {
293
+ type: string;
294
+ properties: {
295
+ id: {
296
+ type: string;
297
+ description: string;
298
+ };
299
+ email: {
300
+ type: string;
301
+ format: string;
302
+ nullable: boolean;
303
+ description: string;
304
+ };
305
+ emailVerified: {
306
+ type: string;
307
+ nullable: boolean;
308
+ description: string;
309
+ };
310
+ name: {
311
+ type: string;
312
+ nullable: boolean;
313
+ description: string;
314
+ };
315
+ image: {
316
+ type: string;
317
+ format: string;
318
+ nullable: boolean;
319
+ description: string;
320
+ };
321
+ twoFactorEnabled: {
322
+ type: string;
323
+ description: string;
324
+ };
325
+ createdAt: {
326
+ type: string;
327
+ format: string;
328
+ description: string;
329
+ };
330
+ updatedAt: {
331
+ type: string;
332
+ format: string;
333
+ description: string;
334
+ };
335
+ };
336
+ required: string[];
337
+ description: string;
338
+ };
339
+ session: {
340
+ type: string;
341
+ properties: {
342
+ token: {
343
+ type: string;
344
+ description: string;
345
+ };
346
+ userId: {
347
+ type: string;
348
+ description: string;
349
+ };
350
+ createdAt: {
351
+ type: string;
352
+ format: string;
353
+ description: string;
354
+ };
355
+ expiresAt: {
356
+ type: string;
357
+ format: string;
358
+ description: string;
359
+ };
360
+ };
361
+ required: string[];
362
+ description: string;
363
+ };
364
+ };
365
+ required: string[];
366
+ };
367
+ };
368
+ };
369
+ };
370
+ };
371
+ };
372
+ };
373
+ } & {
374
+ use: any[];
375
+ };
376
+ path: "/two-factor/verify-backup-code";
377
+ };
378
+ generateBackupCodes: {
379
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
380
+ body: {
381
+ password: string;
382
+ };
383
+ } & {
384
+ method?: "POST" | undefined;
385
+ } & {
386
+ query?: Record<string, any> | undefined;
387
+ } & {
388
+ params?: Record<string, any>;
389
+ } & {
390
+ request?: Request;
391
+ } & {
392
+ headers?: HeadersInit;
393
+ } & {
394
+ asResponse?: boolean;
395
+ returnHeaders?: boolean;
396
+ use?: import("better-call").Middleware[];
397
+ path?: string;
398
+ } & {
399
+ asResponse?: AsResponse | undefined;
400
+ returnHeaders?: ReturnHeaders | undefined;
401
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
402
+ headers: Headers;
403
+ response: {
404
+ status: boolean;
405
+ backupCodes: string[];
406
+ };
407
+ } : {
408
+ status: boolean;
409
+ backupCodes: string[];
410
+ }>;
411
+ options: {
412
+ method: "POST";
413
+ body: z.ZodObject<{
414
+ password: z.ZodString;
415
+ }, z.core.$strip>;
416
+ use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
417
+ session: {
418
+ session: Record<string, any> & {
419
+ id: string;
420
+ createdAt: Date;
421
+ updatedAt: Date;
422
+ userId: string;
423
+ expiresAt: Date;
424
+ token: string;
425
+ ipAddress?: string | null | undefined;
426
+ userAgent?: string | null | undefined;
427
+ };
428
+ user: Record<string, any> & {
429
+ id: string;
430
+ createdAt: Date;
431
+ updatedAt: Date;
432
+ email: string;
433
+ emailVerified: boolean;
434
+ name: string;
435
+ image?: string | null | undefined;
436
+ };
437
+ };
438
+ }>)[];
439
+ metadata: {
440
+ openapi: {
441
+ description: string;
442
+ responses: {
443
+ "200": {
444
+ description: string;
445
+ content: {
446
+ "application/json": {
447
+ schema: {
448
+ type: "object";
449
+ properties: {
450
+ status: {
451
+ type: string;
452
+ description: string;
453
+ enum: boolean[];
454
+ };
455
+ backupCodes: {
456
+ type: string;
457
+ items: {
458
+ type: string;
459
+ };
460
+ description: string;
461
+ };
462
+ };
463
+ required: string[];
464
+ };
465
+ };
466
+ };
467
+ };
468
+ };
469
+ };
470
+ };
471
+ } & {
472
+ use: any[];
473
+ };
474
+ path: "/two-factor/generate-backup-codes";
475
+ };
476
+ viewBackupCodes: {
477
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
478
+ body: {
479
+ userId: unknown;
480
+ };
481
+ } & {
482
+ method?: "POST" | undefined;
483
+ } & {
484
+ query?: Record<string, any> | undefined;
485
+ } & {
486
+ params?: Record<string, any>;
487
+ } & {
488
+ request?: Request;
489
+ } & {
490
+ headers?: HeadersInit;
491
+ } & {
492
+ asResponse?: boolean;
493
+ returnHeaders?: boolean;
494
+ use?: import("better-call").Middleware[];
495
+ path?: string;
496
+ } & {
497
+ asResponse?: AsResponse | undefined;
498
+ returnHeaders?: ReturnHeaders | undefined;
499
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
500
+ headers: Headers;
501
+ response: {
502
+ status: boolean;
503
+ backupCodes: string[];
504
+ };
505
+ } : {
506
+ status: boolean;
507
+ backupCodes: string[];
508
+ }>;
509
+ options: {
510
+ method: "POST";
511
+ body: z.ZodObject<{
512
+ userId: z.ZodCoercedString<unknown>;
513
+ }, z.core.$strip>;
514
+ metadata: {
515
+ SERVER_ONLY: true;
516
+ };
517
+ } & {
518
+ use: any[];
519
+ };
520
+ path: "/two-factor/view-backup-codes";
521
+ };
522
+ sendTwoFactorOTP: {
523
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
524
+ body?: {
525
+ trustDevice?: boolean | undefined;
526
+ } | undefined;
527
+ } & {
528
+ method?: "POST" | undefined;
529
+ } & {
530
+ query?: Record<string, any> | undefined;
531
+ } & {
532
+ params?: Record<string, any>;
533
+ } & {
534
+ request?: Request;
535
+ } & {
536
+ headers?: HeadersInit;
537
+ } & {
538
+ asResponse?: boolean;
539
+ returnHeaders?: boolean;
540
+ use?: import("better-call").Middleware[];
541
+ path?: string;
542
+ } & {
543
+ asResponse?: AsResponse | undefined;
544
+ returnHeaders?: ReturnHeaders | undefined;
545
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
546
+ headers: Headers;
547
+ response: {
548
+ status: boolean;
549
+ };
550
+ } : {
551
+ status: boolean;
552
+ }>;
553
+ options: {
554
+ method: "POST";
555
+ body: z.ZodOptional<z.ZodObject<{
556
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
557
+ }, z.core.$strip>>;
558
+ metadata: {
559
+ openapi: {
560
+ summary: string;
561
+ description: string;
562
+ responses: {
563
+ 200: {
564
+ description: string;
565
+ content: {
566
+ "application/json": {
567
+ schema: {
568
+ type: "object";
569
+ properties: {
570
+ status: {
571
+ type: string;
572
+ };
573
+ };
574
+ };
575
+ };
576
+ };
577
+ };
578
+ };
579
+ };
580
+ };
581
+ } & {
582
+ use: any[];
583
+ };
584
+ path: "/two-factor/send-otp";
585
+ };
586
+ verifyTwoFactorOTP: {
587
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
588
+ body: {
589
+ code: string;
590
+ trustDevice?: boolean | undefined;
591
+ };
592
+ } & {
593
+ method?: "POST" | undefined;
594
+ } & {
595
+ query?: Record<string, any> | undefined;
596
+ } & {
597
+ params?: Record<string, any>;
598
+ } & {
599
+ request?: Request;
600
+ } & {
601
+ headers?: HeadersInit;
602
+ } & {
603
+ asResponse?: boolean;
604
+ returnHeaders?: boolean;
605
+ use?: import("better-call").Middleware[];
606
+ path?: string;
607
+ } & {
608
+ asResponse?: AsResponse | undefined;
609
+ returnHeaders?: ReturnHeaders | undefined;
610
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
611
+ headers: Headers;
612
+ response: {
613
+ token: string;
614
+ user: {
615
+ id: any;
616
+ email: any;
617
+ emailVerified: any;
618
+ name: any;
619
+ image: any;
620
+ createdAt: any;
621
+ updatedAt: any;
622
+ };
623
+ };
624
+ } : {
625
+ token: string;
626
+ user: {
627
+ id: any;
628
+ email: any;
629
+ emailVerified: any;
630
+ name: any;
631
+ image: any;
632
+ createdAt: any;
633
+ updatedAt: any;
634
+ };
635
+ }>;
636
+ options: {
637
+ method: "POST";
638
+ body: z.ZodObject<{
639
+ code: z.ZodString;
640
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
641
+ }, z.core.$strip>;
642
+ metadata: {
643
+ openapi: {
644
+ summary: string;
645
+ description: string;
646
+ responses: {
647
+ "200": {
648
+ description: string;
649
+ content: {
650
+ "application/json": {
651
+ schema: {
652
+ type: "object";
653
+ properties: {
654
+ token: {
655
+ type: string;
656
+ description: string;
657
+ };
658
+ user: {
659
+ type: string;
660
+ properties: {
661
+ id: {
662
+ type: string;
663
+ description: string;
664
+ };
665
+ email: {
666
+ type: string;
667
+ format: string;
668
+ nullable: boolean;
669
+ description: string;
670
+ };
671
+ emailVerified: {
672
+ type: string;
673
+ nullable: boolean;
674
+ description: string;
675
+ };
676
+ name: {
677
+ type: string;
678
+ nullable: boolean;
679
+ description: string;
680
+ };
681
+ image: {
682
+ type: string;
683
+ format: string;
684
+ nullable: boolean;
685
+ description: string;
686
+ };
687
+ createdAt: {
688
+ type: string;
689
+ format: string;
690
+ description: string;
691
+ };
692
+ updatedAt: {
693
+ type: string;
694
+ format: string;
695
+ description: string;
696
+ };
697
+ };
698
+ required: string[];
699
+ description: string;
700
+ };
701
+ };
702
+ required: string[];
703
+ };
704
+ };
705
+ };
706
+ };
707
+ };
708
+ };
709
+ };
710
+ } & {
711
+ use: any[];
712
+ };
713
+ path: "/two-factor/verify-otp";
714
+ };
715
+ generateTOTP: {
716
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
717
+ body: {
718
+ secret: string;
719
+ };
720
+ } & {
721
+ method?: "POST" | undefined;
722
+ } & {
723
+ query?: Record<string, any> | undefined;
724
+ } & {
725
+ params?: Record<string, any>;
726
+ } & {
727
+ request?: Request;
728
+ } & {
729
+ headers?: HeadersInit;
730
+ } & {
731
+ asResponse?: boolean;
732
+ returnHeaders?: boolean;
733
+ use?: import("better-call").Middleware[];
734
+ path?: string;
735
+ } & {
736
+ asResponse?: AsResponse | undefined;
737
+ returnHeaders?: ReturnHeaders | undefined;
738
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
739
+ headers: Headers;
740
+ response: {
741
+ code: string;
742
+ };
743
+ } : {
744
+ code: string;
745
+ }>;
746
+ options: {
747
+ method: "POST";
748
+ body: z.ZodObject<{
749
+ secret: z.ZodString;
750
+ }, z.core.$strip>;
751
+ metadata: {
752
+ openapi: {
753
+ summary: string;
754
+ description: string;
755
+ responses: {
756
+ 200: {
757
+ description: string;
758
+ content: {
759
+ "application/json": {
760
+ schema: {
761
+ type: "object";
762
+ properties: {
763
+ code: {
764
+ type: string;
765
+ };
766
+ };
767
+ };
768
+ };
769
+ };
770
+ };
771
+ };
772
+ };
773
+ SERVER_ONLY: true;
774
+ };
775
+ } & {
776
+ use: any[];
777
+ };
778
+ path: "/totp/generate";
779
+ };
780
+ getTOTPURI: {
781
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
782
+ body: {
783
+ password: string;
784
+ };
785
+ } & {
786
+ method?: "POST" | undefined;
787
+ } & {
788
+ query?: Record<string, any> | undefined;
789
+ } & {
790
+ params?: Record<string, any>;
791
+ } & {
792
+ request?: Request;
793
+ } & {
794
+ headers?: HeadersInit;
795
+ } & {
796
+ asResponse?: boolean;
797
+ returnHeaders?: boolean;
798
+ use?: import("better-call").Middleware[];
799
+ path?: string;
800
+ } & {
801
+ asResponse?: AsResponse | undefined;
802
+ returnHeaders?: ReturnHeaders | undefined;
803
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
804
+ headers: Headers;
805
+ response: {
806
+ totpURI: string;
807
+ };
808
+ } : {
809
+ totpURI: string;
810
+ }>;
811
+ options: {
812
+ method: "POST";
813
+ use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
814
+ session: {
815
+ session: Record<string, any> & {
816
+ id: string;
817
+ createdAt: Date;
818
+ updatedAt: Date;
819
+ userId: string;
820
+ expiresAt: Date;
821
+ token: string;
822
+ ipAddress?: string | null | undefined;
823
+ userAgent?: string | null | undefined;
824
+ };
825
+ user: Record<string, any> & {
826
+ id: string;
827
+ createdAt: Date;
828
+ updatedAt: Date;
829
+ email: string;
830
+ emailVerified: boolean;
831
+ name: string;
832
+ image?: string | null | undefined;
833
+ };
834
+ };
835
+ }>)[];
836
+ body: z.ZodObject<{
837
+ password: z.ZodString;
838
+ }, z.core.$strip>;
839
+ metadata: {
840
+ openapi: {
841
+ summary: string;
842
+ description: string;
843
+ responses: {
844
+ 200: {
845
+ description: string;
846
+ content: {
847
+ "application/json": {
848
+ schema: {
849
+ type: "object";
850
+ properties: {
851
+ totpURI: {
852
+ type: string;
853
+ };
854
+ };
855
+ };
856
+ };
857
+ };
858
+ };
859
+ };
860
+ };
861
+ };
862
+ } & {
863
+ use: any[];
864
+ };
865
+ path: "/two-factor/get-totp-uri";
866
+ };
867
+ verifyTOTP: {
868
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
869
+ body: {
870
+ code: string;
871
+ trustDevice?: boolean | undefined;
872
+ };
873
+ } & {
874
+ method?: "POST" | undefined;
875
+ } & {
876
+ query?: Record<string, any> | undefined;
877
+ } & {
878
+ params?: Record<string, any>;
879
+ } & {
880
+ request?: Request;
881
+ } & {
882
+ headers?: HeadersInit;
883
+ } & {
884
+ asResponse?: boolean;
885
+ returnHeaders?: boolean;
886
+ use?: import("better-call").Middleware[];
887
+ path?: string;
888
+ } & {
889
+ asResponse?: AsResponse | undefined;
890
+ returnHeaders?: ReturnHeaders | undefined;
891
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
892
+ headers: Headers;
893
+ response: {
894
+ token: string;
895
+ user: {
896
+ id: string;
897
+ email: string;
898
+ emailVerified: boolean;
899
+ name: string;
900
+ image: string | null | undefined;
901
+ createdAt: Date;
902
+ updatedAt: Date;
903
+ };
904
+ };
905
+ } : {
906
+ token: string;
907
+ user: {
908
+ id: string;
909
+ email: string;
910
+ emailVerified: boolean;
911
+ name: string;
912
+ image: string | null | undefined;
913
+ createdAt: Date;
914
+ updatedAt: Date;
915
+ };
916
+ }>;
917
+ options: {
918
+ method: "POST";
919
+ body: z.ZodObject<{
920
+ code: z.ZodString;
921
+ trustDevice: z.ZodOptional<z.ZodBoolean>;
922
+ }, z.core.$strip>;
923
+ metadata: {
924
+ openapi: {
925
+ summary: string;
926
+ description: string;
927
+ responses: {
928
+ 200: {
929
+ description: string;
930
+ content: {
931
+ "application/json": {
932
+ schema: {
933
+ type: "object";
934
+ properties: {
935
+ status: {
936
+ type: string;
937
+ };
938
+ };
939
+ };
940
+ };
941
+ };
942
+ };
943
+ };
944
+ };
945
+ };
946
+ } & {
947
+ use: any[];
948
+ };
949
+ path: "/two-factor/verify-totp";
950
+ };
951
+ };
952
+ options: TwoFactorOptions | undefined;
953
+ hooks: {
954
+ after: {
955
+ matcher(context: import("@gatwech/core").HookEndpointContext): boolean;
956
+ handler: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
957
+ twoFactorRedirect: boolean;
958
+ } | undefined>;
959
+ }[];
960
+ };
961
+ schema: {
962
+ user: {
963
+ fields: {
964
+ twoFactorEnabled: {
965
+ type: "boolean";
966
+ required: false;
967
+ defaultValue: false;
968
+ input: false;
969
+ };
970
+ };
971
+ };
972
+ twoFactor: {
973
+ fields: {
974
+ secret: {
975
+ type: "string";
976
+ required: true;
977
+ returned: false;
978
+ };
979
+ backupCodes: {
980
+ type: "string";
981
+ required: true;
982
+ returned: false;
983
+ };
984
+ userId: {
985
+ type: "string";
986
+ required: true;
987
+ returned: false;
988
+ references: {
989
+ model: string;
990
+ field: string;
991
+ };
992
+ };
993
+ };
994
+ };
995
+ };
996
+ rateLimit: {
997
+ pathMatcher(path: string): boolean;
998
+ window: number;
999
+ max: number;
1000
+ }[];
1001
+ $ERROR_CODES: {
1002
+ readonly OTP_NOT_ENABLED: "OTP not enabled";
1003
+ readonly OTP_HAS_EXPIRED: "OTP has expired";
1004
+ readonly TOTP_NOT_ENABLED: "TOTP not enabled";
1005
+ readonly TWO_FACTOR_NOT_ENABLED: "Two factor isn't enabled";
1006
+ readonly BACKUP_CODES_NOT_ENABLED: "Backup codes aren't enabled";
1007
+ readonly INVALID_BACKUP_CODE: "Invalid backup code";
1008
+ readonly INVALID_CODE: "Invalid code";
1009
+ readonly TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: "Too many attempts. Please request a new code.";
1010
+ readonly INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie";
1011
+ };
1012
+ };
1013
+ export * from "./client";
1014
+ export * from "./types";