@hammadj/better-auth 1.5.0-beta.9

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 (688) hide show
  1. package/LICENSE.md +20 -0
  2. package/README.md +33 -0
  3. package/dist/_virtual/rolldown_runtime.mjs +36 -0
  4. package/dist/adapters/drizzle-adapter/index.d.mts +1 -0
  5. package/dist/adapters/drizzle-adapter/index.mjs +3 -0
  6. package/dist/adapters/index.d.mts +23 -0
  7. package/dist/adapters/index.mjs +13 -0
  8. package/dist/adapters/index.mjs.map +1 -0
  9. package/dist/adapters/kysely-adapter/index.d.mts +1 -0
  10. package/dist/adapters/kysely-adapter/index.mjs +3 -0
  11. package/dist/adapters/memory-adapter/index.d.mts +1 -0
  12. package/dist/adapters/memory-adapter/index.mjs +3 -0
  13. package/dist/adapters/mongodb-adapter/index.d.mts +1 -0
  14. package/dist/adapters/mongodb-adapter/index.mjs +3 -0
  15. package/dist/adapters/prisma-adapter/index.d.mts +1 -0
  16. package/dist/adapters/prisma-adapter/index.mjs +3 -0
  17. package/dist/api/index.d.mts +40 -0
  18. package/dist/api/index.mjs +205 -0
  19. package/dist/api/index.mjs.map +1 -0
  20. package/dist/api/middlewares/index.d.mts +1 -0
  21. package/dist/api/middlewares/index.mjs +3 -0
  22. package/dist/api/middlewares/origin-check.d.mts +17 -0
  23. package/dist/api/middlewares/origin-check.mjs +140 -0
  24. package/dist/api/middlewares/origin-check.mjs.map +1 -0
  25. package/dist/api/rate-limiter/index.mjs +177 -0
  26. package/dist/api/rate-limiter/index.mjs.map +1 -0
  27. package/dist/api/routes/account.d.mts +10 -0
  28. package/dist/api/routes/account.mjs +493 -0
  29. package/dist/api/routes/account.mjs.map +1 -0
  30. package/dist/api/routes/callback.d.mts +5 -0
  31. package/dist/api/routes/callback.mjs +178 -0
  32. package/dist/api/routes/callback.mjs.map +1 -0
  33. package/dist/api/routes/email-verification.d.mts +29 -0
  34. package/dist/api/routes/email-verification.mjs +301 -0
  35. package/dist/api/routes/email-verification.mjs.map +1 -0
  36. package/dist/api/routes/error.d.mts +5 -0
  37. package/dist/api/routes/error.mjs +386 -0
  38. package/dist/api/routes/error.mjs.map +1 -0
  39. package/dist/api/routes/index.d.mts +11 -0
  40. package/dist/api/routes/index.mjs +13 -0
  41. package/dist/api/routes/ok.d.mts +5 -0
  42. package/dist/api/routes/ok.mjs +30 -0
  43. package/dist/api/routes/ok.mjs.map +1 -0
  44. package/dist/api/routes/password.d.mts +8 -0
  45. package/dist/api/routes/password.mjs +198 -0
  46. package/dist/api/routes/password.mjs.map +1 -0
  47. package/dist/api/routes/session.d.mts +52 -0
  48. package/dist/api/routes/session.mjs +478 -0
  49. package/dist/api/routes/session.mjs.map +1 -0
  50. package/dist/api/routes/sign-in.d.mts +8 -0
  51. package/dist/api/routes/sign-in.mjs +262 -0
  52. package/dist/api/routes/sign-in.mjs.map +1 -0
  53. package/dist/api/routes/sign-out.d.mts +5 -0
  54. package/dist/api/routes/sign-out.mjs +33 -0
  55. package/dist/api/routes/sign-out.mjs.map +1 -0
  56. package/dist/api/routes/sign-up.d.mts +7 -0
  57. package/dist/api/routes/sign-up.mjs +227 -0
  58. package/dist/api/routes/sign-up.mjs.map +1 -0
  59. package/dist/api/routes/update-user.d.mts +12 -0
  60. package/dist/api/routes/update-user.mjs +493 -0
  61. package/dist/api/routes/update-user.mjs.map +1 -0
  62. package/dist/api/state/oauth.d.mts +5 -0
  63. package/dist/api/state/oauth.mjs +8 -0
  64. package/dist/api/state/oauth.mjs.map +1 -0
  65. package/dist/api/state/should-session-refresh.d.mts +13 -0
  66. package/dist/api/state/should-session-refresh.mjs +16 -0
  67. package/dist/api/state/should-session-refresh.mjs.map +1 -0
  68. package/dist/api/to-auth-endpoints.mjs +197 -0
  69. package/dist/api/to-auth-endpoints.mjs.map +1 -0
  70. package/dist/auth/base.mjs +44 -0
  71. package/dist/auth/base.mjs.map +1 -0
  72. package/dist/auth/full.d.mts +30 -0
  73. package/dist/auth/full.mjs +32 -0
  74. package/dist/auth/full.mjs.map +1 -0
  75. package/dist/auth/minimal.d.mts +12 -0
  76. package/dist/auth/minimal.mjs +14 -0
  77. package/dist/auth/minimal.mjs.map +1 -0
  78. package/dist/auth/trusted-origins.mjs +31 -0
  79. package/dist/auth/trusted-origins.mjs.map +1 -0
  80. package/dist/client/broadcast-channel.d.mts +20 -0
  81. package/dist/client/broadcast-channel.mjs +46 -0
  82. package/dist/client/broadcast-channel.mjs.map +1 -0
  83. package/dist/client/config.mjs +90 -0
  84. package/dist/client/config.mjs.map +1 -0
  85. package/dist/client/fetch-plugins.mjs +18 -0
  86. package/dist/client/fetch-plugins.mjs.map +1 -0
  87. package/dist/client/focus-manager.d.mts +11 -0
  88. package/dist/client/focus-manager.mjs +32 -0
  89. package/dist/client/focus-manager.mjs.map +1 -0
  90. package/dist/client/index.d.mts +30 -0
  91. package/dist/client/index.mjs +21 -0
  92. package/dist/client/index.mjs.map +1 -0
  93. package/dist/client/lynx/index.d.mts +62 -0
  94. package/dist/client/lynx/index.mjs +24 -0
  95. package/dist/client/lynx/index.mjs.map +1 -0
  96. package/dist/client/lynx/lynx-store.d.mts +47 -0
  97. package/dist/client/lynx/lynx-store.mjs +47 -0
  98. package/dist/client/lynx/lynx-store.mjs.map +1 -0
  99. package/dist/client/online-manager.d.mts +12 -0
  100. package/dist/client/online-manager.mjs +35 -0
  101. package/dist/client/online-manager.mjs.map +1 -0
  102. package/dist/client/parser.mjs +73 -0
  103. package/dist/client/parser.mjs.map +1 -0
  104. package/dist/client/path-to-object.d.mts +57 -0
  105. package/dist/client/plugins/index.d.mts +58 -0
  106. package/dist/client/plugins/index.mjs +33 -0
  107. package/dist/client/plugins/infer-plugin.d.mts +9 -0
  108. package/dist/client/plugins/infer-plugin.mjs +11 -0
  109. package/dist/client/plugins/infer-plugin.mjs.map +1 -0
  110. package/dist/client/proxy.mjs +79 -0
  111. package/dist/client/proxy.mjs.map +1 -0
  112. package/dist/client/query.d.mts +23 -0
  113. package/dist/client/query.mjs +98 -0
  114. package/dist/client/query.mjs.map +1 -0
  115. package/dist/client/react/index.d.mts +63 -0
  116. package/dist/client/react/index.mjs +24 -0
  117. package/dist/client/react/index.mjs.map +1 -0
  118. package/dist/client/react/react-store.d.mts +47 -0
  119. package/dist/client/react/react-store.mjs +47 -0
  120. package/dist/client/react/react-store.mjs.map +1 -0
  121. package/dist/client/session-atom.mjs +29 -0
  122. package/dist/client/session-atom.mjs.map +1 -0
  123. package/dist/client/session-refresh.d.mts +28 -0
  124. package/dist/client/session-refresh.mjs +140 -0
  125. package/dist/client/session-refresh.mjs.map +1 -0
  126. package/dist/client/solid/index.d.mts +57 -0
  127. package/dist/client/solid/index.mjs +22 -0
  128. package/dist/client/solid/index.mjs.map +1 -0
  129. package/dist/client/solid/solid-store.mjs +24 -0
  130. package/dist/client/solid/solid-store.mjs.map +1 -0
  131. package/dist/client/svelte/index.d.mts +63 -0
  132. package/dist/client/svelte/index.mjs +20 -0
  133. package/dist/client/svelte/index.mjs.map +1 -0
  134. package/dist/client/types.d.mts +58 -0
  135. package/dist/client/vanilla.d.mts +62 -0
  136. package/dist/client/vanilla.mjs +20 -0
  137. package/dist/client/vanilla.mjs.map +1 -0
  138. package/dist/client/vue/index.d.mts +86 -0
  139. package/dist/client/vue/index.mjs +38 -0
  140. package/dist/client/vue/index.mjs.map +1 -0
  141. package/dist/client/vue/vue-store.mjs +26 -0
  142. package/dist/client/vue/vue-store.mjs.map +1 -0
  143. package/dist/context/create-context.mjs +211 -0
  144. package/dist/context/create-context.mjs.map +1 -0
  145. package/dist/context/helpers.mjs +62 -0
  146. package/dist/context/helpers.mjs.map +1 -0
  147. package/dist/context/init-minimal.mjs +20 -0
  148. package/dist/context/init-minimal.mjs.map +1 -0
  149. package/dist/context/init.mjs +22 -0
  150. package/dist/context/init.mjs.map +1 -0
  151. package/dist/cookies/cookie-utils.d.mts +29 -0
  152. package/dist/cookies/cookie-utils.mjs +105 -0
  153. package/dist/cookies/cookie-utils.mjs.map +1 -0
  154. package/dist/cookies/index.d.mts +67 -0
  155. package/dist/cookies/index.mjs +264 -0
  156. package/dist/cookies/index.mjs.map +1 -0
  157. package/dist/cookies/session-store.d.mts +36 -0
  158. package/dist/cookies/session-store.mjs +200 -0
  159. package/dist/cookies/session-store.mjs.map +1 -0
  160. package/dist/crypto/buffer.d.mts +8 -0
  161. package/dist/crypto/buffer.mjs +18 -0
  162. package/dist/crypto/buffer.mjs.map +1 -0
  163. package/dist/crypto/index.d.mts +27 -0
  164. package/dist/crypto/index.mjs +38 -0
  165. package/dist/crypto/index.mjs.map +1 -0
  166. package/dist/crypto/jwt.d.mts +8 -0
  167. package/dist/crypto/jwt.mjs +95 -0
  168. package/dist/crypto/jwt.mjs.map +1 -0
  169. package/dist/crypto/password.d.mts +12 -0
  170. package/dist/crypto/password.mjs +36 -0
  171. package/dist/crypto/password.mjs.map +1 -0
  172. package/dist/crypto/random.d.mts +5 -0
  173. package/dist/crypto/random.mjs +8 -0
  174. package/dist/crypto/random.mjs.map +1 -0
  175. package/dist/db/adapter-base.d.mts +8 -0
  176. package/dist/db/adapter-base.mjs +28 -0
  177. package/dist/db/adapter-base.mjs.map +1 -0
  178. package/dist/db/adapter-kysely.d.mts +8 -0
  179. package/dist/db/adapter-kysely.mjs +21 -0
  180. package/dist/db/adapter-kysely.mjs.map +1 -0
  181. package/dist/db/field-converter.d.mts +8 -0
  182. package/dist/db/field-converter.mjs +21 -0
  183. package/dist/db/field-converter.mjs.map +1 -0
  184. package/dist/db/field.d.mts +55 -0
  185. package/dist/db/field.mjs +11 -0
  186. package/dist/db/field.mjs.map +1 -0
  187. package/dist/db/get-migration.d.mts +23 -0
  188. package/dist/db/get-migration.mjs +339 -0
  189. package/dist/db/get-migration.mjs.map +1 -0
  190. package/dist/db/get-schema.d.mts +11 -0
  191. package/dist/db/get-schema.mjs +39 -0
  192. package/dist/db/get-schema.mjs.map +1 -0
  193. package/dist/db/index.d.mts +9 -0
  194. package/dist/db/index.mjs +36 -0
  195. package/dist/db/index.mjs.map +1 -0
  196. package/dist/db/internal-adapter.d.mts +14 -0
  197. package/dist/db/internal-adapter.mjs +616 -0
  198. package/dist/db/internal-adapter.mjs.map +1 -0
  199. package/dist/db/schema.d.mts +26 -0
  200. package/dist/db/schema.mjs +118 -0
  201. package/dist/db/schema.mjs.map +1 -0
  202. package/dist/db/to-zod.d.mts +36 -0
  203. package/dist/db/to-zod.mjs +26 -0
  204. package/dist/db/to-zod.mjs.map +1 -0
  205. package/dist/db/verification-token-storage.mjs +28 -0
  206. package/dist/db/verification-token-storage.mjs.map +1 -0
  207. package/dist/db/with-hooks.d.mts +33 -0
  208. package/dist/db/with-hooks.mjs +159 -0
  209. package/dist/db/with-hooks.mjs.map +1 -0
  210. package/dist/index.d.mts +52 -0
  211. package/dist/index.mjs +26 -0
  212. package/dist/integrations/next-js.d.mts +14 -0
  213. package/dist/integrations/next-js.mjs +78 -0
  214. package/dist/integrations/next-js.mjs.map +1 -0
  215. package/dist/integrations/node.d.mts +13 -0
  216. package/dist/integrations/node.mjs +16 -0
  217. package/dist/integrations/node.mjs.map +1 -0
  218. package/dist/integrations/solid-start.d.mts +23 -0
  219. package/dist/integrations/solid-start.mjs +17 -0
  220. package/dist/integrations/solid-start.mjs.map +1 -0
  221. package/dist/integrations/svelte-kit.d.mts +29 -0
  222. package/dist/integrations/svelte-kit.mjs +57 -0
  223. package/dist/integrations/svelte-kit.mjs.map +1 -0
  224. package/dist/integrations/tanstack-start-solid.d.mts +22 -0
  225. package/dist/integrations/tanstack-start-solid.mjs +61 -0
  226. package/dist/integrations/tanstack-start-solid.mjs.map +1 -0
  227. package/dist/integrations/tanstack-start.d.mts +22 -0
  228. package/dist/integrations/tanstack-start.mjs +61 -0
  229. package/dist/integrations/tanstack-start.mjs.map +1 -0
  230. package/dist/oauth2/index.d.mts +5 -0
  231. package/dist/oauth2/index.mjs +7 -0
  232. package/dist/oauth2/link-account.d.mts +31 -0
  233. package/dist/oauth2/link-account.mjs +144 -0
  234. package/dist/oauth2/link-account.mjs.map +1 -0
  235. package/dist/oauth2/state.d.mts +26 -0
  236. package/dist/oauth2/state.mjs +51 -0
  237. package/dist/oauth2/state.mjs.map +1 -0
  238. package/dist/oauth2/utils.d.mts +8 -0
  239. package/dist/oauth2/utils.mjs +31 -0
  240. package/dist/oauth2/utils.mjs.map +1 -0
  241. package/dist/plugins/access/access.d.mts +30 -0
  242. package/dist/plugins/access/access.mjs +46 -0
  243. package/dist/plugins/access/access.mjs.map +1 -0
  244. package/dist/plugins/access/index.d.mts +3 -0
  245. package/dist/plugins/access/index.mjs +3 -0
  246. package/dist/plugins/access/types.d.mts +17 -0
  247. package/dist/plugins/additional-fields/client.d.mts +14 -0
  248. package/dist/plugins/additional-fields/client.mjs +11 -0
  249. package/dist/plugins/additional-fields/client.mjs.map +1 -0
  250. package/dist/plugins/admin/access/index.d.mts +2 -0
  251. package/dist/plugins/admin/access/index.mjs +3 -0
  252. package/dist/plugins/admin/access/statement.d.mts +118 -0
  253. package/dist/plugins/admin/access/statement.mjs +53 -0
  254. package/dist/plugins/admin/access/statement.mjs.map +1 -0
  255. package/dist/plugins/admin/admin.d.mts +14 -0
  256. package/dist/plugins/admin/admin.mjs +95 -0
  257. package/dist/plugins/admin/admin.mjs.map +1 -0
  258. package/dist/plugins/admin/client.d.mts +14 -0
  259. package/dist/plugins/admin/client.mjs +36 -0
  260. package/dist/plugins/admin/client.mjs.map +1 -0
  261. package/dist/plugins/admin/error-codes.d.mts +5 -0
  262. package/dist/plugins/admin/error-codes.mjs +30 -0
  263. package/dist/plugins/admin/error-codes.mjs.map +1 -0
  264. package/dist/plugins/admin/has-permission.mjs +16 -0
  265. package/dist/plugins/admin/has-permission.mjs.map +1 -0
  266. package/dist/plugins/admin/index.d.mts +3 -0
  267. package/dist/plugins/admin/index.mjs +3 -0
  268. package/dist/plugins/admin/routes.mjs +855 -0
  269. package/dist/plugins/admin/routes.mjs.map +1 -0
  270. package/dist/plugins/admin/schema.d.mts +6 -0
  271. package/dist/plugins/admin/schema.mjs +34 -0
  272. package/dist/plugins/admin/schema.mjs.map +1 -0
  273. package/dist/plugins/admin/types.d.mts +89 -0
  274. package/dist/plugins/anonymous/client.d.mts +9 -0
  275. package/dist/plugins/anonymous/client.mjs +22 -0
  276. package/dist/plugins/anonymous/client.mjs.map +1 -0
  277. package/dist/plugins/anonymous/error-codes.d.mts +5 -0
  278. package/dist/plugins/anonymous/error-codes.mjs +16 -0
  279. package/dist/plugins/anonymous/error-codes.mjs.map +1 -0
  280. package/dist/plugins/anonymous/index.d.mts +14 -0
  281. package/dist/plugins/anonymous/index.mjs +163 -0
  282. package/dist/plugins/anonymous/index.mjs.map +1 -0
  283. package/dist/plugins/anonymous/schema.d.mts +5 -0
  284. package/dist/plugins/anonymous/schema.mjs +11 -0
  285. package/dist/plugins/anonymous/schema.mjs.map +1 -0
  286. package/dist/plugins/anonymous/types.d.mts +68 -0
  287. package/dist/plugins/api-key/adapter.mjs +468 -0
  288. package/dist/plugins/api-key/adapter.mjs.map +1 -0
  289. package/dist/plugins/api-key/client.d.mts +9 -0
  290. package/dist/plugins/api-key/client.mjs +19 -0
  291. package/dist/plugins/api-key/client.mjs.map +1 -0
  292. package/dist/plugins/api-key/error-codes.d.mts +5 -0
  293. package/dist/plugins/api-key/error-codes.mjs +34 -0
  294. package/dist/plugins/api-key/error-codes.mjs.map +1 -0
  295. package/dist/plugins/api-key/index.d.mts +17 -0
  296. package/dist/plugins/api-key/index.mjs +134 -0
  297. package/dist/plugins/api-key/index.mjs.map +1 -0
  298. package/dist/plugins/api-key/rate-limit.mjs +74 -0
  299. package/dist/plugins/api-key/rate-limit.mjs.map +1 -0
  300. package/dist/plugins/api-key/routes/create-api-key.mjs +252 -0
  301. package/dist/plugins/api-key/routes/create-api-key.mjs.map +1 -0
  302. package/dist/plugins/api-key/routes/delete-all-expired-api-keys.mjs +24 -0
  303. package/dist/plugins/api-key/routes/delete-all-expired-api-keys.mjs.map +1 -0
  304. package/dist/plugins/api-key/routes/delete-api-key.mjs +74 -0
  305. package/dist/plugins/api-key/routes/delete-api-key.mjs.map +1 -0
  306. package/dist/plugins/api-key/routes/get-api-key.mjs +158 -0
  307. package/dist/plugins/api-key/routes/get-api-key.mjs.map +1 -0
  308. package/dist/plugins/api-key/routes/index.mjs +71 -0
  309. package/dist/plugins/api-key/routes/index.mjs.map +1 -0
  310. package/dist/plugins/api-key/routes/list-api-keys.mjs +194 -0
  311. package/dist/plugins/api-key/routes/list-api-keys.mjs.map +1 -0
  312. package/dist/plugins/api-key/routes/update-api-key.mjs +248 -0
  313. package/dist/plugins/api-key/routes/update-api-key.mjs.map +1 -0
  314. package/dist/plugins/api-key/routes/verify-api-key.mjs +223 -0
  315. package/dist/plugins/api-key/routes/verify-api-key.mjs.map +1 -0
  316. package/dist/plugins/api-key/schema.d.mts +11 -0
  317. package/dist/plugins/api-key/schema.mjs +130 -0
  318. package/dist/plugins/api-key/schema.mjs.map +1 -0
  319. package/dist/plugins/api-key/types.d.mts +346 -0
  320. package/dist/plugins/bearer/index.d.mts +25 -0
  321. package/dist/plugins/bearer/index.mjs +66 -0
  322. package/dist/plugins/bearer/index.mjs.map +1 -0
  323. package/dist/plugins/captcha/constants.d.mts +10 -0
  324. package/dist/plugins/captcha/constants.mjs +22 -0
  325. package/dist/plugins/captcha/constants.mjs.map +1 -0
  326. package/dist/plugins/captcha/error-codes.mjs +16 -0
  327. package/dist/plugins/captcha/error-codes.mjs.map +1 -0
  328. package/dist/plugins/captcha/index.d.mts +14 -0
  329. package/dist/plugins/captcha/index.mjs +60 -0
  330. package/dist/plugins/captcha/index.mjs.map +1 -0
  331. package/dist/plugins/captcha/types.d.mts +28 -0
  332. package/dist/plugins/captcha/utils.mjs +11 -0
  333. package/dist/plugins/captcha/utils.mjs.map +1 -0
  334. package/dist/plugins/captcha/verify-handlers/captchafox.mjs +27 -0
  335. package/dist/plugins/captcha/verify-handlers/captchafox.mjs.map +1 -0
  336. package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +25 -0
  337. package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs.map +1 -0
  338. package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +29 -0
  339. package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs.map +1 -0
  340. package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +27 -0
  341. package/dist/plugins/captcha/verify-handlers/h-captcha.mjs.map +1 -0
  342. package/dist/plugins/captcha/verify-handlers/index.mjs +6 -0
  343. package/dist/plugins/custom-session/client.d.mts +10 -0
  344. package/dist/plugins/custom-session/client.mjs +11 -0
  345. package/dist/plugins/custom-session/client.mjs.map +1 -0
  346. package/dist/plugins/custom-session/index.d.mts +26 -0
  347. package/dist/plugins/custom-session/index.mjs +70 -0
  348. package/dist/plugins/custom-session/index.mjs.map +1 -0
  349. package/dist/plugins/device-authorization/client.d.mts +5 -0
  350. package/dist/plugins/device-authorization/client.mjs +18 -0
  351. package/dist/plugins/device-authorization/client.mjs.map +1 -0
  352. package/dist/plugins/device-authorization/error-codes.mjs +21 -0
  353. package/dist/plugins/device-authorization/error-codes.mjs.map +1 -0
  354. package/dist/plugins/device-authorization/index.d.mts +28 -0
  355. package/dist/plugins/device-authorization/index.mjs +50 -0
  356. package/dist/plugins/device-authorization/index.mjs.map +1 -0
  357. package/dist/plugins/device-authorization/routes.mjs +510 -0
  358. package/dist/plugins/device-authorization/routes.mjs.map +1 -0
  359. package/dist/plugins/device-authorization/schema.mjs +57 -0
  360. package/dist/plugins/device-authorization/schema.mjs.map +1 -0
  361. package/dist/plugins/email-otp/client.d.mts +7 -0
  362. package/dist/plugins/email-otp/client.mjs +18 -0
  363. package/dist/plugins/email-otp/client.mjs.map +1 -0
  364. package/dist/plugins/email-otp/error-codes.d.mts +5 -0
  365. package/dist/plugins/email-otp/error-codes.mjs +12 -0
  366. package/dist/plugins/email-otp/error-codes.mjs.map +1 -0
  367. package/dist/plugins/email-otp/index.d.mts +14 -0
  368. package/dist/plugins/email-otp/index.mjs +108 -0
  369. package/dist/plugins/email-otp/index.mjs.map +1 -0
  370. package/dist/plugins/email-otp/otp-token.mjs +29 -0
  371. package/dist/plugins/email-otp/otp-token.mjs.map +1 -0
  372. package/dist/plugins/email-otp/routes.mjs +564 -0
  373. package/dist/plugins/email-otp/routes.mjs.map +1 -0
  374. package/dist/plugins/email-otp/types.d.mts +74 -0
  375. package/dist/plugins/email-otp/utils.mjs +17 -0
  376. package/dist/plugins/email-otp/utils.mjs.map +1 -0
  377. package/dist/plugins/generic-oauth/client.d.mts +19 -0
  378. package/dist/plugins/generic-oauth/client.mjs +14 -0
  379. package/dist/plugins/generic-oauth/client.mjs.map +1 -0
  380. package/dist/plugins/generic-oauth/error-codes.d.mts +5 -0
  381. package/dist/plugins/generic-oauth/error-codes.mjs +15 -0
  382. package/dist/plugins/generic-oauth/error-codes.mjs.map +1 -0
  383. package/dist/plugins/generic-oauth/index.d.mts +34 -0
  384. package/dist/plugins/generic-oauth/index.mjs +137 -0
  385. package/dist/plugins/generic-oauth/index.mjs.map +1 -0
  386. package/dist/plugins/generic-oauth/providers/auth0.d.mts +37 -0
  387. package/dist/plugins/generic-oauth/providers/auth0.mjs +62 -0
  388. package/dist/plugins/generic-oauth/providers/auth0.mjs.map +1 -0
  389. package/dist/plugins/generic-oauth/providers/gumroad.d.mts +32 -0
  390. package/dist/plugins/generic-oauth/providers/gumroad.mjs +60 -0
  391. package/dist/plugins/generic-oauth/providers/gumroad.mjs.map +1 -0
  392. package/dist/plugins/generic-oauth/providers/hubspot.d.mts +37 -0
  393. package/dist/plugins/generic-oauth/providers/hubspot.mjs +60 -0
  394. package/dist/plugins/generic-oauth/providers/hubspot.mjs.map +1 -0
  395. package/dist/plugins/generic-oauth/providers/index.d.mts +9 -0
  396. package/dist/plugins/generic-oauth/providers/index.mjs +11 -0
  397. package/dist/plugins/generic-oauth/providers/keycloak.d.mts +37 -0
  398. package/dist/plugins/generic-oauth/providers/keycloak.mjs +62 -0
  399. package/dist/plugins/generic-oauth/providers/keycloak.mjs.map +1 -0
  400. package/dist/plugins/generic-oauth/providers/line.d.mts +55 -0
  401. package/dist/plugins/generic-oauth/providers/line.mjs +91 -0
  402. package/dist/plugins/generic-oauth/providers/line.mjs.map +1 -0
  403. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +37 -0
  404. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +66 -0
  405. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs.map +1 -0
  406. package/dist/plugins/generic-oauth/providers/okta.d.mts +37 -0
  407. package/dist/plugins/generic-oauth/providers/okta.mjs +62 -0
  408. package/dist/plugins/generic-oauth/providers/okta.mjs.map +1 -0
  409. package/dist/plugins/generic-oauth/providers/patreon.d.mts +30 -0
  410. package/dist/plugins/generic-oauth/providers/patreon.mjs +59 -0
  411. package/dist/plugins/generic-oauth/providers/patreon.mjs.map +1 -0
  412. package/dist/plugins/generic-oauth/providers/slack.d.mts +30 -0
  413. package/dist/plugins/generic-oauth/providers/slack.mjs +61 -0
  414. package/dist/plugins/generic-oauth/providers/slack.mjs.map +1 -0
  415. package/dist/plugins/generic-oauth/routes.mjs +394 -0
  416. package/dist/plugins/generic-oauth/routes.mjs.map +1 -0
  417. package/dist/plugins/generic-oauth/types.d.mts +145 -0
  418. package/dist/plugins/haveibeenpwned/index.d.mts +21 -0
  419. package/dist/plugins/haveibeenpwned/index.mjs +56 -0
  420. package/dist/plugins/haveibeenpwned/index.mjs.map +1 -0
  421. package/dist/plugins/index.d.mts +68 -0
  422. package/dist/plugins/index.mjs +51 -0
  423. package/dist/plugins/jwt/adapter.mjs +27 -0
  424. package/dist/plugins/jwt/adapter.mjs.map +1 -0
  425. package/dist/plugins/jwt/client.d.mts +18 -0
  426. package/dist/plugins/jwt/client.mjs +19 -0
  427. package/dist/plugins/jwt/client.mjs.map +1 -0
  428. package/dist/plugins/jwt/index.d.mts +17 -0
  429. package/dist/plugins/jwt/index.mjs +202 -0
  430. package/dist/plugins/jwt/index.mjs.map +1 -0
  431. package/dist/plugins/jwt/schema.d.mts +5 -0
  432. package/dist/plugins/jwt/schema.mjs +23 -0
  433. package/dist/plugins/jwt/schema.mjs.map +1 -0
  434. package/dist/plugins/jwt/sign.d.mts +57 -0
  435. package/dist/plugins/jwt/sign.mjs +66 -0
  436. package/dist/plugins/jwt/sign.mjs.map +1 -0
  437. package/dist/plugins/jwt/types.d.mts +194 -0
  438. package/dist/plugins/jwt/utils.d.mts +42 -0
  439. package/dist/plugins/jwt/utils.mjs +64 -0
  440. package/dist/plugins/jwt/utils.mjs.map +1 -0
  441. package/dist/plugins/jwt/verify.d.mts +12 -0
  442. package/dist/plugins/jwt/verify.mjs +46 -0
  443. package/dist/plugins/jwt/verify.mjs.map +1 -0
  444. package/dist/plugins/last-login-method/client.d.mts +18 -0
  445. package/dist/plugins/last-login-method/client.mjs +32 -0
  446. package/dist/plugins/last-login-method/client.mjs.map +1 -0
  447. package/dist/plugins/last-login-method/index.d.mts +52 -0
  448. package/dist/plugins/last-login-method/index.mjs +77 -0
  449. package/dist/plugins/last-login-method/index.mjs.map +1 -0
  450. package/dist/plugins/magic-link/client.d.mts +5 -0
  451. package/dist/plugins/magic-link/client.mjs +11 -0
  452. package/dist/plugins/magic-link/client.mjs.map +1 -0
  453. package/dist/plugins/magic-link/index.d.mts +61 -0
  454. package/dist/plugins/magic-link/index.mjs +167 -0
  455. package/dist/plugins/magic-link/index.mjs.map +1 -0
  456. package/dist/plugins/magic-link/utils.mjs +12 -0
  457. package/dist/plugins/magic-link/utils.mjs.map +1 -0
  458. package/dist/plugins/mcp/authorize.mjs +133 -0
  459. package/dist/plugins/mcp/authorize.mjs.map +1 -0
  460. package/dist/plugins/mcp/index.d.mts +46 -0
  461. package/dist/plugins/mcp/index.mjs +717 -0
  462. package/dist/plugins/mcp/index.mjs.map +1 -0
  463. package/dist/plugins/multi-session/client.d.mts +8 -0
  464. package/dist/plugins/multi-session/client.mjs +20 -0
  465. package/dist/plugins/multi-session/client.mjs.map +1 -0
  466. package/dist/plugins/multi-session/error-codes.d.mts +5 -0
  467. package/dist/plugins/multi-session/error-codes.mjs +8 -0
  468. package/dist/plugins/multi-session/error-codes.mjs.map +1 -0
  469. package/dist/plugins/multi-session/index.d.mts +22 -0
  470. package/dist/plugins/multi-session/index.mjs +172 -0
  471. package/dist/plugins/multi-session/index.mjs.map +1 -0
  472. package/dist/plugins/oauth-proxy/index.d.mts +39 -0
  473. package/dist/plugins/oauth-proxy/index.mjs +305 -0
  474. package/dist/plugins/oauth-proxy/index.mjs.map +1 -0
  475. package/dist/plugins/oauth-proxy/utils.mjs +44 -0
  476. package/dist/plugins/oauth-proxy/utils.mjs.map +1 -0
  477. package/dist/plugins/oidc-provider/authorize.mjs +194 -0
  478. package/dist/plugins/oidc-provider/authorize.mjs.map +1 -0
  479. package/dist/plugins/oidc-provider/client.d.mts +8 -0
  480. package/dist/plugins/oidc-provider/client.mjs +11 -0
  481. package/dist/plugins/oidc-provider/client.mjs.map +1 -0
  482. package/dist/plugins/oidc-provider/error.mjs +17 -0
  483. package/dist/plugins/oidc-provider/error.mjs.map +1 -0
  484. package/dist/plugins/oidc-provider/index.d.mts +32 -0
  485. package/dist/plugins/oidc-provider/index.mjs +1093 -0
  486. package/dist/plugins/oidc-provider/index.mjs.map +1 -0
  487. package/dist/plugins/oidc-provider/schema.d.mts +26 -0
  488. package/dist/plugins/oidc-provider/schema.mjs +132 -0
  489. package/dist/plugins/oidc-provider/schema.mjs.map +1 -0
  490. package/dist/plugins/oidc-provider/types.d.mts +517 -0
  491. package/dist/plugins/oidc-provider/utils/prompt.mjs +19 -0
  492. package/dist/plugins/oidc-provider/utils/prompt.mjs.map +1 -0
  493. package/dist/plugins/oidc-provider/utils.mjs +15 -0
  494. package/dist/plugins/oidc-provider/utils.mjs.map +1 -0
  495. package/dist/plugins/one-tap/client.d.mts +159 -0
  496. package/dist/plugins/one-tap/client.mjs +214 -0
  497. package/dist/plugins/one-tap/client.mjs.map +1 -0
  498. package/dist/plugins/one-tap/index.d.mts +27 -0
  499. package/dist/plugins/one-tap/index.mjs +96 -0
  500. package/dist/plugins/one-tap/index.mjs.map +1 -0
  501. package/dist/plugins/one-time-token/client.d.mts +7 -0
  502. package/dist/plugins/one-time-token/client.mjs +11 -0
  503. package/dist/plugins/one-time-token/client.mjs.map +1 -0
  504. package/dist/plugins/one-time-token/index.d.mts +53 -0
  505. package/dist/plugins/one-time-token/index.mjs +82 -0
  506. package/dist/plugins/one-time-token/index.mjs.map +1 -0
  507. package/dist/plugins/one-time-token/utils.mjs +12 -0
  508. package/dist/plugins/one-time-token/utils.mjs.map +1 -0
  509. package/dist/plugins/open-api/generator.d.mts +115 -0
  510. package/dist/plugins/open-api/generator.mjs +315 -0
  511. package/dist/plugins/open-api/generator.mjs.map +1 -0
  512. package/dist/plugins/open-api/index.d.mts +45 -0
  513. package/dist/plugins/open-api/index.mjs +67 -0
  514. package/dist/plugins/open-api/index.mjs.map +1 -0
  515. package/dist/plugins/open-api/logo.mjs +15 -0
  516. package/dist/plugins/open-api/logo.mjs.map +1 -0
  517. package/dist/plugins/organization/access/index.d.mts +2 -0
  518. package/dist/plugins/organization/access/index.mjs +3 -0
  519. package/dist/plugins/organization/access/statement.d.mts +249 -0
  520. package/dist/plugins/organization/access/statement.mjs +81 -0
  521. package/dist/plugins/organization/access/statement.mjs.map +1 -0
  522. package/dist/plugins/organization/adapter.d.mts +205 -0
  523. package/dist/plugins/organization/adapter.mjs +624 -0
  524. package/dist/plugins/organization/adapter.mjs.map +1 -0
  525. package/dist/plugins/organization/call.mjs +19 -0
  526. package/dist/plugins/organization/call.mjs.map +1 -0
  527. package/dist/plugins/organization/client.d.mts +151 -0
  528. package/dist/plugins/organization/client.mjs +107 -0
  529. package/dist/plugins/organization/client.mjs.map +1 -0
  530. package/dist/plugins/organization/error-codes.d.mts +5 -0
  531. package/dist/plugins/organization/error-codes.mjs +65 -0
  532. package/dist/plugins/organization/error-codes.mjs.map +1 -0
  533. package/dist/plugins/organization/has-permission.mjs +35 -0
  534. package/dist/plugins/organization/has-permission.mjs.map +1 -0
  535. package/dist/plugins/organization/index.d.mts +5 -0
  536. package/dist/plugins/organization/index.mjs +4 -0
  537. package/dist/plugins/organization/organization.d.mts +252 -0
  538. package/dist/plugins/organization/organization.mjs +428 -0
  539. package/dist/plugins/organization/organization.mjs.map +1 -0
  540. package/dist/plugins/organization/permission.d.mts +26 -0
  541. package/dist/plugins/organization/permission.mjs +16 -0
  542. package/dist/plugins/organization/permission.mjs.map +1 -0
  543. package/dist/plugins/organization/routes/crud-access-control.d.mts +11 -0
  544. package/dist/plugins/organization/routes/crud-access-control.mjs +656 -0
  545. package/dist/plugins/organization/routes/crud-access-control.mjs.map +1 -0
  546. package/dist/plugins/organization/routes/crud-invites.d.mts +16 -0
  547. package/dist/plugins/organization/routes/crud-invites.mjs +555 -0
  548. package/dist/plugins/organization/routes/crud-invites.mjs.map +1 -0
  549. package/dist/plugins/organization/routes/crud-members.d.mts +13 -0
  550. package/dist/plugins/organization/routes/crud-members.mjs +473 -0
  551. package/dist/plugins/organization/routes/crud-members.mjs.map +1 -0
  552. package/dist/plugins/organization/routes/crud-org.d.mts +13 -0
  553. package/dist/plugins/organization/routes/crud-org.mjs +447 -0
  554. package/dist/plugins/organization/routes/crud-org.mjs.map +1 -0
  555. package/dist/plugins/organization/routes/crud-team.d.mts +15 -0
  556. package/dist/plugins/organization/routes/crud-team.mjs +676 -0
  557. package/dist/plugins/organization/routes/crud-team.mjs.map +1 -0
  558. package/dist/plugins/organization/schema.d.mts +376 -0
  559. package/dist/plugins/organization/schema.mjs +68 -0
  560. package/dist/plugins/organization/schema.mjs.map +1 -0
  561. package/dist/plugins/organization/types.d.mts +733 -0
  562. package/dist/plugins/phone-number/client.d.mts +8 -0
  563. package/dist/plugins/phone-number/client.mjs +20 -0
  564. package/dist/plugins/phone-number/client.mjs.map +1 -0
  565. package/dist/plugins/phone-number/error-codes.d.mts +5 -0
  566. package/dist/plugins/phone-number/error-codes.mjs +21 -0
  567. package/dist/plugins/phone-number/error-codes.mjs.map +1 -0
  568. package/dist/plugins/phone-number/index.d.mts +14 -0
  569. package/dist/plugins/phone-number/index.mjs +49 -0
  570. package/dist/plugins/phone-number/index.mjs.map +1 -0
  571. package/dist/plugins/phone-number/routes.mjs +459 -0
  572. package/dist/plugins/phone-number/routes.mjs.map +1 -0
  573. package/dist/plugins/phone-number/schema.d.mts +5 -0
  574. package/dist/plugins/phone-number/schema.mjs +20 -0
  575. package/dist/plugins/phone-number/schema.mjs.map +1 -0
  576. package/dist/plugins/phone-number/types.d.mts +118 -0
  577. package/dist/plugins/siwe/client.d.mts +5 -0
  578. package/dist/plugins/siwe/client.mjs +11 -0
  579. package/dist/plugins/siwe/client.mjs.map +1 -0
  580. package/dist/plugins/siwe/error-codes.mjs +13 -0
  581. package/dist/plugins/siwe/error-codes.mjs.map +1 -0
  582. package/dist/plugins/siwe/index.d.mts +26 -0
  583. package/dist/plugins/siwe/index.mjs +261 -0
  584. package/dist/plugins/siwe/index.mjs.map +1 -0
  585. package/dist/plugins/siwe/schema.d.mts +5 -0
  586. package/dist/plugins/siwe/schema.mjs +32 -0
  587. package/dist/plugins/siwe/schema.mjs.map +1 -0
  588. package/dist/plugins/siwe/types.d.mts +44 -0
  589. package/dist/plugins/two-factor/backup-codes/index.d.mts +91 -0
  590. package/dist/plugins/two-factor/backup-codes/index.mjs +277 -0
  591. package/dist/plugins/two-factor/backup-codes/index.mjs.map +1 -0
  592. package/dist/plugins/two-factor/client.d.mts +17 -0
  593. package/dist/plugins/two-factor/client.mjs +37 -0
  594. package/dist/plugins/two-factor/client.mjs.map +1 -0
  595. package/dist/plugins/two-factor/constant.mjs +8 -0
  596. package/dist/plugins/two-factor/constant.mjs.map +1 -0
  597. package/dist/plugins/two-factor/error-code.d.mts +5 -0
  598. package/dist/plugins/two-factor/error-code.mjs +18 -0
  599. package/dist/plugins/two-factor/error-code.mjs.map +1 -0
  600. package/dist/plugins/two-factor/index.d.mts +19 -0
  601. package/dist/plugins/two-factor/index.mjs +207 -0
  602. package/dist/plugins/two-factor/index.mjs.map +1 -0
  603. package/dist/plugins/two-factor/otp/index.d.mts +96 -0
  604. package/dist/plugins/two-factor/otp/index.mjs +199 -0
  605. package/dist/plugins/two-factor/otp/index.mjs.map +1 -0
  606. package/dist/plugins/two-factor/schema.d.mts +5 -0
  607. package/dist/plugins/two-factor/schema.mjs +36 -0
  608. package/dist/plugins/two-factor/schema.mjs.map +1 -0
  609. package/dist/plugins/two-factor/totp/index.d.mts +81 -0
  610. package/dist/plugins/two-factor/totp/index.mjs +157 -0
  611. package/dist/plugins/two-factor/totp/index.mjs.map +1 -0
  612. package/dist/plugins/two-factor/types.d.mts +65 -0
  613. package/dist/plugins/two-factor/utils.mjs +12 -0
  614. package/dist/plugins/two-factor/utils.mjs.map +1 -0
  615. package/dist/plugins/two-factor/verify-two-factor.mjs +76 -0
  616. package/dist/plugins/two-factor/verify-two-factor.mjs.map +1 -0
  617. package/dist/plugins/username/client.d.mts +7 -0
  618. package/dist/plugins/username/client.mjs +18 -0
  619. package/dist/plugins/username/client.mjs.map +1 -0
  620. package/dist/plugins/username/error-codes.d.mts +5 -0
  621. package/dist/plugins/username/error-codes.mjs +17 -0
  622. package/dist/plugins/username/error-codes.mjs.map +1 -0
  623. package/dist/plugins/username/index.d.mts +74 -0
  624. package/dist/plugins/username/index.mjs +237 -0
  625. package/dist/plugins/username/index.mjs.map +1 -0
  626. package/dist/plugins/username/schema.d.mts +9 -0
  627. package/dist/plugins/username/schema.mjs +26 -0
  628. package/dist/plugins/username/schema.mjs.map +1 -0
  629. package/dist/social-providers/index.d.mts +1 -0
  630. package/dist/social-providers/index.mjs +3 -0
  631. package/dist/state.d.mts +42 -0
  632. package/dist/state.mjs +107 -0
  633. package/dist/state.mjs.map +1 -0
  634. package/dist/test-utils/headers.d.mts +9 -0
  635. package/dist/test-utils/headers.mjs +24 -0
  636. package/dist/test-utils/headers.mjs.map +1 -0
  637. package/dist/test-utils/index.d.mts +3 -0
  638. package/dist/test-utils/index.mjs +4 -0
  639. package/dist/test-utils/test-instance.d.mts +181 -0
  640. package/dist/test-utils/test-instance.mjs +210 -0
  641. package/dist/test-utils/test-instance.mjs.map +1 -0
  642. package/dist/types/adapter.d.mts +24 -0
  643. package/dist/types/api.d.mts +29 -0
  644. package/dist/types/auth.d.mts +30 -0
  645. package/dist/types/helper.d.mts +21 -0
  646. package/dist/types/index.d.mts +11 -0
  647. package/dist/types/index.mjs +1 -0
  648. package/dist/types/models.d.mts +17 -0
  649. package/dist/types/plugins.d.mts +16 -0
  650. package/dist/utils/boolean.mjs +8 -0
  651. package/dist/utils/boolean.mjs.map +1 -0
  652. package/dist/utils/constants.mjs +6 -0
  653. package/dist/utils/constants.mjs.map +1 -0
  654. package/dist/utils/date.mjs +8 -0
  655. package/dist/utils/date.mjs.map +1 -0
  656. package/dist/utils/get-request-ip.d.mts +7 -0
  657. package/dist/utils/get-request-ip.mjs +23 -0
  658. package/dist/utils/get-request-ip.mjs.map +1 -0
  659. package/dist/utils/hashing.mjs +21 -0
  660. package/dist/utils/hashing.mjs.map +1 -0
  661. package/dist/utils/hide-metadata.d.mts +7 -0
  662. package/dist/utils/hide-metadata.mjs +6 -0
  663. package/dist/utils/hide-metadata.mjs.map +1 -0
  664. package/dist/utils/index.d.mts +3 -0
  665. package/dist/utils/index.mjs +5 -0
  666. package/dist/utils/is-api-error.d.mts +7 -0
  667. package/dist/utils/is-api-error.mjs +11 -0
  668. package/dist/utils/is-api-error.mjs.map +1 -0
  669. package/dist/utils/is-atom.mjs +8 -0
  670. package/dist/utils/is-atom.mjs.map +1 -0
  671. package/dist/utils/is-promise.mjs +8 -0
  672. package/dist/utils/is-promise.mjs.map +1 -0
  673. package/dist/utils/middleware-response.mjs +6 -0
  674. package/dist/utils/middleware-response.mjs.map +1 -0
  675. package/dist/utils/password.mjs +26 -0
  676. package/dist/utils/password.mjs.map +1 -0
  677. package/dist/utils/plugin-helper.mjs +17 -0
  678. package/dist/utils/plugin-helper.mjs.map +1 -0
  679. package/dist/utils/shim.mjs +24 -0
  680. package/dist/utils/shim.mjs.map +1 -0
  681. package/dist/utils/time.d.mts +49 -0
  682. package/dist/utils/time.mjs +100 -0
  683. package/dist/utils/time.mjs.map +1 -0
  684. package/dist/utils/url.mjs +92 -0
  685. package/dist/utils/url.mjs.map +1 -0
  686. package/dist/utils/wildcard.mjs +108 -0
  687. package/dist/utils/wildcard.mjs.map +1 -0
  688. package/package.json +601 -0
@@ -0,0 +1,517 @@
1
+ import { User } from "../../types/models.mjs";
2
+ import { InferOptionSchema } from "../../types/plugins.mjs";
3
+ import "../../types/index.mjs";
4
+ import { OAuthApplication, schema } from "./schema.mjs";
5
+
6
+ //#region src/plugins/oidc-provider/types.d.ts
7
+ interface OIDCOptions {
8
+ /**
9
+ * The amount of time in seconds that the access token is valid for.
10
+ *
11
+ * @default 3600 (1 hour) - Recommended by the OIDC spec
12
+ */
13
+ accessTokenExpiresIn?: number | undefined;
14
+ /**
15
+ * Allow dynamic client registration.
16
+ */
17
+ allowDynamicClientRegistration?: boolean | undefined;
18
+ /**
19
+ * The metadata for the OpenID Connect provider.
20
+ */
21
+ metadata?: Partial<OIDCMetadata> | undefined;
22
+ /**
23
+ * The amount of time in seconds that the refresh token is valid for.
24
+ *
25
+ * @default 604800 (7 days) - Recommended by the OIDC spec
26
+ */
27
+ refreshTokenExpiresIn?: number | undefined;
28
+ /**
29
+ * The amount of time in seconds that the authorization code is valid for.
30
+ *
31
+ * @default 600 (10 minutes) - Recommended by the OIDC spec
32
+ */
33
+ codeExpiresIn?: number | undefined;
34
+ /**
35
+ * The scopes that the client is allowed to request.
36
+ *
37
+ * @see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
38
+ * @default
39
+ * ```ts
40
+ * ["openid", "profile", "email", "offline_access"]
41
+ * ```
42
+ */
43
+ scopes?: string[] | undefined;
44
+ /**
45
+ * The default scope to use if the client does not provide one.
46
+ *
47
+ * @default "openid"
48
+ */
49
+ defaultScope?: string | undefined;
50
+ /**
51
+ * A URL to the consent page where the user will be redirected if the client
52
+ * requests consent.
53
+ *
54
+ * After the user consents, they should be redirected by the client to the
55
+ * `redirect_uri` with the authorization code.
56
+ *
57
+ * When the server redirects the user to the consent page, it will include the
58
+ * following query parameters:
59
+ * - `consent_code` - The consent code to identify the authorization request.
60
+ * - `client_id` - The ID of the client.
61
+ * - `scope` - The requested scopes.
62
+ *
63
+ * Once the user consents, you need to call the `/oauth2/consent` endpoint
64
+ * with `accept: true` and optionally the `consent_code` (if using URL parameter flow)
65
+ * to complete the authorization. This will return the client to the `redirect_uri`
66
+ * with the authorization code.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * consentPage: "/oauth/authorize"
71
+ * ```
72
+ */
73
+ consentPage?: string | undefined;
74
+ /**
75
+ * The HTML for the consent page. This is used if `consentPage` is not
76
+ * provided. This should be a function that returns an HTML string.
77
+ * The function will be called with the following props:
78
+ */
79
+ getConsentHTML?: ((props: {
80
+ clientId: string;
81
+ clientName: string;
82
+ clientIcon?: string | undefined;
83
+ clientMetadata: Record<string, any> | null;
84
+ code: string;
85
+ scopes: string[];
86
+ }) => string) | undefined;
87
+ /**
88
+ * The URL to the login page. This is used if the client requests the `login`
89
+ * prompt.
90
+ */
91
+ loginPage: string;
92
+ /**
93
+ * Whether to require PKCE (proof key code exchange) or not
94
+ *
95
+ * According to OAuth2.1 spec this should be required. But in any
96
+ * case if you want to disable this you can use this options.
97
+ *
98
+ * @default true
99
+ */
100
+ requirePKCE?: boolean | undefined;
101
+ /**
102
+ * Allow plain to be used as a code challenge method.
103
+ *
104
+ * @default true
105
+ */
106
+ allowPlainCodeChallengeMethod?: boolean | undefined;
107
+ /**
108
+ * Custom function to generate a client ID.
109
+ */
110
+ generateClientId?: (() => string) | undefined;
111
+ /**
112
+ * Custom function to generate a client secret.
113
+ */
114
+ generateClientSecret?: (() => string) | undefined;
115
+ /**
116
+ * Get the additional user info claims
117
+ *
118
+ * This applies to the `userinfo` endpoint and the `id_token`.
119
+ *
120
+ * @param user - The user object.
121
+ * @param scopes - The scopes that the client requested.
122
+ * @param client - The client object.
123
+ * @returns The user info claim.
124
+ */
125
+ getAdditionalUserInfoClaim?: ((user: User & Record<string, any>, scopes: string[], client: Client) => Record<string, any> | Promise<Record<string, any>>) | undefined;
126
+ /**
127
+ * Trusted clients that are configured directly in the provider options.
128
+ * These clients bypass database lookups and can optionally skip consent screens.
129
+ */
130
+ trustedClients?: Client[] | undefined;
131
+ /**
132
+ * Store the client secret in your database in a secure way
133
+ * Note: This will not affect the client secret sent to the user, it will only affect the client secret stored in your database
134
+ *
135
+ * - "hashed" - The client secret is hashed using the `hash` function.
136
+ * - "plain" - The client secret is stored in the database in plain text.
137
+ * - "encrypted" - The client secret is encrypted using the `encrypt` function.
138
+ * - { hash: (clientSecret: string) => Promise<string> } - A function that hashes the client secret.
139
+ * - { encrypt: (clientSecret: string) => Promise<string>, decrypt: (clientSecret: string) => Promise<string> } - A function that encrypts and decrypts the client secret.
140
+ *
141
+ * @default "plain"
142
+ */
143
+ storeClientSecret?: ("hashed" | "plain" | "encrypted" | {
144
+ hash: (clientSecret: string) => Promise<string>;
145
+ } | {
146
+ encrypt: (clientSecret: string) => Promise<string>;
147
+ decrypt: (clientSecret: string) => Promise<string>;
148
+ }) | undefined;
149
+ /**
150
+ * Whether to use the JWT plugin to sign the ID token.
151
+ *
152
+ * @default false
153
+ */
154
+ useJWTPlugin?: boolean | undefined;
155
+ /**
156
+ * Custom schema for the OIDC plugin
157
+ */
158
+ schema?: InferOptionSchema<typeof schema> | undefined;
159
+ }
160
+ interface AuthorizationQuery {
161
+ /**
162
+ * The response type. Must be 'code' or 'token'. Code is for authorization code flow, token is
163
+ * for implicit flow.
164
+ */
165
+ response_type: "code" | "token";
166
+ /**
167
+ * The redirect URI for the client. Must be one of the registered redirect URLs for the client.
168
+ */
169
+ redirect_uri?: string | undefined;
170
+ /**
171
+ * The scope of the request. Must be a space-separated list of case sensitive strings.
172
+ *
173
+ * - "openid" is required for all requests
174
+ * - "profile" is required for requests that require user profile information.
175
+ * - "email" is required for requests that require user email information.
176
+ * - "offline_access" is required for requests that require a refresh token.
177
+ */
178
+ scope?: string | undefined;
179
+ /**
180
+ * Opaque value used to maintain state between the request and the callback. Typically,
181
+ * Cross-Site Request Forgery (CSRF, XSRF) mitigation is done by cryptographically binding the
182
+ * value of this parameter with a browser cookie.
183
+ *
184
+ * Note: Better Auth stores the state in a database instead of a cookie. - This is to minimize
185
+ * the complication with native apps and other clients that may not have access to cookies.
186
+ */
187
+ state: string;
188
+ /**
189
+ * The client ID. Must be the ID of a registered client.
190
+ */
191
+ client_id: string;
192
+ /**
193
+ * The prompt parameter is used to specify the type of user interaction that is required.
194
+ */
195
+ prompt?: (string & {}) | ("none" | "consent" | "login" | "select_account") | undefined;
196
+ /**
197
+ * The display parameter is used to specify how the authorization server displays the
198
+ * authentication and consent user interface pages to the end user.
199
+ */
200
+ display?: ("page" | "popup" | "touch" | "wap") | undefined;
201
+ /**
202
+ * End-User's preferred languages and scripts for the user interface, represented as a
203
+ * space-separated list of BCP47 [RFC5646] language tag values, ordered by preference. For
204
+ * instance, the value "fr-CA fr en" represents a preference for French as spoken in Canada,
205
+ * then French (without a region designation), followed by English (without a region
206
+ * designation).
207
+ *
208
+ * Better Auth does not support this parameter yet. It'll not throw an error if it's provided,
209
+ *
210
+ * 🏗️ currently not implemented
211
+ */
212
+ ui_locales?: string | undefined;
213
+ /**
214
+ * The maximum authentication age.
215
+ *
216
+ * Specifies the allowable elapsed time in seconds since the last time the End-User was
217
+ * actively authenticated by the provider. If the elapsed time is greater than this value, the
218
+ * provider MUST attempt to actively re-authenticate the End-User.
219
+ *
220
+ * Note that max_age=0 is equivalent to prompt=login.
221
+ */
222
+ max_age?: number | undefined;
223
+ /**
224
+ * Requested Authentication Context Class Reference values.
225
+ *
226
+ * Space-separated string that
227
+ * specifies the acr values that the Authorization Server is being requested to use for
228
+ * processing this Authentication Request, with the values appearing in order of preference.
229
+ * The Authentication Context Class satisfied by the authentication performed is returned as
230
+ * the acr Claim Value, as specified in Section 2. The acr Claim is requested as a Voluntary
231
+ * Claim by this parameter.
232
+ */
233
+ acr_values?: string | undefined;
234
+ /**
235
+ * Hint to the Authorization Server about the login identifier the End-User might use to log in
236
+ * (if necessary). This hint can be used by an RP if it first asks the End-User for their
237
+ * e-mail address (or other identifier) and then wants to pass that value as a hint to the
238
+ * discovered authorization service. It is RECOMMENDED that the hint value match the value used
239
+ * for discovery. This value MAY also be a phone number in the format specified for the
240
+ * phone_number Claim. The use of this parameter is left to the OP's discretion.
241
+ */
242
+ login_hint?: string | undefined;
243
+ /**
244
+ * ID Token previously issued by the Authorization Server being passed as a hint about the
245
+ * End-User's current or past authenticated session with the Client.
246
+ *
247
+ * 🏗️ currently not implemented
248
+ */
249
+ id_token_hint?: string | undefined;
250
+ /**
251
+ * Code challenge
252
+ */
253
+ code_challenge?: string | undefined;
254
+ /**
255
+ * Code challenge method used
256
+ */
257
+ code_challenge_method?: ("plain" | "s256") | undefined;
258
+ /**
259
+ * String value used to associate a Client session with an ID Token, and to mitigate replay
260
+ * attacks. The value is passed through unmodified from the Authentication Request to the ID Token.
261
+ * If present in the ID Token, Clients MUST verify that the nonce Claim Value is equal to the
262
+ * value of the nonce parameter sent in the Authentication Request. If present in the
263
+ * Authentication Request, Authorization Servers MUST include a nonce Claim in the ID Token
264
+ * with the Claim Value being the nonce value sent in the Authentication Request.
265
+ */
266
+ nonce?: string | undefined;
267
+ }
268
+ type Client = Omit<OAuthApplication, "metadata" | "updatedAt" | "createdAt" | "redirectUrls" | "userId"> & {
269
+ metadata: Record<string, any> | null;
270
+ /**
271
+ * List of registered redirect URLs. Must include the whole URL, including the protocol, port,
272
+ * and path.
273
+ *
274
+ * For example, `https://example.com/auth/callback`
275
+ */
276
+ redirectUrls: string[];
277
+ /**
278
+ * Whether to skip the consent screen for this client.
279
+ * Only applies to trusted clients.
280
+ */
281
+ skipConsent?: boolean | undefined;
282
+ };
283
+ interface TokenBody {
284
+ /**
285
+ * The grant type. Must be 'authorization_code' or 'refresh_token'.
286
+ */
287
+ grant_type: "authorization_code" | "refresh_token";
288
+ /**
289
+ * The authorization code received from the authorization server.
290
+ */
291
+ code?: string | undefined;
292
+ /**
293
+ * The redirect URI of the client.
294
+ */
295
+ redirect_uri?: string | undefined;
296
+ /**
297
+ * The client ID.
298
+ */
299
+ client_id?: string | undefined;
300
+ /**
301
+ * The client secret.
302
+ */
303
+ client_secret?: string | undefined;
304
+ /**
305
+ * The refresh token received from the authorization server.
306
+ */
307
+ refresh_token?: string | undefined;
308
+ }
309
+ interface CodeVerificationValue {
310
+ /**
311
+ * The client ID
312
+ */
313
+ clientId: string;
314
+ /**
315
+ * The redirect URI for the client
316
+ */
317
+ redirectURI: string;
318
+ /**
319
+ * The scopes that the client requested
320
+ */
321
+ scope: string[];
322
+ /**
323
+ * The user ID
324
+ */
325
+ userId: string;
326
+ /**
327
+ * The time that the user authenticated
328
+ */
329
+ authTime: number;
330
+ /**
331
+ * Whether the user needs to consent to the scopes
332
+ * before the code can be exchanged for an access token.
333
+ *
334
+ * If this is true, then the code is treated as a consent
335
+ * request. Once the user consents, the code will be updated
336
+ * with the actual code.
337
+ */
338
+ requireConsent: boolean;
339
+ /**
340
+ * The state parameter from the request
341
+ *
342
+ * If the prompt is set to `consent`, then the state
343
+ * parameter is saved here. This is to prevent the client
344
+ * from using the code before the user consents.
345
+ */
346
+ state: string | null;
347
+ /**
348
+ * Code challenge
349
+ */
350
+ codeChallenge?: string | undefined;
351
+ /**
352
+ * Code Challenge Method
353
+ */
354
+ codeChallengeMethod?: ("sha256" | "plain") | undefined;
355
+ /**
356
+ * Nonce
357
+ */
358
+ nonce?: string | undefined;
359
+ }
360
+ interface OAuthAccessToken {
361
+ /**
362
+ * The access token
363
+ */
364
+ accessToken: string;
365
+ /**
366
+ * The refresh token
367
+ */
368
+ refreshToken: string;
369
+ /**
370
+ * The time that the access token expires
371
+ */
372
+ accessTokenExpiresAt: Date;
373
+ /**
374
+ * The time that the refresh token expires
375
+ */
376
+ refreshTokenExpiresAt: Date;
377
+ /**
378
+ * The client ID
379
+ */
380
+ clientId: string;
381
+ /**
382
+ * The user ID
383
+ */
384
+ userId: string;
385
+ /**
386
+ * The scopes that the access token has access to
387
+ */
388
+ scopes: string;
389
+ }
390
+ interface OIDCMetadata {
391
+ /**
392
+ * The issuer identifier, this is the URL of the provider and can be used to verify
393
+ * the `iss` claim in the ID token.
394
+ *
395
+ * default: the base URL of the server (e.g. `https://example.com`)
396
+ */
397
+ issuer: string;
398
+ /**
399
+ * The URL of the authorization endpoint.
400
+ *
401
+ * @default `/oauth2/authorize`
402
+ */
403
+ authorization_endpoint: string;
404
+ /**
405
+ * The URL of the token endpoint.
406
+ *
407
+ * @default `/oauth2/token`
408
+ */
409
+ token_endpoint: string;
410
+ /**
411
+ * The URL of the userinfo endpoint.
412
+ *
413
+ * @default `/oauth2/userinfo`
414
+ */
415
+ userinfo_endpoint: string;
416
+ /**
417
+ * The URL of the jwks_uri endpoint.
418
+ *
419
+ * For JWKS to work, you must install the `jwt` plugin.
420
+ *
421
+ * This value is automatically set to `/jwks` if the `jwt` plugin is installed.
422
+ *
423
+ * @default `/jwks`
424
+ */
425
+ jwks_uri: string;
426
+ /**
427
+ * The URL of the dynamic client registration endpoint.
428
+ *
429
+ * @default `/oauth2/register`
430
+ */
431
+ registration_endpoint: string;
432
+ /**
433
+ * Supported scopes.
434
+ */
435
+ scopes_supported: string[];
436
+ /**
437
+ * Supported response types.
438
+ *
439
+ * only `code` is supported.
440
+ */
441
+ response_types_supported: ["code"];
442
+ /**
443
+ * Supported response modes.
444
+ *
445
+ * `query`: the authorization code is returned in the query string
446
+ *
447
+ * only `query` is supported.
448
+ */
449
+ response_modes_supported: ["query"];
450
+ /**
451
+ * Supported grant types.
452
+ *
453
+ * The first element MUST be "authorization_code"; additional grant types like
454
+ * "refresh_token" can follow. Guarantees a non-empty array at the type level.
455
+ */
456
+ grant_types_supported: ["authorization_code", ...("authorization_code" | "refresh_token")[]];
457
+ /**
458
+ * acr_values supported.
459
+ *
460
+ * - `urn:mace:incommon:iap:silver`: Silver level of assurance
461
+ * - `urn:mace:incommon:iap:bronze`: Bronze level of assurance
462
+ *
463
+ * only `urn:mace:incommon:iap:silver` and `urn:mace:incommon:iap:bronze` are supported.
464
+ *
465
+ *
466
+ * @default
467
+ * ["urn:mace:incommon:iap:silver", "urn:mace:incommon:iap:bronze"]
468
+ * @see https://incommon.org/federation/attributes.html
469
+ */
470
+ acr_values_supported: string[];
471
+ /**
472
+ * Supported subject types.
473
+ *
474
+ * pairwise: the subject identifier is unique to the client
475
+ * public: the subject identifier is unique to the server
476
+ *
477
+ * only `public` is supported.
478
+ */
479
+ subject_types_supported: ["public"];
480
+ /**
481
+ * Supported ID token signing algorithms.
482
+ */
483
+ id_token_signing_alg_values_supported: string[];
484
+ /**
485
+ * Supported token endpoint authentication methods.
486
+ *
487
+ * only `client_secret_basic` and `client_secret_post` are supported.
488
+ *
489
+ * @default
490
+ * ["client_secret_basic", "client_secret_post"]
491
+ */
492
+ token_endpoint_auth_methods_supported: ["client_secret_basic", "client_secret_post", "none"];
493
+ /**
494
+ * Supported claims.
495
+ *
496
+ * @default
497
+ * ["sub", "iss", "aud", "exp", "nbf", "iat", "jti", "email", "email_verified", "name"]
498
+ */
499
+ claims_supported: string[];
500
+ /**
501
+ * Supported code challenge methods.
502
+ *
503
+ * only `S256` is supported.
504
+ *
505
+ * @default ["S256"]
506
+ */
507
+ code_challenge_methods_supported: ["S256"];
508
+ /**
509
+ * The URL of the RP-initiated logout endpoint.
510
+ *
511
+ * @default `/oauth2/endsession`
512
+ */
513
+ end_session_endpoint?: string;
514
+ }
515
+ //#endregion
516
+ export { AuthorizationQuery, Client, CodeVerificationValue, OAuthAccessToken, OIDCMetadata, OIDCOptions, TokenBody };
517
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1,19 @@
1
+ import { InvalidRequest } from "../error.mjs";
2
+
3
+ //#region src/plugins/oidc-provider/utils/prompt.ts
4
+ /**
5
+ * Parse space-separated prompt string into a set of prompts
6
+ *
7
+ * @param prompt
8
+ */
9
+ function parsePrompt(prompt) {
10
+ const prompts = prompt.split(" ").map((p) => p.trim());
11
+ const set = /* @__PURE__ */ new Set();
12
+ for (const p of prompts) if (p === "login" || p === "consent" || p === "select_account" || p === "none") set.add(p);
13
+ if (set.has("none") && set.size > 1) throw new InvalidRequest("prompt none must only be used alone");
14
+ return new Set(set);
15
+ }
16
+
17
+ //#endregion
18
+ export { parsePrompt };
19
+ //# sourceMappingURL=prompt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.mjs","names":[],"sources":["../../../../src/plugins/oidc-provider/utils/prompt.ts"],"sourcesContent":["import { InvalidRequest } from \"../error\";\n\nexport type AuthorizePrompt = \"login\" | \"consent\" | \"select_account\" | \"none\";\nexport type AuthorizePromptSet = ReadonlySet<AuthorizePrompt>;\n\n/**\n * Parse space-separated prompt string into a set of prompts\n *\n * @param prompt\n */\nexport function parsePrompt(prompt: string) {\n\tconst prompts = prompt.split(\" \").map((p) => p.trim());\n\tconst set = new Set<AuthorizePrompt>();\n\tfor (const p of prompts) {\n\t\tif (\n\t\t\tp === \"login\" ||\n\t\t\tp === \"consent\" ||\n\t\t\tp === \"select_account\" ||\n\t\t\tp === \"none\"\n\t\t) {\n\t\t\tset.add(p);\n\t\t}\n\t}\n\n\tif (set.has(\"none\") && set.size > 1) {\n\t\tthrow new InvalidRequest(\"prompt none must only be used alone\");\n\t}\n\n\treturn new Set(set) as AuthorizePromptSet;\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,YAAY,QAAgB;CAC3C,MAAM,UAAU,OAAO,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC;CACtD,MAAM,sBAAM,IAAI,KAAsB;AACtC,MAAK,MAAM,KAAK,QACf,KACC,MAAM,WACN,MAAM,aACN,MAAM,oBACN,MAAM,OAEN,KAAI,IAAI,EAAE;AAIZ,KAAI,IAAI,IAAI,OAAO,IAAI,IAAI,OAAO,EACjC,OAAM,IAAI,eAAe,sCAAsC;AAGhE,QAAO,IAAI,IAAI,IAAI"}
@@ -0,0 +1,15 @@
1
+ import { createHash } from "@better-auth/utils/hash";
2
+ import { base64Url } from "@better-auth/utils/base64";
3
+
4
+ //#region src/plugins/oidc-provider/utils.ts
5
+ /**
6
+ * Default client secret hasher using SHA-256
7
+ */
8
+ const defaultClientSecretHasher = async (clientSecret) => {
9
+ const hash = await createHash("SHA-256").digest(new TextEncoder().encode(clientSecret));
10
+ return base64Url.encode(new Uint8Array(hash), { padding: false });
11
+ };
12
+
13
+ //#endregion
14
+ export { defaultClientSecretHasher };
15
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/plugins/oidc-provider/utils.ts"],"sourcesContent":["import { base64Url } from \"@better-auth/utils/base64\";\nimport { createHash } from \"@better-auth/utils/hash\";\n\n/**\n * Default client secret hasher using SHA-256\n */\nexport const defaultClientSecretHasher = async (clientSecret: string) => {\n\tconst hash = await createHash(\"SHA-256\").digest(\n\t\tnew TextEncoder().encode(clientSecret),\n\t);\n\tconst hashed = base64Url.encode(new Uint8Array(hash), {\n\t\tpadding: false,\n\t});\n\treturn hashed;\n};\n"],"mappings":";;;;;;;AAMA,MAAa,4BAA4B,OAAO,iBAAyB;CACxE,MAAM,OAAO,MAAM,WAAW,UAAU,CAAC,OACxC,IAAI,aAAa,CAAC,OAAO,aAAa,CACtC;AAID,QAHe,UAAU,OAAO,IAAI,WAAW,KAAK,EAAE,EACrD,SAAS,OACT,CAAC"}