better-auth 1.7.0-beta.2 → 1.7.0-beta.4

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 (282) hide show
  1. package/README.md +14 -15
  2. package/dist/_virtual/_rolldown/runtime.mjs +10 -1
  3. package/dist/api/index.d.mts +18 -48
  4. package/dist/api/routes/account.d.mts +4 -23
  5. package/dist/api/routes/account.mjs +102 -75
  6. package/dist/api/routes/callback.mjs +42 -20
  7. package/dist/api/routes/email-verification.d.mts +1 -0
  8. package/dist/api/routes/email-verification.mjs +6 -5
  9. package/dist/api/routes/error.mjs +1 -1
  10. package/dist/api/routes/password.mjs +1 -1
  11. package/dist/api/routes/session.mjs +15 -10
  12. package/dist/api/routes/sign-in.d.mts +3 -1
  13. package/dist/api/routes/sign-in.mjs +13 -15
  14. package/dist/api/routes/sign-up.d.mts +1 -0
  15. package/dist/api/routes/sign-up.mjs +10 -8
  16. package/dist/api/routes/update-user.mjs +8 -8
  17. package/dist/api/to-auth-endpoints.mjs +7 -1
  18. package/dist/auth/base.mjs +30 -27
  19. package/dist/client/config.mjs +8 -1
  20. package/dist/client/fetch-plugins.mjs +2 -1
  21. package/dist/client/index.d.mts +2 -2
  22. package/dist/client/lynx/index.d.mts +13 -0
  23. package/dist/client/lynx/index.mjs +2 -1
  24. package/dist/client/parser.mjs +0 -1
  25. package/dist/client/plugins/index.d.mts +4 -17
  26. package/dist/client/plugins/index.mjs +1 -4
  27. package/dist/client/proxy.mjs +2 -1
  28. package/dist/client/react/index.d.mts +13 -0
  29. package/dist/client/react/index.mjs +2 -1
  30. package/dist/client/session-atom.mjs +12 -1
  31. package/dist/client/solid/index.d.mts +13 -0
  32. package/dist/client/solid/index.mjs +3 -2
  33. package/dist/client/svelte/index.d.mts +13 -0
  34. package/dist/client/svelte/index.mjs +2 -1
  35. package/dist/client/vanilla.d.mts +13 -0
  36. package/dist/client/vanilla.mjs +2 -1
  37. package/dist/client/vue/index.d.mts +13 -0
  38. package/dist/client/vue/index.mjs +2 -1
  39. package/dist/context/create-context.mjs +10 -14
  40. package/dist/context/helpers.mjs +3 -2
  41. package/dist/cookies/cookie-utils.d.mts +33 -1
  42. package/dist/cookies/cookie-utils.mjs +95 -14
  43. package/dist/cookies/index.d.mts +2 -3
  44. package/dist/cookies/index.mjs +39 -11
  45. package/dist/cookies/session-store.mjs +4 -23
  46. package/dist/db/get-migration.mjs +4 -4
  47. package/dist/db/index.d.mts +2 -2
  48. package/dist/db/index.mjs +3 -2
  49. package/dist/db/internal-adapter.mjs +129 -27
  50. package/dist/db/schema.d.mts +14 -1
  51. package/dist/db/schema.mjs +26 -1
  52. package/dist/db/with-hooks.d.mts +1 -0
  53. package/dist/db/with-hooks.mjs +58 -1
  54. package/dist/index.d.mts +2 -2
  55. package/dist/index.mjs +2 -2
  56. package/dist/integrations/cookie-plugin-guard.mjs +18 -0
  57. package/dist/integrations/next-js.mjs +6 -0
  58. package/dist/integrations/svelte-kit.mjs +6 -0
  59. package/dist/integrations/tanstack-start-solid.mjs +6 -0
  60. package/dist/integrations/tanstack-start.mjs +6 -0
  61. package/dist/node_modules/.pnpm/clipboardy@4.0.0/node_modules/clipboardy/index.mjs +32 -0
  62. package/dist/node_modules/.pnpm/clipboardy@4.0.0/node_modules/clipboardy/lib/linux.mjs +55 -0
  63. package/dist/node_modules/.pnpm/clipboardy@4.0.0/node_modules/clipboardy/lib/macos.mjs +26 -0
  64. package/dist/node_modules/.pnpm/clipboardy@4.0.0/node_modules/clipboardy/lib/termux.mjs +39 -0
  65. package/dist/node_modules/.pnpm/clipboardy@4.0.0/node_modules/clipboardy/lib/windows.mjs +19 -0
  66. package/dist/node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs +845 -0
  67. package/dist/node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs +386 -0
  68. package/dist/node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs +320 -0
  69. package/dist/node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +62 -0
  70. package/dist/node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +190 -0
  71. package/dist/node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/utils.mjs +2 -0
  72. package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.mjs +29 -0
  73. package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.mjs +42 -0
  74. package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.mjs +67 -0
  75. package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.mjs +23 -0
  76. package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.mjs +22 -0
  77. package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.mjs +36 -0
  78. package/dist/node_modules/.pnpm/crossws@0.3.5/node_modules/crossws/dist/adapters/node.d.mts +292 -0
  79. package/dist/node_modules/.pnpm/crossws@0.3.5/node_modules/crossws/dist/adapters/node.mjs +127 -0
  80. package/dist/node_modules/.pnpm/crossws@0.3.5/node_modules/crossws/dist/index.d.mts +145 -0
  81. package/dist/node_modules/.pnpm/crossws@0.3.5/node_modules/crossws/dist/shared/crossws.BQXMA5bH.d.mts +298 -0
  82. package/dist/node_modules/.pnpm/crossws@0.3.5/node_modules/crossws/dist/shared/crossws.By9qWDAI.mjs +9 -0
  83. package/dist/node_modules/.pnpm/crossws@0.3.5/node_modules/crossws/dist/shared/crossws.CipVM6lf.mjs +3549 -0
  84. package/dist/node_modules/.pnpm/crossws@0.3.5/node_modules/crossws/dist/shared/crossws.D9ehKjSh.mjs +66 -0
  85. package/dist/node_modules/.pnpm/crossws@0.3.5/node_modules/crossws/dist/shared/crossws.DfCzGthR.mjs +227 -0
  86. package/dist/node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.mjs +224 -0
  87. package/dist/node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/command.mjs +52 -0
  88. package/dist/node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.mjs +54 -0
  89. package/dist/node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.mjs +62 -0
  90. package/dist/node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/pipe.mjs +26 -0
  91. package/dist/node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/promise.mjs +32 -0
  92. package/dist/node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stdio.mjs +19 -0
  93. package/dist/node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.mjs +98 -0
  94. package/dist/node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/verbose.mjs +15 -0
  95. package/dist/node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.d.mts +15 -0
  96. package/dist/node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs +220 -0
  97. package/dist/node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array-buffer.mjs +54 -0
  98. package/dist/node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array.mjs +2 -0
  99. package/dist/node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/buffer.mjs +14 -0
  100. package/dist/node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/contents.mjs +76 -0
  101. package/dist/node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/index.mjs +6 -0
  102. package/dist/node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/string.mjs +35 -0
  103. package/dist/node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/utils.mjs +10 -0
  104. package/dist/node_modules/.pnpm/http-shutdown@1.2.2/node_modules/http-shutdown/index.mjs +76 -0
  105. package/dist/node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/core.mjs +274 -0
  106. package/dist/node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.mjs +44 -0
  107. package/dist/node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/realtime.mjs +15 -0
  108. package/dist/node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.mjs +23 -0
  109. package/dist/node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.mjs +24 -0
  110. package/dist/node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.mjs +18 -0
  111. package/dist/node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.mjs +9 -0
  112. package/dist/node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.mjs +20 -0
  113. package/dist/node_modules/.pnpm/is64bit@2.0.0/node_modules/is64bit/index.mjs +13 -0
  114. package/dist/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.mjs +47 -0
  115. package/dist/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.mjs +33 -0
  116. package/dist/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.mjs +33 -0
  117. package/dist/node_modules/.pnpm/listhen@1.9.0/node_modules/listhen/dist/chunks/xdg-open.mjs +1070 -0
  118. package/dist/node_modules/.pnpm/listhen@1.9.0/node_modules/listhen/dist/index.mjs +619 -0
  119. package/dist/node_modules/.pnpm/listhen@1.9.0/node_modules/listhen/dist/shared/listhen.1c46e31d.d.mts +83 -0
  120. package/dist/node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.mjs +38 -0
  121. package/dist/node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.mjs +38 -0
  122. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/aes.mjs +597 -0
  123. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/aesCipherSuites.mjs +195 -0
  124. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/asn1-validator.mjs +76 -0
  125. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/asn1.mjs +967 -0
  126. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/baseN.mjs +137 -0
  127. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/cipher.mjs +186 -0
  128. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/cipherModes.mjs +597 -0
  129. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/des.mjs +1187 -0
  130. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/ed25519.mjs +1029 -0
  131. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/forge.mjs +15 -0
  132. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/hmac.mjs +107 -0
  133. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/index.mjs +66 -0
  134. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/jsbn.mjs +1334 -0
  135. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/kem.mjs +146 -0
  136. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/log.mjs +241 -0
  137. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/md.all.mjs +24 -0
  138. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/md.mjs +18 -0
  139. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/md5.mjs +324 -0
  140. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/mgf.mjs +20 -0
  141. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/mgf1.mjs +44 -0
  142. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/oids.mjs +154 -0
  143. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/pbe.mjs +815 -0
  144. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/pbkdf2.mjs +125 -0
  145. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/pem.mjs +175 -0
  146. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/pkcs1.mjs +200 -0
  147. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/pkcs12.mjs +724 -0
  148. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/pkcs7.mjs +642 -0
  149. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/pkcs7asn1.mjs +405 -0
  150. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/pki.mjs +101 -0
  151. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/prime.mjs +193 -0
  152. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/prng.mjs +290 -0
  153. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/pss.mjs +141 -0
  154. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/random.mjs +141 -0
  155. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/rc2.mjs +538 -0
  156. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/rsa.mjs +1309 -0
  157. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/sha1.mjs +230 -0
  158. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/sha256.mjs +267 -0
  159. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/sha512.mjs +413 -0
  160. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/ssh.mjs +194 -0
  161. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/tls.mjs +3655 -0
  162. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/util.mjs +2117 -0
  163. package/dist/node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/x509.mjs +2168 -0
  164. package/dist/node_modules/.pnpm/npm-run-path@5.3.0/node_modules/npm-run-path/index.mjs +34 -0
  165. package/dist/node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.mjs +26 -0
  166. package/dist/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.mjs +14 -0
  167. package/dist/node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.mjs +8 -0
  168. package/dist/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.mjs +176 -0
  169. package/dist/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.mjs +17 -0
  170. package/dist/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.mjs +8 -0
  171. package/dist/node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.mjs +169 -0
  172. package/dist/node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.mjs +33 -0
  173. package/dist/node_modules/.pnpm/std-env@3.10.0/node_modules/std-env/dist/index.mjs +171 -0
  174. package/dist/node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.mjs +10 -0
  175. package/dist/node_modules/.pnpm/system-architecture@0.1.0/node_modules/system-architecture/index.mjs +16 -0
  176. package/dist/node_modules/.pnpm/uncrypto@0.1.3/node_modules/uncrypto/dist/crypto.node.mjs +7 -0
  177. package/dist/node_modules/.pnpm/untun@0.1.3/node_modules/untun/dist/chunks/index.mjs +154 -0
  178. package/dist/node_modules/.pnpm/untun@0.1.3/node_modules/untun/dist/index.mjs +34 -0
  179. package/dist/node_modules/.pnpm/uqr@0.1.2/node_modules/uqr/dist/index.mjs +896 -0
  180. package/dist/node_modules/.pnpm/which@2.0.2/node_modules/which/which.mjs +76 -0
  181. package/dist/oauth2/errors.mjs +27 -0
  182. package/dist/oauth2/index.d.mts +2 -2
  183. package/dist/oauth2/index.mjs +3 -3
  184. package/dist/oauth2/link-account.d.mts +27 -1
  185. package/dist/oauth2/link-account.mjs +30 -5
  186. package/dist/oauth2/state.mjs +8 -2
  187. package/dist/{package.mjs → packages/better-auth/package.mjs} +1 -1
  188. package/dist/plugins/access/access.d.mts +3 -15
  189. package/dist/plugins/access/access.mjs +11 -6
  190. package/dist/plugins/access/index.d.mts +2 -2
  191. package/dist/plugins/access/types.d.mts +11 -4
  192. package/dist/plugins/admin/access/statement.d.mts +29 -93
  193. package/dist/plugins/admin/admin.mjs +0 -4
  194. package/dist/plugins/admin/client.d.mts +6 -1
  195. package/dist/plugins/admin/client.mjs +5 -0
  196. package/dist/plugins/admin/routes.mjs +3 -2
  197. package/dist/plugins/anonymous/client.d.mts +1 -0
  198. package/dist/plugins/anonymous/error-codes.d.mts +1 -0
  199. package/dist/plugins/anonymous/error-codes.mjs +1 -0
  200. package/dist/plugins/anonymous/index.d.mts +1 -0
  201. package/dist/plugins/anonymous/index.mjs +16 -2
  202. package/dist/plugins/bearer/index.mjs +5 -12
  203. package/dist/plugins/captcha/index.mjs +14 -1
  204. package/dist/plugins/device-authorization/error-codes.mjs +1 -0
  205. package/dist/plugins/device-authorization/index.d.mts +1 -0
  206. package/dist/plugins/device-authorization/routes.mjs +34 -3
  207. package/dist/plugins/email-otp/routes.mjs +4 -4
  208. package/dist/plugins/generic-oauth/error-codes.mjs +0 -1
  209. package/dist/plugins/generic-oauth/index.d.mts +2 -4
  210. package/dist/plugins/generic-oauth/index.mjs +23 -17
  211. package/dist/plugins/generic-oauth/providers/auth0.mjs +1 -0
  212. package/dist/plugins/generic-oauth/providers/gumroad.mjs +1 -0
  213. package/dist/plugins/generic-oauth/providers/hubspot.mjs +1 -0
  214. package/dist/plugins/generic-oauth/providers/keycloak.mjs +1 -0
  215. package/dist/plugins/generic-oauth/providers/line.mjs +1 -0
  216. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +1 -0
  217. package/dist/plugins/generic-oauth/providers/okta.mjs +1 -0
  218. package/dist/plugins/generic-oauth/providers/patreon.mjs +1 -0
  219. package/dist/plugins/generic-oauth/providers/slack.mjs +1 -0
  220. package/dist/plugins/generic-oauth/types.d.mts +30 -8
  221. package/dist/plugins/index.d.mts +2 -2
  222. package/dist/plugins/jwt/utils.d.mts +1 -1
  223. package/dist/plugins/last-login-method/client.mjs +2 -2
  224. package/dist/plugins/magic-link/index.d.mts +8 -1
  225. package/dist/plugins/magic-link/index.mjs +4 -17
  226. package/dist/plugins/mcp/authorize.mjs +8 -2
  227. package/dist/plugins/mcp/index.mjs +75 -35
  228. package/dist/plugins/multi-session/index.mjs +2 -2
  229. package/dist/plugins/oauth-proxy/index.mjs +45 -32
  230. package/dist/plugins/oauth-proxy/utils.mjs +3 -10
  231. package/dist/plugins/oidc-provider/authorize.mjs +8 -2
  232. package/dist/plugins/oidc-provider/index.mjs +65 -38
  233. package/dist/plugins/one-tap/client.mjs +9 -2
  234. package/dist/plugins/one-tap/index.mjs +19 -36
  235. package/dist/plugins/open-api/generator.mjs +25 -5
  236. package/dist/plugins/organization/access/statement.d.mts +68 -201
  237. package/dist/plugins/organization/adapter.d.mts +1 -1
  238. package/dist/plugins/organization/adapter.mjs +65 -58
  239. package/dist/plugins/organization/client.d.mts +3 -1
  240. package/dist/plugins/organization/client.mjs +1 -1
  241. package/dist/plugins/organization/error-codes.d.mts +2 -0
  242. package/dist/plugins/organization/error-codes.mjs +3 -1
  243. package/dist/plugins/organization/routes/crud-access-control.d.mts +2 -2
  244. package/dist/plugins/organization/routes/crud-invites.d.mts +8 -1
  245. package/dist/plugins/organization/routes/crud-invites.mjs +8 -3
  246. package/dist/plugins/organization/routes/crud-org.d.mts +4 -4
  247. package/dist/plugins/organization/routes/crud-org.mjs +2 -2
  248. package/dist/plugins/organization/routes/crud-team.mjs +7 -2
  249. package/dist/plugins/organization/schema.d.mts +1 -1
  250. package/dist/plugins/organization/types.d.mts +15 -5
  251. package/dist/plugins/phone-number/routes.mjs +1 -1
  252. package/dist/plugins/siwe/client.d.mts +4 -0
  253. package/dist/plugins/siwe/client.mjs +5 -1
  254. package/dist/plugins/siwe/index.d.mts +13 -2
  255. package/dist/plugins/siwe/index.mjs +179 -165
  256. package/dist/plugins/two-factor/backup-codes/index.d.mts +4 -3
  257. package/dist/plugins/two-factor/client.mjs +2 -1
  258. package/dist/plugins/two-factor/index.mjs +3 -2
  259. package/dist/plugins/username/client.d.mts +1 -0
  260. package/dist/plugins/username/error-codes.d.mts +1 -0
  261. package/dist/plugins/username/error-codes.mjs +2 -1
  262. package/dist/plugins/username/index.d.mts +43 -2
  263. package/dist/plugins/username/index.mjs +73 -6
  264. package/dist/state.d.mts +2 -2
  265. package/dist/state.mjs +18 -4
  266. package/dist/test-utils/headers.mjs +2 -7
  267. package/dist/test-utils/http-test-instance.d.mts +397 -0
  268. package/dist/test-utils/http-test-instance.mjs +54 -0
  269. package/dist/test-utils/index.d.mts +2 -1
  270. package/dist/test-utils/index.mjs +2 -1
  271. package/dist/test-utils/test-instance.d.mts +4110 -224
  272. package/dist/test-utils/test-instance.mjs +11 -2
  273. package/dist/types/auth.d.mts +4 -0
  274. package/dist/utils/index.d.mts +1 -1
  275. package/dist/utils/url.d.mts +2 -1
  276. package/dist/utils/url.mjs +9 -3
  277. package/dist/version.mjs +1 -1
  278. package/package.json +14 -14
  279. package/dist/oauth2/error-codes.d.mts +0 -20
  280. package/dist/plugins/generic-oauth/client.d.mts +0 -32
  281. package/dist/plugins/generic-oauth/client.mjs +0 -19
  282. package/dist/plugins/generic-oauth/error-codes.d.mts +0 -10
@@ -0,0 +1,538 @@
1
+ import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.mjs";
2
+ import { require_forge } from "./forge.mjs";
3
+ import { require_util } from "./util.mjs";
4
+ //#region ../../node_modules/.pnpm/node-forge@1.4.0/node_modules/node-forge/lib/rc2.js
5
+ var require_rc2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6
+ /**
7
+ * RC2 implementation.
8
+ *
9
+ * @author Stefan Siegl
10
+ *
11
+ * Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>
12
+ *
13
+ * Information on the RC2 cipher is available from RFC #2268,
14
+ * http://www.ietf.org/rfc/rfc2268.txt
15
+ */
16
+ var forge = require_forge();
17
+ require_util();
18
+ var piTable = [
19
+ 217,
20
+ 120,
21
+ 249,
22
+ 196,
23
+ 25,
24
+ 221,
25
+ 181,
26
+ 237,
27
+ 40,
28
+ 233,
29
+ 253,
30
+ 121,
31
+ 74,
32
+ 160,
33
+ 216,
34
+ 157,
35
+ 198,
36
+ 126,
37
+ 55,
38
+ 131,
39
+ 43,
40
+ 118,
41
+ 83,
42
+ 142,
43
+ 98,
44
+ 76,
45
+ 100,
46
+ 136,
47
+ 68,
48
+ 139,
49
+ 251,
50
+ 162,
51
+ 23,
52
+ 154,
53
+ 89,
54
+ 245,
55
+ 135,
56
+ 179,
57
+ 79,
58
+ 19,
59
+ 97,
60
+ 69,
61
+ 109,
62
+ 141,
63
+ 9,
64
+ 129,
65
+ 125,
66
+ 50,
67
+ 189,
68
+ 143,
69
+ 64,
70
+ 235,
71
+ 134,
72
+ 183,
73
+ 123,
74
+ 11,
75
+ 240,
76
+ 149,
77
+ 33,
78
+ 34,
79
+ 92,
80
+ 107,
81
+ 78,
82
+ 130,
83
+ 84,
84
+ 214,
85
+ 101,
86
+ 147,
87
+ 206,
88
+ 96,
89
+ 178,
90
+ 28,
91
+ 115,
92
+ 86,
93
+ 192,
94
+ 20,
95
+ 167,
96
+ 140,
97
+ 241,
98
+ 220,
99
+ 18,
100
+ 117,
101
+ 202,
102
+ 31,
103
+ 59,
104
+ 190,
105
+ 228,
106
+ 209,
107
+ 66,
108
+ 61,
109
+ 212,
110
+ 48,
111
+ 163,
112
+ 60,
113
+ 182,
114
+ 38,
115
+ 111,
116
+ 191,
117
+ 14,
118
+ 218,
119
+ 70,
120
+ 105,
121
+ 7,
122
+ 87,
123
+ 39,
124
+ 242,
125
+ 29,
126
+ 155,
127
+ 188,
128
+ 148,
129
+ 67,
130
+ 3,
131
+ 248,
132
+ 17,
133
+ 199,
134
+ 246,
135
+ 144,
136
+ 239,
137
+ 62,
138
+ 231,
139
+ 6,
140
+ 195,
141
+ 213,
142
+ 47,
143
+ 200,
144
+ 102,
145
+ 30,
146
+ 215,
147
+ 8,
148
+ 232,
149
+ 234,
150
+ 222,
151
+ 128,
152
+ 82,
153
+ 238,
154
+ 247,
155
+ 132,
156
+ 170,
157
+ 114,
158
+ 172,
159
+ 53,
160
+ 77,
161
+ 106,
162
+ 42,
163
+ 150,
164
+ 26,
165
+ 210,
166
+ 113,
167
+ 90,
168
+ 21,
169
+ 73,
170
+ 116,
171
+ 75,
172
+ 159,
173
+ 208,
174
+ 94,
175
+ 4,
176
+ 24,
177
+ 164,
178
+ 236,
179
+ 194,
180
+ 224,
181
+ 65,
182
+ 110,
183
+ 15,
184
+ 81,
185
+ 203,
186
+ 204,
187
+ 36,
188
+ 145,
189
+ 175,
190
+ 80,
191
+ 161,
192
+ 244,
193
+ 112,
194
+ 57,
195
+ 153,
196
+ 124,
197
+ 58,
198
+ 133,
199
+ 35,
200
+ 184,
201
+ 180,
202
+ 122,
203
+ 252,
204
+ 2,
205
+ 54,
206
+ 91,
207
+ 37,
208
+ 85,
209
+ 151,
210
+ 49,
211
+ 45,
212
+ 93,
213
+ 250,
214
+ 152,
215
+ 227,
216
+ 138,
217
+ 146,
218
+ 174,
219
+ 5,
220
+ 223,
221
+ 41,
222
+ 16,
223
+ 103,
224
+ 108,
225
+ 186,
226
+ 201,
227
+ 211,
228
+ 0,
229
+ 230,
230
+ 207,
231
+ 225,
232
+ 158,
233
+ 168,
234
+ 44,
235
+ 99,
236
+ 22,
237
+ 1,
238
+ 63,
239
+ 88,
240
+ 226,
241
+ 137,
242
+ 169,
243
+ 13,
244
+ 56,
245
+ 52,
246
+ 27,
247
+ 171,
248
+ 51,
249
+ 255,
250
+ 176,
251
+ 187,
252
+ 72,
253
+ 12,
254
+ 95,
255
+ 185,
256
+ 177,
257
+ 205,
258
+ 46,
259
+ 197,
260
+ 243,
261
+ 219,
262
+ 71,
263
+ 229,
264
+ 165,
265
+ 156,
266
+ 119,
267
+ 10,
268
+ 166,
269
+ 32,
270
+ 104,
271
+ 254,
272
+ 127,
273
+ 193,
274
+ 173
275
+ ];
276
+ var s = [
277
+ 1,
278
+ 2,
279
+ 3,
280
+ 5
281
+ ];
282
+ /**
283
+ * Rotate a word left by given number of bits.
284
+ *
285
+ * Bits that are shifted out on the left are put back in on the right
286
+ * hand side.
287
+ *
288
+ * @param word The word to shift left.
289
+ * @param bits The number of bits to shift by.
290
+ * @return The rotated word.
291
+ */
292
+ var rol = function(word, bits) {
293
+ return word << bits & 65535 | (word & 65535) >> 16 - bits;
294
+ };
295
+ /**
296
+ * Rotate a word right by given number of bits.
297
+ *
298
+ * Bits that are shifted out on the right are put back in on the left
299
+ * hand side.
300
+ *
301
+ * @param word The word to shift right.
302
+ * @param bits The number of bits to shift by.
303
+ * @return The rotated word.
304
+ */
305
+ var ror = function(word, bits) {
306
+ return (word & 65535) >> bits | word << 16 - bits & 65535;
307
+ };
308
+ module.exports = forge.rc2 = forge.rc2 || {};
309
+ /**
310
+ * Perform RC2 key expansion as per RFC #2268, section 2.
311
+ *
312
+ * @param key variable-length user key (between 1 and 128 bytes)
313
+ * @param effKeyBits number of effective key bits (default: 128)
314
+ * @return the expanded RC2 key (ByteBuffer of 128 bytes)
315
+ */
316
+ forge.rc2.expandKey = function(key, effKeyBits) {
317
+ if (typeof key === "string") key = forge.util.createBuffer(key);
318
+ effKeyBits = effKeyBits || 128;
319
+ var L = key;
320
+ var T = key.length();
321
+ var T1 = effKeyBits;
322
+ var T8 = Math.ceil(T1 / 8);
323
+ var TM = 255 >> (T1 & 7);
324
+ var i;
325
+ for (i = T; i < 128; i++) L.putByte(piTable[L.at(i - 1) + L.at(i - T) & 255]);
326
+ L.setAt(128 - T8, piTable[L.at(128 - T8) & TM]);
327
+ for (i = 127 - T8; i >= 0; i--) L.setAt(i, piTable[L.at(i + 1) ^ L.at(i + T8)]);
328
+ return L;
329
+ };
330
+ /**
331
+ * Creates a RC2 cipher object.
332
+ *
333
+ * @param key the symmetric key to use (as base for key generation).
334
+ * @param bits the number of effective key bits.
335
+ * @param encrypt false for decryption, true for encryption.
336
+ *
337
+ * @return the cipher.
338
+ */
339
+ var createCipher = function(key, bits, encrypt) {
340
+ var _finish = false, _input = null, _output = null, _iv = null;
341
+ var mixRound, mashRound;
342
+ var i, j, K = [];
343
+ key = forge.rc2.expandKey(key, bits);
344
+ for (i = 0; i < 64; i++) K.push(key.getInt16Le());
345
+ if (encrypt) {
346
+ /**
347
+ * Perform one mixing round "in place".
348
+ *
349
+ * @param R Array of four words to perform mixing on.
350
+ */
351
+ mixRound = function(R) {
352
+ for (i = 0; i < 4; i++) {
353
+ R[i] += K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) + (~R[(i + 3) % 4] & R[(i + 1) % 4]);
354
+ R[i] = rol(R[i], s[i]);
355
+ j++;
356
+ }
357
+ };
358
+ /**
359
+ * Perform one mashing round "in place".
360
+ *
361
+ * @param R Array of four words to perform mashing on.
362
+ */
363
+ mashRound = function(R) {
364
+ for (i = 0; i < 4; i++) R[i] += K[R[(i + 3) % 4] & 63];
365
+ };
366
+ } else {
367
+ /**
368
+ * Perform one r-mixing round "in place".
369
+ *
370
+ * @param R Array of four words to perform mixing on.
371
+ */
372
+ mixRound = function(R) {
373
+ for (i = 3; i >= 0; i--) {
374
+ R[i] = ror(R[i], s[i]);
375
+ R[i] -= K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) + (~R[(i + 3) % 4] & R[(i + 1) % 4]);
376
+ j--;
377
+ }
378
+ };
379
+ /**
380
+ * Perform one r-mashing round "in place".
381
+ *
382
+ * @param R Array of four words to perform mashing on.
383
+ */
384
+ mashRound = function(R) {
385
+ for (i = 3; i >= 0; i--) R[i] -= K[R[(i + 3) % 4] & 63];
386
+ };
387
+ }
388
+ /**
389
+ * Run the specified cipher execution plan.
390
+ *
391
+ * This function takes four words from the input buffer, applies the IV on
392
+ * it (if requested) and runs the provided execution plan.
393
+ *
394
+ * The plan must be put together in form of a array of arrays. Where the
395
+ * outer one is simply a list of steps to perform and the inner one needs
396
+ * to have two elements: the first one telling how many rounds to perform,
397
+ * the second one telling what to do (i.e. the function to call).
398
+ *
399
+ * @param {Array} plan The plan to execute.
400
+ */
401
+ var runPlan = function(plan) {
402
+ var R = [];
403
+ for (i = 0; i < 4; i++) {
404
+ var val = _input.getInt16Le();
405
+ if (_iv !== null) if (encrypt) val ^= _iv.getInt16Le();
406
+ else _iv.putInt16Le(val);
407
+ R.push(val & 65535);
408
+ }
409
+ j = encrypt ? 0 : 63;
410
+ for (var ptr = 0; ptr < plan.length; ptr++) for (var ctr = 0; ctr < plan[ptr][0]; ctr++) plan[ptr][1](R);
411
+ for (i = 0; i < 4; i++) {
412
+ if (_iv !== null) if (encrypt) _iv.putInt16Le(R[i]);
413
+ else R[i] ^= _iv.getInt16Le();
414
+ _output.putInt16Le(R[i]);
415
+ }
416
+ };
417
+ var cipher = null;
418
+ cipher = {
419
+ start: function(iv, output) {
420
+ if (iv) {
421
+ if (typeof iv === "string") iv = forge.util.createBuffer(iv);
422
+ }
423
+ _finish = false;
424
+ _input = forge.util.createBuffer();
425
+ _output = output || new forge.util.createBuffer();
426
+ _iv = iv;
427
+ cipher.output = _output;
428
+ },
429
+ update: function(input) {
430
+ if (!_finish) _input.putBuffer(input);
431
+ while (_input.length() >= 8) runPlan([
432
+ [5, mixRound],
433
+ [1, mashRound],
434
+ [6, mixRound],
435
+ [1, mashRound],
436
+ [5, mixRound]
437
+ ]);
438
+ },
439
+ finish: function(pad) {
440
+ var rval = true;
441
+ if (encrypt) if (pad) rval = pad(8, _input, !encrypt);
442
+ else {
443
+ var padding = _input.length() === 8 ? 8 : 8 - _input.length();
444
+ _input.fillWithByte(padding, padding);
445
+ }
446
+ if (rval) {
447
+ _finish = true;
448
+ cipher.update();
449
+ }
450
+ if (!encrypt) {
451
+ rval = _input.length() === 0;
452
+ if (rval) if (pad) rval = pad(8, _output, !encrypt);
453
+ else {
454
+ var len = _output.length();
455
+ var count = _output.at(len - 1);
456
+ if (count > len) rval = false;
457
+ else _output.truncate(count);
458
+ }
459
+ }
460
+ return rval;
461
+ }
462
+ };
463
+ return cipher;
464
+ };
465
+ /**
466
+ * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the
467
+ * given symmetric key. The output will be stored in the 'output' member
468
+ * of the returned cipher.
469
+ *
470
+ * The key and iv may be given as a string of bytes or a byte buffer.
471
+ * The cipher is initialized to use 128 effective key bits.
472
+ *
473
+ * @param key the symmetric key to use.
474
+ * @param iv the initialization vector to use.
475
+ * @param output the buffer to write to, null to create one.
476
+ *
477
+ * @return the cipher.
478
+ */
479
+ forge.rc2.startEncrypting = function(key, iv, output) {
480
+ var cipher = forge.rc2.createEncryptionCipher(key, 128);
481
+ cipher.start(iv, output);
482
+ return cipher;
483
+ };
484
+ /**
485
+ * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the
486
+ * given symmetric key.
487
+ *
488
+ * The key may be given as a string of bytes or a byte buffer.
489
+ *
490
+ * To start encrypting call start() on the cipher with an iv and optional
491
+ * output buffer.
492
+ *
493
+ * @param key the symmetric key to use.
494
+ *
495
+ * @return the cipher.
496
+ */
497
+ forge.rc2.createEncryptionCipher = function(key, bits) {
498
+ return createCipher(key, bits, true);
499
+ };
500
+ /**
501
+ * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the
502
+ * given symmetric key. The output will be stored in the 'output' member
503
+ * of the returned cipher.
504
+ *
505
+ * The key and iv may be given as a string of bytes or a byte buffer.
506
+ * The cipher is initialized to use 128 effective key bits.
507
+ *
508
+ * @param key the symmetric key to use.
509
+ * @param iv the initialization vector to use.
510
+ * @param output the buffer to write to, null to create one.
511
+ *
512
+ * @return the cipher.
513
+ */
514
+ forge.rc2.startDecrypting = function(key, iv, output) {
515
+ var cipher = forge.rc2.createDecryptionCipher(key, 128);
516
+ cipher.start(iv, output);
517
+ return cipher;
518
+ };
519
+ /**
520
+ * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the
521
+ * given symmetric key.
522
+ *
523
+ * The key may be given as a string of bytes or a byte buffer.
524
+ *
525
+ * To start decrypting call start() on the cipher with an iv and optional
526
+ * output buffer.
527
+ *
528
+ * @param key the symmetric key to use.
529
+ *
530
+ * @return the cipher.
531
+ */
532
+ forge.rc2.createDecryptionCipher = function(key, bits) {
533
+ return createCipher(key, bits, false);
534
+ };
535
+ }));
536
+ //#endregion
537
+ export default require_rc2();
538
+ export { require_rc2 };