@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,1250 @@
1
+ import { o as LiteralString } from "./helper-tmxW3BHj.mjs";
2
+ import { g as User } from "./index-Cxi7TbLE.mjs";
3
+ import { t as InferOptionSchema } from "./plugins-hFZT3hmK.mjs";
4
+ import * as _gatwech_core14 from "@gatwech/core";
5
+ import { PayvoAuthPlugin } from "@gatwech/core";
6
+ import * as better_call41 from "better-call";
7
+ import * as z$1 from "zod";
8
+ import * as _better_fetch_fetch16 from "@better-fetch/fetch";
9
+
10
+ //#region src/plugins/two-factor/backup-codes/index.d.ts
11
+ interface BackupCodeOptions {
12
+ /**
13
+ * The amount of backup codes to generate
14
+ *
15
+ * @default 10
16
+ */
17
+ amount?: number | undefined;
18
+ /**
19
+ * The length of the backup codes
20
+ *
21
+ * @default 10
22
+ */
23
+ length?: number | undefined;
24
+ /**
25
+ * An optional custom function to generate backup codes
26
+ */
27
+ customBackupCodesGenerate?: (() => string[]) | undefined;
28
+ /**
29
+ * How to store the backup codes in the database, whether encrypted or plain.
30
+ */
31
+ storeBackupCodes?: ("plain" | "encrypted" | {
32
+ encrypt: (token: string) => Promise<string>;
33
+ decrypt: (token: string) => Promise<string>;
34
+ }) | undefined;
35
+ }
36
+ //#endregion
37
+ //#region src/plugins/two-factor/otp/index.d.ts
38
+ interface OTPOptions {
39
+ /**
40
+ * How long the opt will be valid for in
41
+ * minutes
42
+ *
43
+ * @default "3 mins"
44
+ */
45
+ period?: number | undefined;
46
+ /**
47
+ * Number of digits for the OTP code
48
+ *
49
+ * @default 6
50
+ */
51
+ digits?: number | undefined;
52
+ /**
53
+ * Send the otp to the user
54
+ *
55
+ * @param user - The user to send the otp to
56
+ * @param otp - The otp to send
57
+ * @param request - The request object
58
+ * @returns void | Promise<void>
59
+ */
60
+ sendOTP?: ((
61
+ /**
62
+ * The user to send the otp to
63
+ * @type UserWithTwoFactor
64
+ * @default UserWithTwoFactors
65
+ */
66
+ data: {
67
+ user: UserWithTwoFactor;
68
+ otp: string;
69
+ },
70
+ /**
71
+ * The request object
72
+ */
73
+ request?: Request) => Promise<void> | void) | undefined;
74
+ /**
75
+ * The number of allowed attempts for the OTP
76
+ *
77
+ * @default 5
78
+ */
79
+ allowedAttempts?: number | undefined;
80
+ storeOTP?: ("plain" | "encrypted" | "hashed" | {
81
+ hash: (token: string) => Promise<string>;
82
+ } | {
83
+ encrypt: (token: string) => Promise<string>;
84
+ decrypt: (token: string) => Promise<string>;
85
+ }) | undefined;
86
+ }
87
+ //#endregion
88
+ //#region src/plugins/two-factor/schema.d.ts
89
+ declare const schema: {
90
+ user: {
91
+ fields: {
92
+ twoFactorEnabled: {
93
+ type: "boolean";
94
+ required: false;
95
+ defaultValue: false;
96
+ input: false;
97
+ };
98
+ };
99
+ };
100
+ twoFactor: {
101
+ fields: {
102
+ secret: {
103
+ type: "string";
104
+ required: true;
105
+ returned: false;
106
+ };
107
+ backupCodes: {
108
+ type: "string";
109
+ required: true;
110
+ returned: false;
111
+ };
112
+ userId: {
113
+ type: "string";
114
+ required: true;
115
+ returned: false;
116
+ references: {
117
+ model: string;
118
+ field: string;
119
+ };
120
+ };
121
+ };
122
+ };
123
+ };
124
+ //#endregion
125
+ //#region src/plugins/two-factor/totp/index.d.ts
126
+ type TOTPOptions = {
127
+ /**
128
+ * Issuer
129
+ */
130
+ issuer?: string | undefined;
131
+ /**
132
+ * How many digits the otp to be
133
+ *
134
+ * @default 6
135
+ */
136
+ digits?: (6 | 8) | undefined;
137
+ /**
138
+ * Period for otp in seconds.
139
+ * @default 30
140
+ */
141
+ period?: number | undefined;
142
+ /**
143
+ * Backup codes configuration
144
+ */
145
+ backupCodes?: BackupCodeOptions | undefined;
146
+ /**
147
+ * Disable totp
148
+ */
149
+ disable?: boolean | undefined;
150
+ };
151
+ //#endregion
152
+ //#region src/plugins/two-factor/types.d.ts
153
+ interface TwoFactorOptions {
154
+ /**
155
+ * Application Name
156
+ */
157
+ issuer?: string | undefined;
158
+ /**
159
+ * TOTP OPtions
160
+ */
161
+ totpOptions?: Omit<TOTPOptions, "issuer"> | undefined;
162
+ /**
163
+ * OTP Options
164
+ */
165
+ otpOptions?: OTPOptions | undefined;
166
+ /**
167
+ * Backup code options
168
+ */
169
+ backupCodeOptions?: BackupCodeOptions | undefined;
170
+ /**
171
+ * Skip verification on enabling two factor authentication.
172
+ * @default false
173
+ */
174
+ skipVerificationOnEnable?: boolean | undefined;
175
+ /**
176
+ * Custom schema for the two factor plugin
177
+ */
178
+ schema?: InferOptionSchema<typeof schema> | undefined;
179
+ }
180
+ interface UserWithTwoFactor extends User {
181
+ /**
182
+ * If the user has enabled two factor authentication.
183
+ */
184
+ twoFactorEnabled: boolean;
185
+ }
186
+ interface TwoFactorProvider {
187
+ id: LiteralString;
188
+ endpoints?: PayvoAuthPlugin["endpoints"] | undefined;
189
+ }
190
+ interface TwoFactorTable {
191
+ userId: string;
192
+ secret: string;
193
+ backupCodes: string;
194
+ enabled: boolean;
195
+ }
196
+ //#endregion
197
+ //#region src/plugins/two-factor/error-code.d.ts
198
+ declare const TWO_FACTOR_ERROR_CODES: {
199
+ readonly OTP_NOT_ENABLED: "OTP not enabled";
200
+ readonly OTP_HAS_EXPIRED: "OTP has expired";
201
+ readonly TOTP_NOT_ENABLED: "TOTP not enabled";
202
+ readonly TWO_FACTOR_NOT_ENABLED: "Two factor isn't enabled";
203
+ readonly BACKUP_CODES_NOT_ENABLED: "Backup codes aren't enabled";
204
+ readonly INVALID_BACKUP_CODE: "Invalid backup code";
205
+ readonly INVALID_CODE: "Invalid code";
206
+ readonly TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: "Too many attempts. Please request a new code.";
207
+ readonly INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie";
208
+ };
209
+ //#endregion
210
+ //#region src/plugins/two-factor/index.d.ts
211
+ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
212
+ id: "two-factor";
213
+ endpoints: {
214
+ /**
215
+ * ### Endpoint
216
+ *
217
+ * POST `/two-factor/enable`
218
+ *
219
+ * ### API Methods
220
+ *
221
+ * **server:**
222
+ * `auth.api.enableTwoFactor`
223
+ *
224
+ * **client:**
225
+ * `authClient.twoFactor.enable`
226
+ *
227
+ * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/2fa#api-method-two-factor-enable)
228
+ */
229
+ enableTwoFactor: {
230
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
231
+ body: {
232
+ password: string;
233
+ issuer?: string | undefined;
234
+ };
235
+ } & {
236
+ method?: "POST" | undefined;
237
+ } & {
238
+ query?: Record<string, any> | undefined;
239
+ } & {
240
+ params?: Record<string, any>;
241
+ } & {
242
+ request?: Request;
243
+ } & {
244
+ headers?: HeadersInit;
245
+ } & {
246
+ asResponse?: boolean;
247
+ returnHeaders?: boolean;
248
+ use?: better_call41.Middleware[];
249
+ path?: string;
250
+ } & {
251
+ asResponse?: AsResponse | undefined;
252
+ returnHeaders?: ReturnHeaders | undefined;
253
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
254
+ headers: Headers;
255
+ response: {
256
+ totpURI: string;
257
+ backupCodes: string[];
258
+ };
259
+ } : {
260
+ totpURI: string;
261
+ backupCodes: string[];
262
+ }>;
263
+ options: {
264
+ method: "POST";
265
+ body: z$1.ZodObject<{
266
+ password: z$1.ZodString;
267
+ issuer: z$1.ZodOptional<z$1.ZodString>;
268
+ }, z$1.core.$strip>;
269
+ use: ((inputContext: better_call41.MiddlewareInputContext<better_call41.MiddlewareOptions>) => Promise<{
270
+ session: {
271
+ session: Record<string, any> & {
272
+ id: string;
273
+ createdAt: Date;
274
+ updatedAt: Date;
275
+ userId: string;
276
+ expiresAt: Date;
277
+ token: string;
278
+ ipAddress?: string | null | undefined;
279
+ userAgent?: string | null | undefined;
280
+ };
281
+ user: Record<string, any> & {
282
+ id: string;
283
+ createdAt: Date;
284
+ updatedAt: Date;
285
+ email: string;
286
+ emailVerified: boolean;
287
+ name: string;
288
+ image?: string | null | undefined;
289
+ };
290
+ };
291
+ }>)[];
292
+ metadata: {
293
+ openapi: {
294
+ summary: string;
295
+ description: string;
296
+ responses: {
297
+ 200: {
298
+ description: string;
299
+ content: {
300
+ "application/json": {
301
+ schema: {
302
+ type: "object";
303
+ properties: {
304
+ totpURI: {
305
+ type: string;
306
+ description: string;
307
+ };
308
+ backupCodes: {
309
+ type: string;
310
+ items: {
311
+ type: string;
312
+ };
313
+ description: string;
314
+ };
315
+ };
316
+ };
317
+ };
318
+ };
319
+ };
320
+ };
321
+ };
322
+ };
323
+ } & {
324
+ use: any[];
325
+ };
326
+ path: "/two-factor/enable";
327
+ };
328
+ /**
329
+ * ### Endpoint
330
+ *
331
+ * POST `/two-factor/disable`
332
+ *
333
+ * ### API Methods
334
+ *
335
+ * **server:**
336
+ * `auth.api.disableTwoFactor`
337
+ *
338
+ * **client:**
339
+ * `authClient.twoFactor.disable`
340
+ *
341
+ * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/2fa#api-method-two-factor-disable)
342
+ */
343
+ disableTwoFactor: {
344
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
345
+ body: {
346
+ password: string;
347
+ };
348
+ } & {
349
+ method?: "POST" | undefined;
350
+ } & {
351
+ query?: Record<string, any> | undefined;
352
+ } & {
353
+ params?: Record<string, any>;
354
+ } & {
355
+ request?: Request;
356
+ } & {
357
+ headers?: HeadersInit;
358
+ } & {
359
+ asResponse?: boolean;
360
+ returnHeaders?: boolean;
361
+ use?: better_call41.Middleware[];
362
+ path?: string;
363
+ } & {
364
+ asResponse?: AsResponse | undefined;
365
+ returnHeaders?: ReturnHeaders | undefined;
366
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
367
+ headers: Headers;
368
+ response: {
369
+ status: boolean;
370
+ };
371
+ } : {
372
+ status: boolean;
373
+ }>;
374
+ options: {
375
+ method: "POST";
376
+ body: z$1.ZodObject<{
377
+ password: z$1.ZodString;
378
+ }, z$1.core.$strip>;
379
+ use: ((inputContext: better_call41.MiddlewareInputContext<better_call41.MiddlewareOptions>) => Promise<{
380
+ session: {
381
+ session: Record<string, any> & {
382
+ id: string;
383
+ createdAt: Date;
384
+ updatedAt: Date;
385
+ userId: string;
386
+ expiresAt: Date;
387
+ token: string;
388
+ ipAddress?: string | null | undefined;
389
+ userAgent?: string | null | undefined;
390
+ };
391
+ user: Record<string, any> & {
392
+ id: string;
393
+ createdAt: Date;
394
+ updatedAt: Date;
395
+ email: string;
396
+ emailVerified: boolean;
397
+ name: string;
398
+ image?: string | null | undefined;
399
+ };
400
+ };
401
+ }>)[];
402
+ metadata: {
403
+ openapi: {
404
+ summary: string;
405
+ description: string;
406
+ responses: {
407
+ 200: {
408
+ description: string;
409
+ content: {
410
+ "application/json": {
411
+ schema: {
412
+ type: "object";
413
+ properties: {
414
+ status: {
415
+ type: string;
416
+ };
417
+ };
418
+ };
419
+ };
420
+ };
421
+ };
422
+ };
423
+ };
424
+ };
425
+ } & {
426
+ use: any[];
427
+ };
428
+ path: "/two-factor/disable";
429
+ };
430
+ verifyBackupCode: {
431
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
432
+ body: {
433
+ code: string;
434
+ disableSession?: boolean | undefined;
435
+ trustDevice?: boolean | undefined;
436
+ };
437
+ } & {
438
+ method?: "POST" | undefined;
439
+ } & {
440
+ query?: Record<string, any> | undefined;
441
+ } & {
442
+ params?: Record<string, any>;
443
+ } & {
444
+ request?: Request;
445
+ } & {
446
+ headers?: HeadersInit;
447
+ } & {
448
+ asResponse?: boolean;
449
+ returnHeaders?: boolean;
450
+ use?: better_call41.Middleware[];
451
+ path?: string;
452
+ } & {
453
+ asResponse?: AsResponse | undefined;
454
+ returnHeaders?: ReturnHeaders | undefined;
455
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
456
+ headers: Headers;
457
+ response: {
458
+ token: string | undefined;
459
+ user: {
460
+ id: string;
461
+ email: string;
462
+ emailVerified: boolean;
463
+ name: string;
464
+ image: string | null | undefined;
465
+ createdAt: Date;
466
+ updatedAt: Date;
467
+ };
468
+ };
469
+ } : {
470
+ token: string | undefined;
471
+ user: {
472
+ id: string;
473
+ email: string;
474
+ emailVerified: boolean;
475
+ name: string;
476
+ image: string | null | undefined;
477
+ createdAt: Date;
478
+ updatedAt: Date;
479
+ };
480
+ }>;
481
+ options: {
482
+ method: "POST";
483
+ body: z$1.ZodObject<{
484
+ code: z$1.ZodString;
485
+ disableSession: z$1.ZodOptional<z$1.ZodBoolean>;
486
+ trustDevice: z$1.ZodOptional<z$1.ZodBoolean>;
487
+ }, z$1.core.$strip>;
488
+ metadata: {
489
+ openapi: {
490
+ description: string;
491
+ responses: {
492
+ "200": {
493
+ description: string;
494
+ content: {
495
+ "application/json": {
496
+ schema: {
497
+ type: "object";
498
+ properties: {
499
+ user: {
500
+ type: string;
501
+ properties: {
502
+ id: {
503
+ type: string;
504
+ description: string;
505
+ };
506
+ email: {
507
+ type: string;
508
+ format: string;
509
+ nullable: boolean;
510
+ description: string;
511
+ };
512
+ emailVerified: {
513
+ type: string;
514
+ nullable: boolean;
515
+ description: string;
516
+ };
517
+ name: {
518
+ type: string;
519
+ nullable: boolean;
520
+ description: string;
521
+ };
522
+ image: {
523
+ type: string;
524
+ format: string;
525
+ nullable: boolean;
526
+ description: string;
527
+ };
528
+ twoFactorEnabled: {
529
+ type: string;
530
+ description: string;
531
+ };
532
+ createdAt: {
533
+ type: string;
534
+ format: string;
535
+ description: string;
536
+ };
537
+ updatedAt: {
538
+ type: string;
539
+ format: string;
540
+ description: string;
541
+ };
542
+ };
543
+ required: string[];
544
+ description: string;
545
+ };
546
+ session: {
547
+ type: string;
548
+ properties: {
549
+ token: {
550
+ type: string;
551
+ description: string;
552
+ };
553
+ userId: {
554
+ type: string;
555
+ description: string;
556
+ };
557
+ createdAt: {
558
+ type: string;
559
+ format: string;
560
+ description: string;
561
+ };
562
+ expiresAt: {
563
+ type: string;
564
+ format: string;
565
+ description: string;
566
+ };
567
+ };
568
+ required: string[];
569
+ description: string;
570
+ };
571
+ };
572
+ required: string[];
573
+ };
574
+ };
575
+ };
576
+ };
577
+ };
578
+ };
579
+ };
580
+ } & {
581
+ use: any[];
582
+ };
583
+ path: "/two-factor/verify-backup-code";
584
+ };
585
+ generateBackupCodes: {
586
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
587
+ body: {
588
+ password: string;
589
+ };
590
+ } & {
591
+ method?: "POST" | undefined;
592
+ } & {
593
+ query?: Record<string, any> | undefined;
594
+ } & {
595
+ params?: Record<string, any>;
596
+ } & {
597
+ request?: Request;
598
+ } & {
599
+ headers?: HeadersInit;
600
+ } & {
601
+ asResponse?: boolean;
602
+ returnHeaders?: boolean;
603
+ use?: better_call41.Middleware[];
604
+ path?: string;
605
+ } & {
606
+ asResponse?: AsResponse | undefined;
607
+ returnHeaders?: ReturnHeaders | undefined;
608
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
609
+ headers: Headers;
610
+ response: {
611
+ status: boolean;
612
+ backupCodes: string[];
613
+ };
614
+ } : {
615
+ status: boolean;
616
+ backupCodes: string[];
617
+ }>;
618
+ options: {
619
+ method: "POST";
620
+ body: z$1.ZodObject<{
621
+ password: z$1.ZodString;
622
+ }, z$1.core.$strip>;
623
+ use: ((inputContext: better_call41.MiddlewareInputContext<better_call41.MiddlewareOptions>) => Promise<{
624
+ session: {
625
+ session: Record<string, any> & {
626
+ id: string;
627
+ createdAt: Date;
628
+ updatedAt: Date;
629
+ userId: string;
630
+ expiresAt: Date;
631
+ token: string;
632
+ ipAddress?: string | null | undefined;
633
+ userAgent?: string | null | undefined;
634
+ };
635
+ user: Record<string, any> & {
636
+ id: string;
637
+ createdAt: Date;
638
+ updatedAt: Date;
639
+ email: string;
640
+ emailVerified: boolean;
641
+ name: string;
642
+ image?: string | null | undefined;
643
+ };
644
+ };
645
+ }>)[];
646
+ metadata: {
647
+ openapi: {
648
+ description: string;
649
+ responses: {
650
+ "200": {
651
+ description: string;
652
+ content: {
653
+ "application/json": {
654
+ schema: {
655
+ type: "object";
656
+ properties: {
657
+ status: {
658
+ type: string;
659
+ description: string;
660
+ enum: boolean[];
661
+ };
662
+ backupCodes: {
663
+ type: string;
664
+ items: {
665
+ type: string;
666
+ };
667
+ description: string;
668
+ };
669
+ };
670
+ required: string[];
671
+ };
672
+ };
673
+ };
674
+ };
675
+ };
676
+ };
677
+ };
678
+ } & {
679
+ use: any[];
680
+ };
681
+ path: "/two-factor/generate-backup-codes";
682
+ };
683
+ viewBackupCodes: {
684
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
685
+ body: {
686
+ userId: unknown;
687
+ };
688
+ } & {
689
+ method?: "POST" | undefined;
690
+ } & {
691
+ query?: Record<string, any> | undefined;
692
+ } & {
693
+ params?: Record<string, any>;
694
+ } & {
695
+ request?: Request;
696
+ } & {
697
+ headers?: HeadersInit;
698
+ } & {
699
+ asResponse?: boolean;
700
+ returnHeaders?: boolean;
701
+ use?: better_call41.Middleware[];
702
+ path?: string;
703
+ } & {
704
+ asResponse?: AsResponse | undefined;
705
+ returnHeaders?: ReturnHeaders | undefined;
706
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
707
+ headers: Headers;
708
+ response: {
709
+ status: boolean;
710
+ backupCodes: string[];
711
+ };
712
+ } : {
713
+ status: boolean;
714
+ backupCodes: string[];
715
+ }>;
716
+ options: {
717
+ method: "POST";
718
+ body: z$1.ZodObject<{
719
+ userId: z$1.ZodCoercedString<unknown>;
720
+ }, z$1.core.$strip>;
721
+ metadata: {
722
+ SERVER_ONLY: true;
723
+ };
724
+ } & {
725
+ use: any[];
726
+ };
727
+ path: "/two-factor/view-backup-codes";
728
+ };
729
+ sendTwoFactorOTP: {
730
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
731
+ body?: {
732
+ trustDevice?: boolean | undefined;
733
+ } | undefined;
734
+ } & {
735
+ method?: "POST" | undefined;
736
+ } & {
737
+ query?: Record<string, any> | undefined;
738
+ } & {
739
+ params?: Record<string, any>;
740
+ } & {
741
+ request?: Request;
742
+ } & {
743
+ headers?: HeadersInit;
744
+ } & {
745
+ asResponse?: boolean;
746
+ returnHeaders?: boolean;
747
+ use?: better_call41.Middleware[];
748
+ path?: string;
749
+ } & {
750
+ asResponse?: AsResponse | undefined;
751
+ returnHeaders?: ReturnHeaders | undefined;
752
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
753
+ headers: Headers;
754
+ response: {
755
+ status: boolean;
756
+ };
757
+ } : {
758
+ status: boolean;
759
+ }>;
760
+ options: {
761
+ method: "POST";
762
+ body: z$1.ZodOptional<z$1.ZodObject<{
763
+ trustDevice: z$1.ZodOptional<z$1.ZodBoolean>;
764
+ }, z$1.core.$strip>>;
765
+ metadata: {
766
+ openapi: {
767
+ summary: string;
768
+ description: string;
769
+ responses: {
770
+ 200: {
771
+ description: string;
772
+ content: {
773
+ "application/json": {
774
+ schema: {
775
+ type: "object";
776
+ properties: {
777
+ status: {
778
+ type: string;
779
+ };
780
+ };
781
+ };
782
+ };
783
+ };
784
+ };
785
+ };
786
+ };
787
+ };
788
+ } & {
789
+ use: any[];
790
+ };
791
+ path: "/two-factor/send-otp";
792
+ };
793
+ verifyTwoFactorOTP: {
794
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
795
+ body: {
796
+ code: string;
797
+ trustDevice?: boolean | undefined;
798
+ };
799
+ } & {
800
+ method?: "POST" | undefined;
801
+ } & {
802
+ query?: Record<string, any> | undefined;
803
+ } & {
804
+ params?: Record<string, any>;
805
+ } & {
806
+ request?: Request;
807
+ } & {
808
+ headers?: HeadersInit;
809
+ } & {
810
+ asResponse?: boolean;
811
+ returnHeaders?: boolean;
812
+ use?: better_call41.Middleware[];
813
+ path?: string;
814
+ } & {
815
+ asResponse?: AsResponse | undefined;
816
+ returnHeaders?: ReturnHeaders | undefined;
817
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
818
+ headers: Headers;
819
+ response: {
820
+ token: string;
821
+ user: {
822
+ id: any;
823
+ email: any;
824
+ emailVerified: any;
825
+ name: any;
826
+ image: any;
827
+ createdAt: any;
828
+ updatedAt: any;
829
+ };
830
+ };
831
+ } : {
832
+ token: string;
833
+ user: {
834
+ id: any;
835
+ email: any;
836
+ emailVerified: any;
837
+ name: any;
838
+ image: any;
839
+ createdAt: any;
840
+ updatedAt: any;
841
+ };
842
+ }>;
843
+ options: {
844
+ method: "POST";
845
+ body: z$1.ZodObject<{
846
+ code: z$1.ZodString;
847
+ trustDevice: z$1.ZodOptional<z$1.ZodBoolean>;
848
+ }, z$1.core.$strip>;
849
+ metadata: {
850
+ openapi: {
851
+ summary: string;
852
+ description: string;
853
+ responses: {
854
+ "200": {
855
+ description: string;
856
+ content: {
857
+ "application/json": {
858
+ schema: {
859
+ type: "object";
860
+ properties: {
861
+ token: {
862
+ type: string;
863
+ description: string;
864
+ };
865
+ user: {
866
+ type: string;
867
+ properties: {
868
+ id: {
869
+ type: string;
870
+ description: string;
871
+ };
872
+ email: {
873
+ type: string;
874
+ format: string;
875
+ nullable: boolean;
876
+ description: string;
877
+ };
878
+ emailVerified: {
879
+ type: string;
880
+ nullable: boolean;
881
+ description: string;
882
+ };
883
+ name: {
884
+ type: string;
885
+ nullable: boolean;
886
+ description: string;
887
+ };
888
+ image: {
889
+ type: string;
890
+ format: string;
891
+ nullable: boolean;
892
+ description: string;
893
+ };
894
+ createdAt: {
895
+ type: string;
896
+ format: string;
897
+ description: string;
898
+ };
899
+ updatedAt: {
900
+ type: string;
901
+ format: string;
902
+ description: string;
903
+ };
904
+ };
905
+ required: string[];
906
+ description: string;
907
+ };
908
+ };
909
+ required: string[];
910
+ };
911
+ };
912
+ };
913
+ };
914
+ };
915
+ };
916
+ };
917
+ } & {
918
+ use: any[];
919
+ };
920
+ path: "/two-factor/verify-otp";
921
+ };
922
+ generateTOTP: {
923
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
924
+ body: {
925
+ secret: string;
926
+ };
927
+ } & {
928
+ method?: "POST" | undefined;
929
+ } & {
930
+ query?: Record<string, any> | undefined;
931
+ } & {
932
+ params?: Record<string, any>;
933
+ } & {
934
+ request?: Request;
935
+ } & {
936
+ headers?: HeadersInit;
937
+ } & {
938
+ asResponse?: boolean;
939
+ returnHeaders?: boolean;
940
+ use?: better_call41.Middleware[];
941
+ path?: string;
942
+ } & {
943
+ asResponse?: AsResponse | undefined;
944
+ returnHeaders?: ReturnHeaders | undefined;
945
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
946
+ headers: Headers;
947
+ response: {
948
+ code: string;
949
+ };
950
+ } : {
951
+ code: string;
952
+ }>;
953
+ options: {
954
+ method: "POST";
955
+ body: z$1.ZodObject<{
956
+ secret: z$1.ZodString;
957
+ }, z$1.core.$strip>;
958
+ metadata: {
959
+ openapi: {
960
+ summary: string;
961
+ description: string;
962
+ responses: {
963
+ 200: {
964
+ description: string;
965
+ content: {
966
+ "application/json": {
967
+ schema: {
968
+ type: "object";
969
+ properties: {
970
+ code: {
971
+ type: string;
972
+ };
973
+ };
974
+ };
975
+ };
976
+ };
977
+ };
978
+ };
979
+ };
980
+ SERVER_ONLY: true;
981
+ };
982
+ } & {
983
+ use: any[];
984
+ };
985
+ path: "/totp/generate";
986
+ };
987
+ getTOTPURI: {
988
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
989
+ body: {
990
+ password: string;
991
+ };
992
+ } & {
993
+ method?: "POST" | undefined;
994
+ } & {
995
+ query?: Record<string, any> | undefined;
996
+ } & {
997
+ params?: Record<string, any>;
998
+ } & {
999
+ request?: Request;
1000
+ } & {
1001
+ headers?: HeadersInit;
1002
+ } & {
1003
+ asResponse?: boolean;
1004
+ returnHeaders?: boolean;
1005
+ use?: better_call41.Middleware[];
1006
+ path?: string;
1007
+ } & {
1008
+ asResponse?: AsResponse | undefined;
1009
+ returnHeaders?: ReturnHeaders | undefined;
1010
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1011
+ headers: Headers;
1012
+ response: {
1013
+ totpURI: string;
1014
+ };
1015
+ } : {
1016
+ totpURI: string;
1017
+ }>;
1018
+ options: {
1019
+ method: "POST";
1020
+ use: ((inputContext: better_call41.MiddlewareInputContext<better_call41.MiddlewareOptions>) => Promise<{
1021
+ session: {
1022
+ session: Record<string, any> & {
1023
+ id: string;
1024
+ createdAt: Date;
1025
+ updatedAt: Date;
1026
+ userId: string;
1027
+ expiresAt: Date;
1028
+ token: string;
1029
+ ipAddress?: string | null | undefined;
1030
+ userAgent?: string | null | undefined;
1031
+ };
1032
+ user: Record<string, any> & {
1033
+ id: string;
1034
+ createdAt: Date;
1035
+ updatedAt: Date;
1036
+ email: string;
1037
+ emailVerified: boolean;
1038
+ name: string;
1039
+ image?: string | null | undefined;
1040
+ };
1041
+ };
1042
+ }>)[];
1043
+ body: z$1.ZodObject<{
1044
+ password: z$1.ZodString;
1045
+ }, z$1.core.$strip>;
1046
+ metadata: {
1047
+ openapi: {
1048
+ summary: string;
1049
+ description: string;
1050
+ responses: {
1051
+ 200: {
1052
+ description: string;
1053
+ content: {
1054
+ "application/json": {
1055
+ schema: {
1056
+ type: "object";
1057
+ properties: {
1058
+ totpURI: {
1059
+ type: string;
1060
+ };
1061
+ };
1062
+ };
1063
+ };
1064
+ };
1065
+ };
1066
+ };
1067
+ };
1068
+ };
1069
+ } & {
1070
+ use: any[];
1071
+ };
1072
+ path: "/two-factor/get-totp-uri";
1073
+ };
1074
+ verifyTOTP: {
1075
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
1076
+ body: {
1077
+ code: string;
1078
+ trustDevice?: boolean | undefined;
1079
+ };
1080
+ } & {
1081
+ method?: "POST" | undefined;
1082
+ } & {
1083
+ query?: Record<string, any> | undefined;
1084
+ } & {
1085
+ params?: Record<string, any>;
1086
+ } & {
1087
+ request?: Request;
1088
+ } & {
1089
+ headers?: HeadersInit;
1090
+ } & {
1091
+ asResponse?: boolean;
1092
+ returnHeaders?: boolean;
1093
+ use?: better_call41.Middleware[];
1094
+ path?: string;
1095
+ } & {
1096
+ asResponse?: AsResponse | undefined;
1097
+ returnHeaders?: ReturnHeaders | undefined;
1098
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1099
+ headers: Headers;
1100
+ response: {
1101
+ token: string;
1102
+ user: {
1103
+ id: string;
1104
+ email: string;
1105
+ emailVerified: boolean;
1106
+ name: string;
1107
+ image: string | null | undefined;
1108
+ createdAt: Date;
1109
+ updatedAt: Date;
1110
+ };
1111
+ };
1112
+ } : {
1113
+ token: string;
1114
+ user: {
1115
+ id: string;
1116
+ email: string;
1117
+ emailVerified: boolean;
1118
+ name: string;
1119
+ image: string | null | undefined;
1120
+ createdAt: Date;
1121
+ updatedAt: Date;
1122
+ };
1123
+ }>;
1124
+ options: {
1125
+ method: "POST";
1126
+ body: z$1.ZodObject<{
1127
+ code: z$1.ZodString;
1128
+ trustDevice: z$1.ZodOptional<z$1.ZodBoolean>;
1129
+ }, z$1.core.$strip>;
1130
+ metadata: {
1131
+ openapi: {
1132
+ summary: string;
1133
+ description: string;
1134
+ responses: {
1135
+ 200: {
1136
+ description: string;
1137
+ content: {
1138
+ "application/json": {
1139
+ schema: {
1140
+ type: "object";
1141
+ properties: {
1142
+ status: {
1143
+ type: string;
1144
+ };
1145
+ };
1146
+ };
1147
+ };
1148
+ };
1149
+ };
1150
+ };
1151
+ };
1152
+ };
1153
+ } & {
1154
+ use: any[];
1155
+ };
1156
+ path: "/two-factor/verify-totp";
1157
+ };
1158
+ };
1159
+ options: TwoFactorOptions | undefined;
1160
+ hooks: {
1161
+ after: {
1162
+ matcher(context: _gatwech_core14.HookEndpointContext): boolean;
1163
+ handler: (inputContext: better_call41.MiddlewareInputContext<better_call41.MiddlewareOptions>) => Promise<{
1164
+ twoFactorRedirect: boolean;
1165
+ } | undefined>;
1166
+ }[];
1167
+ };
1168
+ schema: {
1169
+ user: {
1170
+ fields: {
1171
+ twoFactorEnabled: {
1172
+ type: "boolean";
1173
+ required: false;
1174
+ defaultValue: false;
1175
+ input: false;
1176
+ };
1177
+ };
1178
+ };
1179
+ twoFactor: {
1180
+ fields: {
1181
+ secret: {
1182
+ type: "string";
1183
+ required: true;
1184
+ returned: false;
1185
+ };
1186
+ backupCodes: {
1187
+ type: "string";
1188
+ required: true;
1189
+ returned: false;
1190
+ };
1191
+ userId: {
1192
+ type: "string";
1193
+ required: true;
1194
+ returned: false;
1195
+ references: {
1196
+ model: string;
1197
+ field: string;
1198
+ };
1199
+ };
1200
+ };
1201
+ };
1202
+ };
1203
+ rateLimit: {
1204
+ pathMatcher(path: string): boolean;
1205
+ window: number;
1206
+ max: number;
1207
+ }[];
1208
+ $ERROR_CODES: {
1209
+ readonly OTP_NOT_ENABLED: "OTP not enabled";
1210
+ readonly OTP_HAS_EXPIRED: "OTP has expired";
1211
+ readonly TOTP_NOT_ENABLED: "TOTP not enabled";
1212
+ readonly TWO_FACTOR_NOT_ENABLED: "Two factor isn't enabled";
1213
+ readonly BACKUP_CODES_NOT_ENABLED: "Backup codes aren't enabled";
1214
+ readonly INVALID_BACKUP_CODE: "Invalid backup code";
1215
+ readonly INVALID_CODE: "Invalid code";
1216
+ readonly TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: "Too many attempts. Please request a new code.";
1217
+ readonly INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie";
1218
+ };
1219
+ };
1220
+ //#endregion
1221
+ //#region src/plugins/two-factor/client.d.ts
1222
+ declare const twoFactorClient: (options?: {
1223
+ /**
1224
+ * a redirect function to call if a user needs to verify
1225
+ * their two factor
1226
+ */
1227
+ onTwoFactorRedirect?: () => void | Promise<void>;
1228
+ } | undefined) => {
1229
+ id: "two-factor";
1230
+ $InferServerPlugin: ReturnType<typeof twoFactor>;
1231
+ atomListeners: {
1232
+ matcher: (path: string) => boolean;
1233
+ signal: "$sessionSignal";
1234
+ }[];
1235
+ pathMethods: {
1236
+ "/two-factor/disable": "POST";
1237
+ "/two-factor/enable": "POST";
1238
+ "/two-factor/send-otp": "POST";
1239
+ "/two-factor/generate-backup-codes": "POST";
1240
+ };
1241
+ fetchPlugins: {
1242
+ id: string;
1243
+ name: string;
1244
+ hooks: {
1245
+ onSuccess(context: _better_fetch_fetch16.SuccessContext<any>): Promise<void>;
1246
+ };
1247
+ }[];
1248
+ };
1249
+ //#endregion
1250
+ export { TwoFactorProvider as a, TwoFactorOptions as i, twoFactor as n, TwoFactorTable as o, TWO_FACTOR_ERROR_CODES as r, UserWithTwoFactor as s, twoFactorClient as t };