better-auth 1.7.21 → 1.7.23

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 (439) hide show
  1. package/dist/_virtual/_rolldown/runtime.mjs +1 -2
  2. package/dist/adapters/index.d.mts +0 -2
  3. package/dist/adapters/index.mjs +1 -2
  4. package/dist/api/dispatch.d.mts +1 -3
  5. package/dist/api/dispatch.mjs +1 -2
  6. package/dist/api/index.d.mts +3 -3
  7. package/dist/api/index.mjs +8 -9
  8. package/dist/api/middlewares/authorization.d.mts +1 -3
  9. package/dist/api/middlewares/authorization.mjs +1 -2
  10. package/dist/api/middlewares/origin-check.d.mts +1 -3
  11. package/dist/api/middlewares/origin-check.mjs +2 -3
  12. package/dist/api/rate-limiter/index.mjs +1 -2
  13. package/dist/api/routes/account.d.mts +1 -3
  14. package/dist/api/routes/account.mjs +10 -10
  15. package/dist/api/routes/callback.d.mts +1 -3
  16. package/dist/api/routes/callback.mjs +5 -6
  17. package/dist/api/routes/email-verification.d.mts +1 -3
  18. package/dist/api/routes/email-verification.mjs +4 -5
  19. package/dist/api/routes/error.d.mts +1 -3
  20. package/dist/api/routes/error.mjs +1 -2
  21. package/dist/api/routes/ok.d.mts +1 -3
  22. package/dist/api/routes/ok.mjs +1 -2
  23. package/dist/api/routes/password.d.mts +1 -3
  24. package/dist/api/routes/password.mjs +3 -4
  25. package/dist/api/routes/session.d.mts +2 -3
  26. package/dist/api/routes/session.mjs +10 -6
  27. package/dist/api/routes/sign-in.d.mts +0 -2
  28. package/dist/api/routes/sign-in.mjs +6 -7
  29. package/dist/api/routes/sign-out.d.mts +1 -3
  30. package/dist/api/routes/sign-out.mjs +1 -2
  31. package/dist/api/routes/sign-up.d.mts +1 -3
  32. package/dist/api/routes/sign-up.mjs +5 -6
  33. package/dist/api/routes/update-session.d.mts +1 -3
  34. package/dist/api/routes/update-session.mjs +2 -3
  35. package/dist/api/routes/update-user.d.mts +1 -3
  36. package/dist/api/routes/update-user.mjs +31 -28
  37. package/dist/api/state/oauth.d.mts +0 -2
  38. package/dist/api/state/oauth.mjs +1 -2
  39. package/dist/api/state/session-source.d.mts +1 -3
  40. package/dist/api/state/session-source.mjs +1 -2
  41. package/dist/api/state/should-session-refresh.d.mts +0 -2
  42. package/dist/api/state/should-session-refresh.mjs +1 -2
  43. package/dist/api/to-auth-endpoints.mjs +2 -3
  44. package/dist/auth/base.mjs +3 -9
  45. package/dist/auth/full.d.mts +1 -3
  46. package/dist/auth/full.mjs +1 -2
  47. package/dist/auth/minimal.d.mts +0 -2
  48. package/dist/auth/minimal.mjs +2 -3
  49. package/dist/auth/trusted-origins.mjs +2 -3
  50. package/dist/client/broadcast-channel.d.mts +1 -3
  51. package/dist/client/broadcast-channel.mjs +4 -4
  52. package/dist/client/config.d.mts +1 -3
  53. package/dist/client/config.mjs +2 -3
  54. package/dist/client/equality.d.mts +1 -3
  55. package/dist/client/equality.mjs +1 -2
  56. package/dist/client/fetch-plugins.mjs +1 -2
  57. package/dist/client/focus-manager.d.mts +1 -3
  58. package/dist/client/focus-manager.mjs +4 -4
  59. package/dist/client/index.d.mts +5 -7
  60. package/dist/client/index.mjs +1 -2
  61. package/dist/client/lynx/index.d.mts +1 -3
  62. package/dist/client/lynx/index.mjs +1 -2
  63. package/dist/client/lynx/lynx-store.d.mts +0 -2
  64. package/dist/client/lynx/lynx-store.mjs +1 -2
  65. package/dist/client/online-manager.d.mts +1 -3
  66. package/dist/client/online-manager.mjs +7 -7
  67. package/dist/client/parser.d.mts +0 -2
  68. package/dist/client/parser.mjs +1 -2
  69. package/dist/client/path-to-object.d.mts +0 -2
  70. package/dist/client/plugins/index.d.mts +6 -6
  71. package/dist/client/plugins/infer-plugin.d.mts +1 -3
  72. package/dist/client/plugins/infer-plugin.mjs +1 -2
  73. package/dist/client/proxy.mjs +1 -2
  74. package/dist/client/query-atom.mjs +1 -2
  75. package/dist/client/query.d.mts +1 -3
  76. package/dist/client/query.mjs +1 -2
  77. package/dist/client/react/index.d.mts +1 -3
  78. package/dist/client/react/index.mjs +1 -2
  79. package/dist/client/react/react-store.d.mts +0 -2
  80. package/dist/client/react/react-store.mjs +1 -2
  81. package/dist/client/session-atom.d.mts +1 -3
  82. package/dist/client/session-atom.mjs +2 -2
  83. package/dist/client/session-refresh.d.mts +1 -3
  84. package/dist/client/session-refresh.mjs +3 -3
  85. package/dist/client/solid/index.d.mts +1 -3
  86. package/dist/client/solid/index.mjs +1 -2
  87. package/dist/client/solid/solid-store.mjs +1 -2
  88. package/dist/client/svelte/index.d.mts +1 -3
  89. package/dist/client/svelte/index.mjs +1 -2
  90. package/dist/client/types.d.mts +2 -4
  91. package/dist/client/vanilla.d.mts +1 -3
  92. package/dist/client/vanilla.mjs +1 -2
  93. package/dist/client/vue/index.d.mts +1 -3
  94. package/dist/client/vue/index.mjs +1 -2
  95. package/dist/client/vue/vue-store.mjs +1 -2
  96. package/dist/context/create-context.mjs +8 -9
  97. package/dist/context/helpers.mjs +3 -4
  98. package/dist/context/init-minimal.mjs +1 -2
  99. package/dist/context/init.mjs +1 -2
  100. package/dist/context/secret-utils.mjs +1 -2
  101. package/dist/context/store-capabilities.mjs +1 -2
  102. package/dist/cookies/cache.mjs +1 -2
  103. package/dist/cookies/cookie-utils.d.mts +0 -2
  104. package/dist/cookies/cookie-utils.mjs +1 -2
  105. package/dist/cookies/index.d.mts +0 -2
  106. package/dist/cookies/index.mjs +2 -3
  107. package/dist/cookies/jwt.mjs +1 -2
  108. package/dist/cookies/session-store.d.mts +0 -2
  109. package/dist/cookies/session-store.mjs +1 -2
  110. package/dist/crypto/buffer.d.mts +1 -3
  111. package/dist/crypto/buffer.mjs +1 -2
  112. package/dist/crypto/index.d.mts +0 -2
  113. package/dist/crypto/index.mjs +2 -3
  114. package/dist/crypto/jwt.d.mts +1 -3
  115. package/dist/crypto/jwt.mjs +1 -2
  116. package/dist/crypto/password.d.mts +0 -2
  117. package/dist/crypto/password.mjs +1 -2
  118. package/dist/crypto/purpose.mjs +1 -2
  119. package/dist/crypto/random.d.mts +1 -3
  120. package/dist/crypto/random.mjs +1 -2
  121. package/dist/db/adapter-base.d.mts +1 -3
  122. package/dist/db/adapter-base.mjs +1 -2
  123. package/dist/db/adapter-kysely.d.mts +1 -3
  124. package/dist/db/adapter-kysely.mjs +1 -2
  125. package/dist/db/field-converter.d.mts +1 -3
  126. package/dist/db/field-converter.mjs +1 -2
  127. package/dist/db/field.d.mts +0 -2
  128. package/dist/db/get-migration.d.mts +1 -3
  129. package/dist/db/get-migration.mjs +1 -2
  130. package/dist/db/get-schema.d.mts +1 -3
  131. package/dist/db/get-schema.mjs +1 -2
  132. package/dist/db/index.d.mts +1 -1
  133. package/dist/db/index.mjs +4 -5
  134. package/dist/db/internal-adapter.d.mts +1 -3
  135. package/dist/db/internal-adapter.mjs +21 -10
  136. package/dist/db/revoke-unproven-account-access.d.mts +1 -3
  137. package/dist/db/revoke-unproven-account-access.mjs +1 -2
  138. package/dist/db/schema.d.mts +1 -3
  139. package/dist/db/schema.mjs +1 -2
  140. package/dist/db/to-zod.d.mts +0 -2
  141. package/dist/db/to-zod.mjs +1 -2
  142. package/dist/db/verification-token-storage.mjs +1 -2
  143. package/dist/db/with-hooks.d.mts +1 -3
  144. package/dist/db/with-hooks.mjs +1 -2
  145. package/dist/index.d.mts +1 -1
  146. package/dist/index.mjs +1 -1
  147. package/dist/integrations/cookie-plugin-guard.mjs +1 -2
  148. package/dist/integrations/next-js.d.mts +1 -3
  149. package/dist/integrations/next-js.mjs +2 -3
  150. package/dist/integrations/node.d.mts +1 -3
  151. package/dist/integrations/node.mjs +1 -2
  152. package/dist/integrations/solid-start.d.mts +1 -3
  153. package/dist/integrations/solid-start.mjs +1 -2
  154. package/dist/integrations/svelte-kit.d.mts +1 -3
  155. package/dist/integrations/svelte-kit.mjs +1 -2
  156. package/dist/integrations/tanstack-start-solid.d.mts +1 -3
  157. package/dist/integrations/tanstack-start-solid.mjs +1 -2
  158. package/dist/integrations/tanstack-start.d.mts +1 -3
  159. package/dist/integrations/tanstack-start.mjs +1 -2
  160. package/dist/oauth2/account-key.mjs +1 -2
  161. package/dist/oauth2/callback.mjs +1 -2
  162. package/dist/oauth2/errors.mjs +1 -2
  163. package/dist/oauth2/index.d.mts +1 -1
  164. package/dist/oauth2/index.mjs +1 -1
  165. package/dist/oauth2/link-account.d.mts +1 -3
  166. package/dist/oauth2/link-account.mjs +18 -13
  167. package/dist/oauth2/state.d.mts +1 -3
  168. package/dist/oauth2/state.mjs +3 -4
  169. package/dist/oauth2/utils.d.mts +1 -3
  170. package/dist/oauth2/utils.mjs +1 -2
  171. package/dist/package.mjs +2 -3
  172. package/dist/plugins/access/access.d.mts +1 -3
  173. package/dist/plugins/access/access.mjs +1 -2
  174. package/dist/plugins/access/index.d.mts +1 -1
  175. package/dist/plugins/access/types.d.mts +1 -3
  176. package/dist/plugins/additional-fields/client.d.mts +1 -3
  177. package/dist/plugins/additional-fields/client.mjs +1 -2
  178. package/dist/plugins/admin/access/statement.d.mts +1 -3
  179. package/dist/plugins/admin/access/statement.mjs +1 -2
  180. package/dist/plugins/admin/admin.d.mts +1 -3
  181. package/dist/plugins/admin/admin.mjs +2 -3
  182. package/dist/plugins/admin/client.d.mts +2 -4
  183. package/dist/plugins/admin/client.mjs +1 -2
  184. package/dist/plugins/admin/error-codes.d.mts +1 -3
  185. package/dist/plugins/admin/error-codes.mjs +1 -2
  186. package/dist/plugins/admin/has-permission.mjs +1 -2
  187. package/dist/plugins/admin/index.d.mts +1 -1
  188. package/dist/plugins/admin/routes.mjs +3 -4
  189. package/dist/plugins/admin/schema.d.mts +1 -3
  190. package/dist/plugins/admin/schema.mjs +1 -2
  191. package/dist/plugins/admin/types.d.mts +1 -3
  192. package/dist/plugins/anonymous/client.d.mts +1 -3
  193. package/dist/plugins/anonymous/client.mjs +1 -2
  194. package/dist/plugins/anonymous/error-codes.d.mts +1 -3
  195. package/dist/plugins/anonymous/error-codes.mjs +1 -2
  196. package/dist/plugins/anonymous/index.d.mts +0 -2
  197. package/dist/plugins/anonymous/index.mjs +3 -4
  198. package/dist/plugins/anonymous/schema.d.mts +1 -3
  199. package/dist/plugins/anonymous/schema.mjs +1 -2
  200. package/dist/plugins/anonymous/types.d.mts +1 -3
  201. package/dist/plugins/bearer/index.d.mts +1 -3
  202. package/dist/plugins/bearer/index.mjs +1 -2
  203. package/dist/plugins/captcha/constants.d.mts +1 -3
  204. package/dist/plugins/captcha/constants.mjs +1 -2
  205. package/dist/plugins/captcha/error-codes.mjs +1 -2
  206. package/dist/plugins/captcha/index.d.mts +0 -2
  207. package/dist/plugins/captcha/index.mjs +2 -3
  208. package/dist/plugins/captcha/types.d.mts +1 -3
  209. package/dist/plugins/captcha/utils.mjs +1 -2
  210. package/dist/plugins/captcha/verify-handlers/captchafox.mjs +1 -2
  211. package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +1 -2
  212. package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +1 -2
  213. package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +1 -2
  214. package/dist/plugins/captcha/verify-handlers/vercel-botid.mjs +1 -2
  215. package/dist/plugins/custom-session/client.d.mts +1 -3
  216. package/dist/plugins/custom-session/client.mjs +1 -2
  217. package/dist/plugins/custom-session/index.d.mts +1 -3
  218. package/dist/plugins/custom-session/index.mjs +3 -4
  219. package/dist/plugins/device-authorization/client.d.mts +1 -3
  220. package/dist/plugins/device-authorization/client.mjs +1 -2
  221. package/dist/plugins/device-authorization/error-codes.mjs +1 -2
  222. package/dist/plugins/device-authorization/index.d.mts +1 -3
  223. package/dist/plugins/device-authorization/index.mjs +2 -3
  224. package/dist/plugins/device-authorization/routes.d.mts +4 -6
  225. package/dist/plugins/device-authorization/routes.mjs +3 -4
  226. package/dist/plugins/device-authorization/schema.d.mts +0 -2
  227. package/dist/plugins/device-authorization/schema.mjs +1 -2
  228. package/dist/plugins/email-otp/client.d.mts +0 -2
  229. package/dist/plugins/email-otp/client.mjs +1 -2
  230. package/dist/plugins/email-otp/error-codes.d.mts +1 -3
  231. package/dist/plugins/email-otp/error-codes.mjs +1 -2
  232. package/dist/plugins/email-otp/index.d.mts +0 -2
  233. package/dist/plugins/email-otp/index.mjs +4 -5
  234. package/dist/plugins/email-otp/otp-token.mjs +3 -4
  235. package/dist/plugins/email-otp/routes.mjs +6 -7
  236. package/dist/plugins/email-otp/types.d.mts +1 -3
  237. package/dist/plugins/email-otp/utils.mjs +1 -2
  238. package/dist/plugins/generic-oauth/error-codes.mjs +1 -2
  239. package/dist/plugins/generic-oauth/index.d.mts +0 -2
  240. package/dist/plugins/generic-oauth/index.mjs +5 -7
  241. package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -3
  242. package/dist/plugins/generic-oauth/providers/auth0.mjs +1 -2
  243. package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -3
  244. package/dist/plugins/generic-oauth/providers/gumroad.mjs +1 -2
  245. package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -3
  246. package/dist/plugins/generic-oauth/providers/hubspot.mjs +1 -2
  247. package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -3
  248. package/dist/plugins/generic-oauth/providers/keycloak.mjs +1 -2
  249. package/dist/plugins/generic-oauth/providers/line.d.mts +1 -3
  250. package/dist/plugins/generic-oauth/providers/line.mjs +1 -2
  251. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -3
  252. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +1 -2
  253. package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -3
  254. package/dist/plugins/generic-oauth/providers/okta.mjs +1 -2
  255. package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -3
  256. package/dist/plugins/generic-oauth/providers/patreon.mjs +1 -2
  257. package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -3
  258. package/dist/plugins/generic-oauth/providers/slack.mjs +1 -2
  259. package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -3
  260. package/dist/plugins/generic-oauth/providers/yandex.mjs +1 -2
  261. package/dist/plugins/generic-oauth/types.d.mts +1 -3
  262. package/dist/plugins/haveibeenpwned/index.d.mts +1 -3
  263. package/dist/plugins/haveibeenpwned/index.mjs +2 -3
  264. package/dist/plugins/index.d.mts +5 -5
  265. package/dist/plugins/jwt/adapter.mjs +1 -2
  266. package/dist/plugins/jwt/client.d.mts +1 -3
  267. package/dist/plugins/jwt/client.mjs +1 -2
  268. package/dist/plugins/jwt/cookie-cache.mjs +1 -2
  269. package/dist/plugins/jwt/index.d.mts +1 -3
  270. package/dist/plugins/jwt/index.mjs +5 -6
  271. package/dist/plugins/jwt/schema.d.mts +1 -3
  272. package/dist/plugins/jwt/schema.mjs +1 -2
  273. package/dist/plugins/jwt/sign.d.mts +0 -2
  274. package/dist/plugins/jwt/sign.mjs +1 -2
  275. package/dist/plugins/jwt/types.d.mts +1 -3
  276. package/dist/plugins/jwt/utils.d.mts +1 -3
  277. package/dist/plugins/jwt/utils.mjs +2 -3
  278. package/dist/plugins/jwt/verify.d.mts +1 -3
  279. package/dist/plugins/jwt/verify.mjs +1 -2
  280. package/dist/plugins/last-login-method/client.d.mts +1 -3
  281. package/dist/plugins/last-login-method/client.mjs +1 -2
  282. package/dist/plugins/last-login-method/index.d.mts +1 -3
  283. package/dist/plugins/last-login-method/index.mjs +1 -2
  284. package/dist/plugins/magic-link/client.d.mts +1 -3
  285. package/dist/plugins/magic-link/client.mjs +1 -2
  286. package/dist/plugins/magic-link/index.d.mts +1 -3
  287. package/dist/plugins/magic-link/index.mjs +4 -5
  288. package/dist/plugins/magic-link/utils.mjs +1 -2
  289. package/dist/plugins/multi-session/client.d.mts +0 -2
  290. package/dist/plugins/multi-session/client.mjs +1 -2
  291. package/dist/plugins/multi-session/error-codes.d.mts +1 -3
  292. package/dist/plugins/multi-session/error-codes.mjs +1 -2
  293. package/dist/plugins/multi-session/index.d.mts +0 -2
  294. package/dist/plugins/multi-session/index.mjs +3 -4
  295. package/dist/plugins/oauth-popup/client.d.mts +0 -2
  296. package/dist/plugins/oauth-popup/client.mjs +1 -2
  297. package/dist/plugins/oauth-popup/constants.d.mts +1 -3
  298. package/dist/plugins/oauth-popup/constants.mjs +1 -2
  299. package/dist/plugins/oauth-popup/error-codes.d.mts +1 -3
  300. package/dist/plugins/oauth-popup/error-codes.mjs +1 -2
  301. package/dist/plugins/oauth-popup/index.d.mts +0 -2
  302. package/dist/plugins/oauth-popup/index.mjs +5 -6
  303. package/dist/plugins/oauth-popup/types.d.mts +1 -3
  304. package/dist/plugins/oauth-proxy/index.d.mts +1 -3
  305. package/dist/plugins/oauth-proxy/index.mjs +7 -8
  306. package/dist/plugins/oauth-proxy/utils.mjs +1 -2
  307. package/dist/plugins/one-tap/client.d.mts +1 -3
  308. package/dist/plugins/one-tap/client.mjs +1 -2
  309. package/dist/plugins/one-tap/index.d.mts +1 -3
  310. package/dist/plugins/one-tap/index.mjs +7 -8
  311. package/dist/plugins/one-time-token/client.d.mts +0 -2
  312. package/dist/plugins/one-time-token/client.mjs +1 -2
  313. package/dist/plugins/one-time-token/index.d.mts +1 -3
  314. package/dist/plugins/one-time-token/index.mjs +3 -4
  315. package/dist/plugins/one-time-token/utils.mjs +1 -2
  316. package/dist/plugins/open-api/generator.d.mts +0 -2
  317. package/dist/plugins/open-api/generator.mjs +2 -3
  318. package/dist/plugins/open-api/index.d.mts +0 -2
  319. package/dist/plugins/open-api/index.mjs +2 -3
  320. package/dist/plugins/open-api/logo.mjs +1 -2
  321. package/dist/plugins/organization/access/statement.d.mts +1 -3
  322. package/dist/plugins/organization/access/statement.mjs +1 -2
  323. package/dist/plugins/organization/adapter.d.mts +3 -5
  324. package/dist/plugins/organization/adapter.mjs +2 -3
  325. package/dist/plugins/organization/call.mjs +1 -2
  326. package/dist/plugins/organization/client.d.mts +9 -11
  327. package/dist/plugins/organization/client.mjs +2 -3
  328. package/dist/plugins/organization/error-codes.d.mts +1 -3
  329. package/dist/plugins/organization/error-codes.mjs +1 -2
  330. package/dist/plugins/organization/has-permission.d.mts +1 -3
  331. package/dist/plugins/organization/has-permission.mjs +2 -3
  332. package/dist/plugins/organization/index.d.mts +3 -3
  333. package/dist/plugins/organization/organization.d.mts +3 -5
  334. package/dist/plugins/organization/organization.mjs +3 -4
  335. package/dist/plugins/organization/permission.d.mts +1 -3
  336. package/dist/plugins/organization/permission.mjs +1 -2
  337. package/dist/plugins/organization/roles.d.mts +1 -3
  338. package/dist/plugins/organization/roles.mjs +1 -2
  339. package/dist/plugins/organization/routes/crud-access-control.d.mts +2 -4
  340. package/dist/plugins/organization/routes/crud-access-control.mjs +3 -4
  341. package/dist/plugins/organization/routes/crud-invites.d.mts +4 -6
  342. package/dist/plugins/organization/routes/crud-invites.mjs +5 -6
  343. package/dist/plugins/organization/routes/crud-members.d.mts +4 -6
  344. package/dist/plugins/organization/routes/crud-members.mjs +4 -5
  345. package/dist/plugins/organization/routes/crud-org.d.mts +4 -6
  346. package/dist/plugins/organization/routes/crud-org.mjs +8 -9
  347. package/dist/plugins/organization/routes/crud-team.d.mts +4 -6
  348. package/dist/plugins/organization/routes/crud-team.mjs +3 -4
  349. package/dist/plugins/organization/schema.d.mts +0 -2
  350. package/dist/plugins/organization/schema.mjs +1 -2
  351. package/dist/plugins/organization/types.d.mts +1 -3
  352. package/dist/plugins/phone-number/client.d.mts +1 -3
  353. package/dist/plugins/phone-number/client.mjs +1 -2
  354. package/dist/plugins/phone-number/error-codes.d.mts +1 -3
  355. package/dist/plugins/phone-number/error-codes.mjs +1 -2
  356. package/dist/plugins/phone-number/index.d.mts +0 -2
  357. package/dist/plugins/phone-number/index.mjs +1 -2
  358. package/dist/plugins/phone-number/routes.mjs +6 -7
  359. package/dist/plugins/phone-number/schema.d.mts +1 -3
  360. package/dist/plugins/phone-number/schema.mjs +1 -2
  361. package/dist/plugins/phone-number/types.d.mts +2 -4
  362. package/dist/plugins/siwe/client.d.mts +1 -3
  363. package/dist/plugins/siwe/client.mjs +1 -2
  364. package/dist/plugins/siwe/index.d.mts +1 -3
  365. package/dist/plugins/siwe/index.mjs +5 -6
  366. package/dist/plugins/siwe/parse-message.mjs +1 -2
  367. package/dist/plugins/siwe/schema.d.mts +1 -3
  368. package/dist/plugins/siwe/schema.mjs +1 -2
  369. package/dist/plugins/siwe/types.d.mts +0 -2
  370. package/dist/plugins/test-utils/auth-helpers.mjs +1 -2
  371. package/dist/plugins/test-utils/cookie-builder.mjs +1 -2
  372. package/dist/plugins/test-utils/db-helpers.mjs +1 -2
  373. package/dist/plugins/test-utils/factories.mjs +1 -2
  374. package/dist/plugins/test-utils/index.d.mts +0 -2
  375. package/dist/plugins/test-utils/index.mjs +2 -3
  376. package/dist/plugins/test-utils/otp-sink.mjs +1 -2
  377. package/dist/plugins/test-utils/types.d.mts +1 -3
  378. package/dist/plugins/two-factor/backup-codes/index.d.mts +1 -3
  379. package/dist/plugins/two-factor/backup-codes/index.mjs +4 -5
  380. package/dist/plugins/two-factor/client.d.mts +2 -4
  381. package/dist/plugins/two-factor/client.mjs +1 -2
  382. package/dist/plugins/two-factor/constant.mjs +1 -2
  383. package/dist/plugins/two-factor/error-code.d.mts +1 -3
  384. package/dist/plugins/two-factor/error-code.mjs +1 -2
  385. package/dist/plugins/two-factor/index.d.mts +0 -2
  386. package/dist/plugins/two-factor/index.mjs +9 -10
  387. package/dist/plugins/two-factor/otp/index.d.mts +1 -3
  388. package/dist/plugins/two-factor/otp/index.mjs +4 -5
  389. package/dist/plugins/two-factor/schema.d.mts +1 -3
  390. package/dist/plugins/two-factor/schema.mjs +1 -2
  391. package/dist/plugins/two-factor/totp/index.d.mts +1 -3
  392. package/dist/plugins/two-factor/totp/index.mjs +3 -4
  393. package/dist/plugins/two-factor/types.d.mts +1 -3
  394. package/dist/plugins/two-factor/utils.mjs +1 -2
  395. package/dist/plugins/two-factor/verify-two-factor.mjs +5 -6
  396. package/dist/plugins/username/client.d.mts +0 -2
  397. package/dist/plugins/username/client.mjs +1 -2
  398. package/dist/plugins/username/error-codes.d.mts +1 -3
  399. package/dist/plugins/username/error-codes.mjs +1 -2
  400. package/dist/plugins/username/index.d.mts +0 -2
  401. package/dist/plugins/username/index.mjs +4 -5
  402. package/dist/plugins/username/schema.d.mts +1 -3
  403. package/dist/plugins/username/schema.mjs +1 -2
  404. package/dist/state.d.mts +0 -2
  405. package/dist/state.mjs +2 -3
  406. package/dist/test-utils/headers.d.mts +1 -3
  407. package/dist/test-utils/headers.mjs +1 -2
  408. package/dist/test-utils/http-test-instance.d.mts +0 -2
  409. package/dist/test-utils/http-test-instance.mjs +1 -2
  410. package/dist/test-utils/index.d.mts +1 -1
  411. package/dist/test-utils/index.mjs +1 -1
  412. package/dist/test-utils/test-instance.d.mts +4 -6
  413. package/dist/test-utils/test-instance.mjs +35 -22
  414. package/dist/types/api.d.mts +1 -3
  415. package/dist/types/auth.d.mts +2 -4
  416. package/dist/types/helper.d.mts +1 -3
  417. package/dist/types/index.d.mts +2 -2
  418. package/dist/types/models.d.mts +0 -2
  419. package/dist/types/plugins.d.mts +0 -2
  420. package/dist/utils/constants.mjs +1 -2
  421. package/dist/utils/date.mjs +1 -2
  422. package/dist/utils/hashing.mjs +1 -2
  423. package/dist/utils/index.d.mts +1 -1
  424. package/dist/utils/is-atom.mjs +1 -2
  425. package/dist/utils/is-promise.mjs +1 -2
  426. package/dist/utils/middleware-response.mjs +1 -2
  427. package/dist/utils/password.mjs +1 -2
  428. package/dist/utils/plugin-helper.mjs +1 -2
  429. package/dist/utils/request.mjs +1 -2
  430. package/dist/utils/shim.mjs +1 -2
  431. package/dist/utils/time.d.mts +0 -2
  432. package/dist/utils/time.mjs +1 -2
  433. package/dist/utils/url.d.mts +1 -3
  434. package/dist/utils/url.mjs +1 -2
  435. package/dist/utils/validate-user-info.mjs +1 -2
  436. package/dist/utils/wildcard.mjs +1 -2
  437. package/dist/version.mjs +1 -2
  438. package/package.json +10 -10
  439. package/dist/utils/boolean.mjs +0 -6
@@ -1,4 +1,3 @@
1
- //#region src/plugins/phone-number/schema.d.ts
2
1
  export declare const schema: {
3
2
  user: {
4
3
  fields: {
@@ -17,5 +16,4 @@ export declare const schema: {
17
16
  };
18
17
  };
19
18
  };
20
- };
21
- //#endregion
19
+ };
@@ -1,4 +1,4 @@
1
- //#region src/plugins/phone-number/schema.ts
1
+ // src/plugins/phone-number/schema.ts
2
2
  const schema = { user: { fields: {
3
3
  phoneNumber: {
4
4
  type: "string",
@@ -14,5 +14,4 @@ const schema = { user: { fields: {
14
14
  input: false
15
15
  }
16
16
  } } };
17
- //#endregion
18
17
  export { schema };
@@ -1,9 +1,8 @@
1
1
  import { User } from "../../types/models.mjs";
2
- import { InferOptionSchema } from "../../types/plugins.mjs";
3
2
  import "../../types/index.mjs";
3
+ import { InferOptionSchema } from "../../types/plugins.mjs";
4
4
  import { schema } from "./schema.mjs";
5
5
  import { Awaitable, GenericEndpointContext } from "@better-auth/core";
6
- //#region src/plugins/phone-number/types.d.ts
7
6
  export interface UserWithPhoneNumber extends User {
8
7
  phoneNumber: string;
9
8
  phoneNumberVerified: boolean;
@@ -111,5 +110,4 @@ export interface PhoneNumberOptions {
111
110
  * @default 3
112
111
  */
113
112
  allowedAttempts?: number | undefined;
114
- }
115
- //#endregion
113
+ }
@@ -1,5 +1,4 @@
1
1
  import { siwe } from "./index.mjs";
2
- //#region src/plugins/siwe/client.d.ts
3
2
  export declare const siweClient: () => {
4
3
  id: "siwe";
5
4
  version: string;
@@ -8,5 +7,4 @@ export declare const siweClient: () => {
8
7
  "/siwe/nonce": "POST";
9
8
  "/siwe/get-nonce": "POST";
10
9
  };
11
- };
12
- //#endregion
10
+ };
@@ -1,5 +1,5 @@
1
1
  import { PACKAGE_VERSION } from "../../version.mjs";
2
- //#region src/plugins/siwe/client.ts
2
+ // src/plugins/siwe/client.ts
3
3
  const siweClient = () => {
4
4
  return {
5
5
  id: "siwe",
@@ -11,5 +11,4 @@ const siweClient = () => {
11
11
  }
12
12
  };
13
13
  };
14
- //#endregion
15
14
  export { siweClient };
@@ -3,7 +3,6 @@ import "../../types/index.mjs";
3
3
  import { WalletAddressSchema, schema } from "./schema.mjs";
4
4
  import { ENSLookupArgs, ENSLookupResult, SIWEVerifyMessageArgs } from "./types.mjs";
5
5
  import * as z from "zod";
6
- //#region src/plugins/siwe/index.d.ts
7
6
  declare module "@better-auth/core" {
8
7
  interface BetterAuthPluginRegistry<AuthOptions, Options> {
9
8
  siwe: {
@@ -56,5 +55,4 @@ export declare const siwe: (options: SIWEPluginOptions) => {
56
55
  }>;
57
56
  };
58
57
  options: SIWEPluginOptions;
59
- };
60
- //#endregion
58
+ };
@@ -1,16 +1,16 @@
1
- import { isAPIError } from "../../utils/is-api-error.mjs";
2
- import { mergeSchema } from "../../db/schema.mjs";
3
- import { setSessionCookie } from "../../cookies/index.mjs";
4
1
  import { APIError } from "../../api/index.mjs";
5
- import { PACKAGE_VERSION } from "../../version.mjs";
2
+ import { setSessionCookie } from "../../cookies/index.mjs";
3
+ import { mergeSchema } from "../../db/schema.mjs";
6
4
  import { toChecksumAddress } from "../../utils/hashing.mjs";
5
+ import { isAPIError } from "../../utils/is-api-error.mjs";
6
+ import { PACKAGE_VERSION } from "../../version.mjs";
7
7
  import { normalizeSiweDomain, parseSiweMessage } from "./parse-message.mjs";
8
8
  import { schema } from "./schema.mjs";
9
9
  import { getCurrentAdapter, runWithTransaction } from "@better-auth/core/context";
10
10
  import { createAuthEndpoint } from "@better-auth/core/api";
11
11
  import * as z from "zod";
12
12
  import { createPlaceholderEmail } from "@better-auth/core/utils/email";
13
- //#region src/plugins/siwe/index.ts
13
+ // src/plugins/siwe/index.ts
14
14
  const signedWalletAddressSchema = z.string().regex(/^0x[a-fA-F0-9]{40}$/).length(42);
15
15
  const SIWE_VERIFICATION_IDENTIFIER_PREFIX = "siwe:";
16
16
  const SIWE_NONCE_MAX_LENGTH = 250;
@@ -285,5 +285,4 @@ const siwe = (options) => {
285
285
  options
286
286
  };
287
287
  };
288
- //#endregion
289
288
  export { siwe };
@@ -1,4 +1,4 @@
1
- //#region src/plugins/siwe/parse-message.ts
1
+ // src/plugins/siwe/parse-message.ts
2
2
  const HEADER_REGEX = /^(?:([a-zA-Z][a-zA-Z0-9+.-]*):\/\/)?(\S+) wants you to sign in with your Ethereum account:$/;
3
3
  const ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/;
4
4
  const FIELD_REGEX = /^([A-Za-z ]+): (.*)$/;
@@ -54,5 +54,4 @@ function normalizeSiweDomain(domain) {
54
54
  const pathStart = withoutScheme.indexOf("/");
55
55
  return pathStart === -1 ? withoutScheme : withoutScheme.slice(0, pathStart);
56
56
  }
57
- //#endregion
58
57
  export { normalizeSiweDomain, parseSiweMessage };
@@ -1,4 +1,3 @@
1
- //#region src/plugins/siwe/schema.d.ts
2
1
  export declare const schema: {
3
2
  walletAddress: {
4
3
  fields: {
@@ -30,5 +29,4 @@ export declare const schema: {
30
29
  };
31
30
  };
32
31
  };
33
- export type WalletAddressSchema = typeof schema;
34
- //#endregion
32
+ export type WalletAddressSchema = typeof schema;
@@ -1,4 +1,4 @@
1
- //#region src/plugins/siwe/schema.ts
1
+ // src/plugins/siwe/schema.ts
2
2
  const schema = { walletAddress: { fields: {
3
3
  userId: {
4
4
  type: "string",
@@ -26,5 +26,4 @@ const schema = { walletAddress: { fields: {
26
26
  required: true
27
27
  }
28
28
  } } };
29
- //#endregion
30
29
  export { schema };
@@ -1,4 +1,3 @@
1
- //#region src/plugins/siwe/types.d.ts
2
1
  interface CacaoHeader {
3
2
  t: "caip122";
4
3
  }
@@ -39,5 +38,4 @@ export interface ENSLookupResult {
39
38
  name: string;
40
39
  avatar: string;
41
40
  }
42
- //#endregion
43
41
  export {};
@@ -1,6 +1,6 @@
1
1
  import { createCookieHeaders, createTestCookie } from "./cookie-builder.mjs";
2
2
  import { sessionSchema } from "@better-auth/core/db";
3
- //#region src/plugins/test-utils/auth-helpers.ts
3
+ // src/plugins/test-utils/auth-helpers.ts
4
4
  function createSession(ctx, opts) {
5
5
  const additionalFields = Object.fromEntries(Object.entries(opts.session ?? {}).filter(([key]) => !Object.hasOwn(sessionSchema.shape, key)));
6
6
  return ctx.internalAdapter.createSession(opts.userId, false, additionalFields, true);
@@ -31,5 +31,4 @@ function createGetCookies(ctx) {
31
31
  return createTestCookie(ctx, session.token, opts.domain);
32
32
  };
33
33
  }
34
- //#endregion
35
34
  export { createGetAuthHeaders, createGetCookies, createLogin };
@@ -1,5 +1,5 @@
1
1
  import { makeSignature } from "../../crypto/index.mjs";
2
- //#region src/plugins/test-utils/cookie-builder.ts
2
+ // src/plugins/test-utils/cookie-builder.ts
3
3
  /**
4
4
  * Signs a cookie value using HMAC-SHA256
5
5
  */
@@ -51,5 +51,4 @@ function normalizeSameSite(sameSite) {
51
51
  }
52
52
  return "Lax";
53
53
  }
54
- //#endregion
55
54
  export { createCookieHeaders, createTestCookie };
@@ -1,5 +1,5 @@
1
1
  import { generateRandomString } from "../../crypto/random.mjs";
2
- //#region src/plugins/test-utils/db-helpers.ts
2
+ // src/plugins/test-utils/db-helpers.ts
3
3
  function createSaveUser(ctx) {
4
4
  return async (user) => {
5
5
  return ctx.internalAdapter.createUser(user, { method: "test" });
@@ -61,5 +61,4 @@ function createAddMember(ctx) {
61
61
  });
62
62
  };
63
63
  }
64
- //#endregion
65
64
  export { createAddMember, createDeleteOrganization, createDeleteUser, createSaveOrganization, createSaveUser };
@@ -1,5 +1,5 @@
1
1
  import { generateRandomString } from "../../crypto/random.mjs";
2
- //#region src/plugins/test-utils/factories.ts
2
+ // src/plugins/test-utils/factories.ts
3
3
  function createUserFactory(ctx) {
4
4
  return (overrides = {}) => {
5
5
  const generatedId = ctx.generateId({ model: "user" });
@@ -34,5 +34,4 @@ function createOrganizationFactory(ctx) {
34
34
  };
35
35
  };
36
36
  }
37
- //#endregion
38
37
  export { createOrganizationFactory, createUserFactory };
@@ -1,5 +1,4 @@
1
1
  import { LoginResult, TestAuthOptions, TestCookie, TestHelpers, TestUtilsOptions } from "./types.mjs";
2
- //#region src/plugins/test-utils/index.d.ts
3
2
  declare module "@better-auth/core" {
4
3
  interface BetterAuthPluginRegistry<AuthOptions, Options> {
5
4
  "test-utils": {
@@ -67,5 +66,4 @@ export declare const testUtils: (options?: TestUtilsOptions) => {
67
66
  };
68
67
  options: TestUtilsOptions;
69
68
  };
70
- //#endregion
71
69
  export type { LoginResult, TestAuthOptions, TestCookie, TestHelpers, TestUtilsOptions };
@@ -1,9 +1,9 @@
1
- import { PACKAGE_VERSION } from "../../version.mjs";
2
1
  import { createGetAuthHeaders, createGetCookies, createLogin } from "./auth-helpers.mjs";
3
2
  import { createAddMember, createDeleteOrganization, createDeleteUser, createSaveOrganization, createSaveUser } from "./db-helpers.mjs";
4
3
  import { createOrganizationFactory, createUserFactory } from "./factories.mjs";
5
4
  import { createOTPStore } from "./otp-sink.mjs";
6
- //#region src/plugins/test-utils/index.ts
5
+ import { PACKAGE_VERSION } from "../../version.mjs";
6
+ // src/plugins/test-utils/index.ts
7
7
  /**
8
8
  * Test utilities plugin for Better Auth.
9
9
  *
@@ -93,5 +93,4 @@ const testUtils = (options = {}) => {
93
93
  options
94
94
  };
95
95
  };
96
- //#endregion
97
96
  export { testUtils };
@@ -1,4 +1,4 @@
1
- //#region src/plugins/test-utils/otp-sink.ts
1
+ // src/plugins/test-utils/otp-sink.ts
2
2
  /**
3
3
  * Creates an instance-scoped OTP store for capturing OTPs during testing.
4
4
  * Each auth instance gets its own store to avoid cross-contamination.
@@ -17,5 +17,4 @@ function createOTPStore() {
17
17
  }
18
18
  };
19
19
  }
20
- //#endregion
21
20
  export { createOTPStore };
@@ -1,6 +1,5 @@
1
1
  import { Session, User } from "../../types/models.mjs";
2
2
  import "../../types/index.mjs";
3
- //#region src/plugins/test-utils/types.d.ts
4
3
  export interface TestUtilsOptions {
5
4
  /** Capture OTPs in memory when created (doesn't prevent sending) */
6
5
  captureOTP?: boolean;
@@ -47,5 +46,4 @@ export interface TestHelpers {
47
46
  }): Promise<TestCookie[]>;
48
47
  getOTP?(identifier: string): string | undefined;
49
48
  clearOTPs?(): void;
50
- }
51
- //#endregion
49
+ }
@@ -1,7 +1,6 @@
1
1
  import { SecretConfig } from "../../../crypto/index.mjs";
2
2
  import { UserWithTwoFactor } from "../types.mjs";
3
3
  import * as z from "zod";
4
- //#region src/plugins/two-factor/backup-codes/index.d.ts
5
4
  export interface BackupCodeOptions {
6
5
  /**
7
6
  * The amount of backup codes to generate
@@ -284,5 +283,4 @@ export declare const backupCode2fa: (opts: BackupCodeOptions) => {
284
283
  backupCodes: string[];
285
284
  }>;
286
285
  };
287
- };
288
- //#endregion
286
+ };
@@ -1,7 +1,7 @@
1
- import { parseUserOutput } from "../../../db/schema.mjs";
2
- import { generateRandomString } from "../../../crypto/random.mjs";
3
- import { symmetricDecrypt, symmetricEncrypt } from "../../../crypto/index.mjs";
4
1
  import { sessionMiddleware } from "../../../api/routes/session.mjs";
2
+ import { symmetricDecrypt, symmetricEncrypt } from "../../../crypto/index.mjs";
3
+ import { generateRandomString } from "../../../crypto/random.mjs";
4
+ import { parseUserOutput } from "../../../db/schema.mjs";
5
5
  import { shouldRequirePassword } from "../../../utils/password.mjs";
6
6
  import { PACKAGE_VERSION } from "../../../version.mjs";
7
7
  import { TWO_FACTOR_ERROR_CODES } from "../error-code.mjs";
@@ -10,7 +10,7 @@ import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
10
10
  import { safeJSONParse } from "@better-auth/core/utils/json";
11
11
  import { createAuthEndpoint } from "@better-auth/core/api";
12
12
  import * as z from "zod";
13
- //#region src/plugins/two-factor/backup-codes/index.ts
13
+ // src/plugins/two-factor/backup-codes/index.ts
14
14
  function generateBackupCodesFn(options) {
15
15
  return Array.from({ length: options?.amount ?? 10 }).fill(null).map(() => generateRandomString(options?.length ?? 10, "a-z", "0-9", "A-Z")).map((code) => `${code.slice(0, 5)}-${code.slice(5)}`);
16
16
  }
@@ -343,5 +343,4 @@ const backupCode2fa = (opts) => {
343
343
  }
344
344
  };
345
345
  };
346
- //#endregion
347
346
  export { backupCode2fa, encodeBackupCodes, generateBackupCodes, getBackupCodes, verifyBackupCode };
@@ -1,10 +1,9 @@
1
+ import { twoFactor } from "./index.mjs";
1
2
  import { BackupCodeOptions, backupCode2fa, encodeBackupCodes, generateBackupCodes, getBackupCodes, verifyBackupCode } from "./backup-codes/index.mjs";
2
3
  import { OTPOptions, otp2fa } from "./otp/index.mjs";
3
4
  import { TOTPOptions, totp2fa } from "./totp/index.mjs";
4
- import { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor } from "./types.mjs";
5
5
  import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
6
- import { twoFactor } from "./index.mjs";
7
- //#region src/plugins/two-factor/client.d.ts
6
+ import { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor } from "./types.mjs";
8
7
  export declare const twoFactorClient: (options?: {
9
8
  /**
10
9
  * the page to redirect if a user needs to verify
@@ -69,5 +68,4 @@ export declare const twoFactorClient: (options?: {
69
68
  INVALID_TWO_FACTOR_COOKIE: import("@better-auth/core/utils/error-codes").RawError<"INVALID_TWO_FACTOR_COOKIE">;
70
69
  };
71
70
  };
72
- //#endregion
73
71
  export { type BackupCodeOptions, type OTPOptions, type TOTPOptions, TWO_FACTOR_ERROR_CODES, type TwoFactorOptions, type TwoFactorProvider, type TwoFactorTable, type UserWithTwoFactor, type backupCode2fa, type encodeBackupCodes, type generateBackupCodes, type getBackupCodes, type otp2fa, type totp2fa, type verifyBackupCode };
@@ -1,7 +1,7 @@
1
1
  import { PACKAGE_VERSION } from "../../version.mjs";
2
2
  import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
3
3
  import { isSafeUrlScheme } from "@better-auth/core/utils/url";
4
- //#region src/plugins/two-factor/client.ts
4
+ // src/plugins/two-factor/client.ts
5
5
  const twoFactorClient = (options) => {
6
6
  return {
7
7
  id: "two-factor",
@@ -37,5 +37,4 @@ const twoFactorClient = (options) => {
37
37
  $ERROR_CODES: TWO_FACTOR_ERROR_CODES
38
38
  };
39
39
  };
40
- //#endregion
41
40
  export { TWO_FACTOR_ERROR_CODES, twoFactorClient };
@@ -1,6 +1,5 @@
1
- //#region src/plugins/two-factor/constant.ts
1
+ // src/plugins/two-factor/constant.ts
2
2
  const TWO_FACTOR_COOKIE_NAME = "two_factor";
3
3
  const TRUST_DEVICE_COOKIE_NAME = "trust_device";
4
4
  const TRUST_DEVICE_COOKIE_MAX_AGE = 2592e3;
5
- //#endregion
6
5
  export { TRUST_DEVICE_COOKIE_MAX_AGE, TRUST_DEVICE_COOKIE_NAME, TWO_FACTOR_COOKIE_NAME };
@@ -1,4 +1,3 @@
1
- //#region src/plugins/two-factor/error-code.d.ts
2
1
  export declare const TWO_FACTOR_ERROR_CODES: {
3
2
  OTP_NOT_ENABLED: import("@better-auth/core/utils/error-codes").RawError<"OTP_NOT_ENABLED">;
4
3
  OTP_NOT_CONFIGURED: import("@better-auth/core/utils/error-codes").RawError<"OTP_NOT_CONFIGURED">;
@@ -13,5 +12,4 @@ export declare const TWO_FACTOR_ERROR_CODES: {
13
12
  TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("@better-auth/core/utils/error-codes").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
14
13
  ACCOUNT_TEMPORARILY_LOCKED: import("@better-auth/core/utils/error-codes").RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
15
14
  INVALID_TWO_FACTOR_COOKIE: import("@better-auth/core/utils/error-codes").RawError<"INVALID_TWO_FACTOR_COOKIE">;
16
- };
17
- //#endregion
15
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineErrorCodes } from "@better-auth/core/utils/error-codes";
2
- //#region src/plugins/two-factor/error-code.ts
2
+ // src/plugins/two-factor/error-code.ts
3
3
  const TWO_FACTOR_ERROR_CODES = defineErrorCodes({
4
4
  OTP_NOT_ENABLED: "OTP not enabled",
5
5
  OTP_NOT_CONFIGURED: "OTP is not available",
@@ -15,5 +15,4 @@ const TWO_FACTOR_ERROR_CODES = defineErrorCodes({
15
15
  ACCOUNT_TEMPORARILY_LOCKED: "Too many failed verification attempts. Your account is temporarily locked. Please try again later.",
16
16
  INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie"
17
17
  });
18
- //#endregion
19
18
  export { TWO_FACTOR_ERROR_CODES };
@@ -6,7 +6,6 @@ import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
6
6
  import { twoFactorClient } from "./client.mjs";
7
7
  import { GenericEndpointContext } from "@better-auth/core";
8
8
  import * as z from "zod";
9
- //#region src/plugins/two-factor/index.d.ts
10
9
  declare module "@better-auth/core" {
11
10
  interface BetterAuthPluginRegistry<AuthOptions, Options> {
12
11
  "two-factor": {
@@ -719,5 +718,4 @@ export declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
719
718
  INVALID_TWO_FACTOR_COOKIE: import("@better-auth/core/utils/error-codes").RawError<"INVALID_TWO_FACTOR_COOKIE">;
720
719
  };
721
720
  };
722
- //#endregion
723
721
  export { type BackupCodeOptions, type OTPOptions, type TOTPOptions, TWO_FACTOR_ERROR_CODES, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, type backupCode2fa, type encodeBackupCodes, type generateBackupCodes, type getBackupCodes, type otp2fa, type totp2fa, twoFactorClient, type verifyBackupCode };
@@ -1,24 +1,24 @@
1
- import { mergeSchema } from "../../db/schema.mjs";
2
- import { generateRandomString } from "../../crypto/random.mjs";
3
- import { symmetricEncrypt } from "../../crypto/index.mjs";
4
- import { deleteSessionCookie, expireCookie, setSessionCookie } from "../../cookies/index.mjs";
5
1
  import { getAuthoritativeSessionFromCtx, sensitiveSessionMiddleware, sessionMiddleware } from "../../api/routes/session.mjs";
6
- import { shouldRequirePassword, validatePassword } from "../../utils/password.mjs";
7
2
  import { isSessionOutsideStore } from "../../api/state/session-source.mjs";
3
+ import { deleteSessionCookie, expireCookie, setSessionCookie } from "../../cookies/index.mjs";
4
+ import { symmetricEncrypt } from "../../crypto/index.mjs";
5
+ import { generateRandomString } from "../../crypto/random.mjs";
6
+ import { mergeSchema } from "../../db/schema.mjs";
7
+ import { shouldRequirePassword, validatePassword } from "../../utils/password.mjs";
8
8
  import { PACKAGE_VERSION } from "../../version.mjs";
9
- import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
10
- import { twoFactorClient } from "./client.mjs";
11
- import { TRUST_DEVICE_COOKIE_NAME, TWO_FACTOR_COOKIE_NAME } from "./constant.mjs";
12
9
  import { backupCode2fa, generateBackupCodes } from "./backup-codes/index.mjs";
10
+ import { TRUST_DEVICE_COOKIE_NAME, TWO_FACTOR_COOKIE_NAME } from "./constant.mjs";
11
+ import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
13
12
  import { otp2fa } from "./otp/index.mjs";
14
13
  import { schema } from "./schema.mjs";
15
14
  import { totp2fa } from "./totp/index.mjs";
15
+ import { twoFactorClient } from "./client.mjs";
16
16
  import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
17
17
  import { createAuthEndpoint, createAuthMiddleware } from "@better-auth/core/api";
18
18
  import * as z from "zod";
19
19
  import { createHMAC } from "@better-auth/utils/hmac";
20
20
  import { createOTP } from "@better-auth/utils/otp";
21
- //#region src/plugins/two-factor/index.ts
21
+ // src/plugins/two-factor/index.ts
22
22
  const signInPaths = /* @__PURE__ */ new Set([
23
23
  "/sign-in/email",
24
24
  "/sign-in/username",
@@ -396,5 +396,4 @@ const twoFactor = (options) => {
396
396
  $ERROR_CODES: TWO_FACTOR_ERROR_CODES
397
397
  };
398
398
  };
399
- //#endregion
400
399
  export { TWO_FACTOR_ERROR_CODES, twoFactor, twoFactorClient };
@@ -1,7 +1,6 @@
1
1
  import { UserWithTwoFactor } from "../types.mjs";
2
2
  import { Awaitable, GenericEndpointContext } from "@better-auth/core";
3
3
  import * as z from "zod";
4
- //#region src/plugins/two-factor/otp/index.d.ts
5
4
  export interface OTPOptions {
6
5
  /**
7
6
  * How long the opt will be valid for in
@@ -209,5 +208,4 @@ export declare const otp2fa: (options?: OTPOptions | undefined) => {
209
208
  } & Record<string, any>;
210
209
  }>;
211
210
  };
212
- };
213
- //#endregion
211
+ };
@@ -1,16 +1,16 @@
1
- import { parseUserOutput } from "../../../db/schema.mjs";
1
+ import { setSessionCookie } from "../../../cookies/index.mjs";
2
2
  import { constantTimeEqual } from "../../../crypto/buffer.mjs";
3
3
  import { generateRandomString } from "../../../crypto/random.mjs";
4
4
  import { symmetricDecrypt, symmetricEncrypt } from "../../../crypto/index.mjs";
5
- import { setSessionCookie } from "../../../cookies/index.mjs";
5
+ import { parseUserOutput } from "../../../db/schema.mjs";
6
6
  import { PACKAGE_VERSION } from "../../../version.mjs";
7
7
  import { TWO_FACTOR_ERROR_CODES } from "../error-code.mjs";
8
- import { assertTwoFactorNotLocked, recordTwoFactorFailure, resetTwoFactorFailures, verifyTwoFactor } from "../verify-two-factor.mjs";
9
8
  import { defaultKeyHasher } from "../utils.mjs";
9
+ import { assertTwoFactorNotLocked, recordTwoFactorFailure, resetTwoFactorFailures, verifyTwoFactor } from "../verify-two-factor.mjs";
10
10
  import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
11
11
  import { createAuthEndpoint } from "@better-auth/core/api";
12
12
  import * as z from "zod";
13
- //#region src/plugins/two-factor/otp/index.ts
13
+ // src/plugins/two-factor/otp/index.ts
14
14
  const verifyOTPBodySchema = z.object({
15
15
  code: z.string().meta({ description: "The otp code to verify. Eg: \"012345\"" }),
16
16
  /**
@@ -253,5 +253,4 @@ const otp2fa = (options) => {
253
253
  }
254
254
  };
255
255
  };
256
- //#endregion
257
256
  export { otp2fa };
@@ -1,4 +1,3 @@
1
- //#region src/plugins/two-factor/schema.d.ts
2
1
  export declare const schema: {
3
2
  user: {
4
3
  fields: {
@@ -54,5 +53,4 @@ export declare const schema: {
54
53
  };
55
54
  };
56
55
  };
57
- };
58
- //#endregion
56
+ };
@@ -1,4 +1,4 @@
1
- //#region src/plugins/two-factor/schema.ts
1
+ // src/plugins/two-factor/schema.ts
2
2
  const schema = {
3
3
  user: { fields: { twoFactorEnabled: {
4
4
  type: "boolean",
@@ -49,5 +49,4 @@ const schema = {
49
49
  }
50
50
  } }
51
51
  };
52
- //#endregion
53
52
  export { schema };
@@ -1,7 +1,6 @@
1
1
  import { BackupCodeOptions } from "../backup-codes/index.mjs";
2
2
  import { UserWithTwoFactor } from "../types.mjs";
3
3
  import * as z from "zod";
4
- //#region src/plugins/two-factor/totp/index.d.ts
5
4
  export type TOTPOptions = {
6
5
  /**
7
6
  * Issuer
@@ -212,5 +211,4 @@ export declare const totp2fa: (options?: TOTPOptions | undefined) => {
212
211
  } & Record<string, any>;
213
212
  }>;
214
213
  };
215
- };
216
- //#endregion
214
+ };
@@ -1,6 +1,6 @@
1
- import { symmetricDecrypt } from "../../../crypto/index.mjs";
2
- import { setSessionCookie } from "../../../cookies/index.mjs";
3
1
  import { sessionMiddleware } from "../../../api/routes/session.mjs";
2
+ import { setSessionCookie } from "../../../cookies/index.mjs";
3
+ import { symmetricDecrypt } from "../../../crypto/index.mjs";
4
4
  import { shouldRequirePassword } from "../../../utils/password.mjs";
5
5
  import { PACKAGE_VERSION } from "../../../version.mjs";
6
6
  import { TWO_FACTOR_ERROR_CODES } from "../error-code.mjs";
@@ -10,7 +10,7 @@ import { createAuthEndpoint } from "@better-auth/core/api";
10
10
  import * as z from "zod";
11
11
  import { createOTP } from "@better-auth/utils/otp";
12
12
  import { base32 } from "@better-auth/utils/base32";
13
- //#region src/plugins/two-factor/totp/index.ts
13
+ // src/plugins/two-factor/totp/index.ts
14
14
  const BASE32_PREFIX = "base32:";
15
15
  /**
16
16
  * Secrets imported from other providers are stored as `base32:<secret>`.
@@ -242,5 +242,4 @@ const totp2fa = (options) => {
242
242
  }
243
243
  };
244
244
  };
245
- //#endregion
246
245
  export { totp2fa };
@@ -6,7 +6,6 @@ import { OTPOptions } from "./otp/index.mjs";
6
6
  import { schema } from "./schema.mjs";
7
7
  import { TOTPOptions } from "./totp/index.mjs";
8
8
  import { BetterAuthPlugin, LiteralString } from "@better-auth/core";
9
- //#region src/plugins/two-factor/types.d.ts
10
9
  export interface TwoFactorOptions {
11
10
  /**
12
11
  * Application Name
@@ -106,5 +105,4 @@ export interface TwoFactorTable {
106
105
  verified: boolean;
107
106
  failedVerificationCount?: number;
108
107
  lockedUntil?: Date | null;
109
- }
110
- //#endregion
108
+ }
@@ -1,9 +1,8 @@
1
1
  import { base64Url } from "@better-auth/utils/base64";
2
2
  import { createHash } from "@better-auth/utils/hash";
3
- //#region src/plugins/two-factor/utils.ts
3
+ // src/plugins/two-factor/utils.ts
4
4
  const defaultKeyHasher = async (token) => {
5
5
  const hash = await createHash("SHA-256").digest(new TextEncoder().encode(token));
6
6
  return base64Url.encode(new Uint8Array(hash), { padding: false });
7
7
  };
8
- //#endregion
9
8
  export { defaultKeyHasher };
@@ -1,13 +1,13 @@
1
- import { parseUserOutput } from "../../db/schema.mjs";
2
- import { generateRandomString } from "../../crypto/random.mjs";
3
- import { expireCookie, setSessionCookie } from "../../cookies/index.mjs";
4
1
  import { getAuthoritativeSessionFromCtx } from "../../api/routes/session.mjs";
5
2
  import { isSessionOutsideStore } from "../../api/state/session-source.mjs";
6
- import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
3
+ import { expireCookie, setSessionCookie } from "../../cookies/index.mjs";
4
+ import { generateRandomString } from "../../crypto/random.mjs";
5
+ import { parseUserOutput } from "../../db/schema.mjs";
7
6
  import { TRUST_DEVICE_COOKIE_NAME, TWO_FACTOR_COOKIE_NAME } from "./constant.mjs";
7
+ import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
8
8
  import { APIError } from "@better-auth/core/error";
9
9
  import { createHMAC } from "@better-auth/utils/hmac";
10
- //#region src/plugins/two-factor/verify-two-factor.ts
10
+ // src/plugins/two-factor/verify-two-factor.ts
11
11
  async function verifyTwoFactor(ctx) {
12
12
  const invalid = (errorKey) => {
13
13
  throw APIError.from("UNAUTHORIZED", TWO_FACTOR_ERROR_CODES[errorKey]);
@@ -203,5 +203,4 @@ async function resetTwoFactorFailures(ctx, twoFactorTable, twoFactor) {
203
203
  }
204
204
  });
205
205
  }
206
- //#endregion
207
206
  export { assertTwoFactorNotLocked, recordTwoFactorFailure, resetTwoFactorFailures, verifyTwoFactor };
@@ -1,6 +1,5 @@
1
1
  import { USERNAME_ERROR_CODES } from "./error-codes.mjs";
2
2
  import { UsernamePlugin, UsernamePluginWithoutDisplayUsername } from "./index.mjs";
3
- //#region src/plugins/username/client.d.ts
4
3
  export type UsernameClientOptions = {
5
4
  /**
6
5
  * Whether the server has the `displayUsername` field enabled.
@@ -32,5 +31,4 @@ export declare const usernameClient: <O extends UsernameClientOptions = Username
32
31
  USERNAME_IS_IMMUTABLE: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_IS_IMMUTABLE">;
33
32
  };
34
33
  };
35
- //#endregion
36
34
  export { USERNAME_ERROR_CODES };
@@ -1,6 +1,6 @@
1
1
  import { PACKAGE_VERSION } from "../../version.mjs";
2
2
  import { USERNAME_ERROR_CODES } from "./error-codes.mjs";
3
- //#region src/plugins/username/client.ts
3
+ // src/plugins/username/client.ts
4
4
  const usernameClient = (options) => {
5
5
  return {
6
6
  id: "username",
@@ -13,5 +13,4 @@ const usernameClient = (options) => {
13
13
  $ERROR_CODES: USERNAME_ERROR_CODES
14
14
  };
15
15
  };
16
- //#endregion
17
16
  export { USERNAME_ERROR_CODES, usernameClient };