@entro314labs/entro-auth 0.0.0-stage → 1.8.0-beta.11

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 (476) hide show
  1. package/LICENSE.md +20 -0
  2. package/README.md +31 -2
  3. package/dist/_virtual/_rolldown/runtime.mjs +26 -0
  4. package/dist/adapters/drizzle-adapter/index.d.mts +1 -0
  5. package/dist/adapters/drizzle-adapter/index.mjs +2 -0
  6. package/dist/adapters/index.d.mts +19 -0
  7. package/dist/adapters/index.mjs +8 -0
  8. package/dist/adapters/kysely-adapter/index.d.mts +1 -0
  9. package/dist/adapters/kysely-adapter/index.mjs +2 -0
  10. package/dist/adapters/memory-adapter/index.d.mts +1 -0
  11. package/dist/adapters/memory-adapter/index.mjs +2 -0
  12. package/dist/api/dispatch.d.mts +31 -0
  13. package/dist/api/dispatch.mjs +318 -0
  14. package/dist/api/index.d.mts +4117 -0
  15. package/dist/api/index.mjs +227 -0
  16. package/dist/api/middlewares/authorization.d.mts +70 -0
  17. package/dist/api/middlewares/authorization.mjs +78 -0
  18. package/dist/api/middlewares/index.d.mts +3 -0
  19. package/dist/api/middlewares/origin-check.d.mts +12 -0
  20. package/dist/api/middlewares/origin-check.mjs +154 -0
  21. package/dist/api/rate-limiter/index.mjs +322 -0
  22. package/dist/api/routes/account.d.mts +407 -0
  23. package/dist/api/routes/account.mjs +642 -0
  24. package/dist/api/routes/callback.d.mts +27 -0
  25. package/dist/api/routes/callback.mjs +184 -0
  26. package/dist/api/routes/email-verification.d.mts +153 -0
  27. package/dist/api/routes/email-verification.mjs +315 -0
  28. package/dist/api/routes/error.d.mts +22 -0
  29. package/dist/api/routes/error.mjs +386 -0
  30. package/dist/api/routes/id-token-nonce.d.mts +83 -0
  31. package/dist/api/routes/id-token-nonce.mjs +79 -0
  32. package/dist/api/routes/index.d.mts +14 -0
  33. package/dist/api/routes/ok.d.mts +30 -0
  34. package/dist/api/routes/ok.mjs +26 -0
  35. package/dist/api/routes/password.d.mts +177 -0
  36. package/dist/api/routes/password.mjs +198 -0
  37. package/dist/api/routes/session.d.mts +446 -0
  38. package/dist/api/routes/session.mjs +488 -0
  39. package/dist/api/routes/sign-in.d.mts +182 -0
  40. package/dist/api/routes/sign-in.mjs +374 -0
  41. package/dist/api/routes/sign-out.d.mts +46 -0
  42. package/dist/api/routes/sign-out.mjs +101 -0
  43. package/dist/api/routes/sign-up.d.mts +155 -0
  44. package/dist/api/routes/sign-up.mjs +279 -0
  45. package/dist/api/routes/update-session.d.mts +70 -0
  46. package/dist/api/routes/update-session.mjs +56 -0
  47. package/dist/api/routes/update-user.d.mts +424 -0
  48. package/dist/api/routes/update-user.mjs +524 -0
  49. package/dist/api/state/oauth.d.mts +48 -0
  50. package/dist/api/state/oauth.mjs +38 -0
  51. package/dist/api/state/should-session-refresh.d.mts +10 -0
  52. package/dist/api/state/should-session-refresh.mjs +12 -0
  53. package/dist/api/to-auth-endpoints.mjs +59 -0
  54. package/dist/auth/base.mjs +60 -0
  55. package/dist/auth/full.d.mts +25 -0
  56. package/dist/auth/full.mjs +28 -0
  57. package/dist/auth/minimal.d.mts +8 -0
  58. package/dist/auth/minimal.mjs +10 -0
  59. package/dist/auth/trusted-origins.mjs +130 -0
  60. package/dist/client/broadcast-channel.d.mts +16 -0
  61. package/dist/client/broadcast-channel.mjs +44 -0
  62. package/dist/client/config.d.mts +84 -0
  63. package/dist/client/config.mjs +111 -0
  64. package/dist/client/equality.d.mts +15 -0
  65. package/dist/client/equality.mjs +41 -0
  66. package/dist/client/fetch-plugins.mjs +16 -0
  67. package/dist/client/focus-manager.d.mts +7 -0
  68. package/dist/client/focus-manager.mjs +30 -0
  69. package/dist/client/index.d.mts +35 -0
  70. package/dist/client/index.mjs +21 -0
  71. package/dist/client/lynx/index.d.mts +40 -0
  72. package/dist/client/lynx/index.mjs +22 -0
  73. package/dist/client/lynx/lynx-store.d.mts +43 -0
  74. package/dist/client/lynx/lynx-store.mjs +43 -0
  75. package/dist/client/online-manager.d.mts +8 -0
  76. package/dist/client/online-manager.mjs +33 -0
  77. package/dist/client/parser.d.mts +12 -0
  78. package/dist/client/parser.mjs +59 -0
  79. package/dist/client/path-to-object.d.mts +110 -0
  80. package/dist/client/plugins/index.d.mts +44 -0
  81. package/dist/client/plugins/index.mjs +30 -0
  82. package/dist/client/plugins/infer-plugin.d.mts +12 -0
  83. package/dist/client/plugins/infer-plugin.mjs +10 -0
  84. package/dist/client/proxy.mjs +70 -0
  85. package/dist/client/query-atom.mjs +12 -0
  86. package/dist/client/query.d.mts +19 -0
  87. package/dist/client/query.mjs +133 -0
  88. package/dist/client/react/index.d.mts +41 -0
  89. package/dist/client/react/index.mjs +22 -0
  90. package/dist/client/react/react-store.d.mts +43 -0
  91. package/dist/client/react/react-store.mjs +44 -0
  92. package/dist/client/session-atom.d.mts +9 -0
  93. package/dist/client/session-atom.mjs +179 -0
  94. package/dist/client/session-refresh.d.mts +16 -0
  95. package/dist/client/session-refresh.mjs +131 -0
  96. package/dist/client/solid/index.d.mts +41 -0
  97. package/dist/client/solid/index.mjs +22 -0
  98. package/dist/client/solid/solid-store.mjs +20 -0
  99. package/dist/client/svelte/index.d.mts +41 -0
  100. package/dist/client/svelte/index.mjs +18 -0
  101. package/dist/client/types.d.mts +49 -0
  102. package/dist/client/vanilla.d.mts +39 -0
  103. package/dist/client/vanilla.mjs +18 -0
  104. package/dist/client/vue/index.d.mts +64 -0
  105. package/dist/client/vue/index.mjs +60 -0
  106. package/dist/client/vue/vue-store.mjs +22 -0
  107. package/dist/context/create-context.mjs +229 -0
  108. package/dist/context/helpers.mjs +159 -0
  109. package/dist/context/init-minimal.mjs +15 -0
  110. package/dist/context/init.mjs +16 -0
  111. package/dist/context/secret-utils.mjs +52 -0
  112. package/dist/context/store-capabilities.mjs +11 -0
  113. package/dist/cookies/cache.mjs +33 -0
  114. package/dist/cookies/cookie-utils.d.mts +70 -0
  115. package/dist/cookies/cookie-utils.mjs +200 -0
  116. package/dist/cookies/index.d.mts +121 -0
  117. package/dist/cookies/index.mjs +356 -0
  118. package/dist/cookies/jwt.mjs +44 -0
  119. package/dist/cookies/session-store.d.mts +31 -0
  120. package/dist/cookies/session-store.mjs +183 -0
  121. package/dist/crypto/buffer.d.mts +4 -0
  122. package/dist/crypto/buffer.mjs +15 -0
  123. package/dist/crypto/index.d.mts +24 -0
  124. package/dist/crypto/index.mjs +70 -0
  125. package/dist/crypto/jwt.d.mts +5 -0
  126. package/dist/crypto/jwt.mjs +141 -0
  127. package/dist/crypto/password.d.mts +7 -0
  128. package/dist/crypto/password.mjs +13 -0
  129. package/dist/crypto/purpose.d.mts +12 -0
  130. package/dist/crypto/purpose.mjs +27 -0
  131. package/dist/crypto/random.d.mts +1 -0
  132. package/dist/crypto/random.mjs +4 -0
  133. package/dist/db/adapter-base.d.mts +3 -0
  134. package/dist/db/adapter-base.mjs +24 -0
  135. package/dist/db/adapter-kysely.d.mts +3 -0
  136. package/dist/db/adapter-kysely.mjs +16 -0
  137. package/dist/db/field-converter.d.mts +3 -0
  138. package/dist/db/field-converter.mjs +18 -0
  139. package/dist/db/field.d.mts +38 -0
  140. package/dist/db/get-migration.d.mts +50 -0
  141. package/dist/db/get-migration.mjs +685 -0
  142. package/dist/db/get-schema.d.mts +9 -0
  143. package/dist/db/get-schema.mjs +54 -0
  144. package/dist/db/index.d.mts +10 -0
  145. package/dist/db/index.mjs +34 -0
  146. package/dist/db/internal-adapter.d.mts +10 -0
  147. package/dist/db/internal-adapter.mjs +1083 -0
  148. package/dist/db/revoke-unproven-account-access.d.mts +18 -0
  149. package/dist/db/revoke-unproven-account-access.mjs +57 -0
  150. package/dist/db/schema.d.mts +59 -0
  151. package/dist/db/schema.mjs +172 -0
  152. package/dist/db/to-zod.d.mts +31 -0
  153. package/dist/db/to-zod.mjs +32 -0
  154. package/dist/db/verification-token-storage.mjs +24 -0
  155. package/dist/db/with-hooks.d.mts +33 -0
  156. package/dist/db/with-hooks.mjs +248 -0
  157. package/dist/index.d.mts +30 -0
  158. package/dist/index.mjs +16 -0
  159. package/dist/integrations/cookie-plugin-guard.mjs +17 -0
  160. package/dist/integrations/next-js.d.mts +23 -0
  161. package/dist/integrations/next-js.mjs +104 -0
  162. package/dist/integrations/node.d.mts +7 -0
  163. package/dist/integrations/node.mjs +14 -0
  164. package/dist/integrations/solid-start.d.mts +19 -0
  165. package/dist/integrations/solid-start.mjs +14 -0
  166. package/dist/integrations/svelte-kit.d.mts +28 -0
  167. package/dist/integrations/svelte-kit.mjs +56 -0
  168. package/dist/integrations/tanstack-start-solid.d.mts +27 -0
  169. package/dist/integrations/tanstack-start-solid.mjs +56 -0
  170. package/dist/integrations/tanstack-start.d.mts +27 -0
  171. package/dist/integrations/tanstack-start.mjs +56 -0
  172. package/dist/oauth2/account-fields.mjs +51 -0
  173. package/dist/oauth2/account-key.mjs +42 -0
  174. package/dist/oauth2/callback.mjs +67 -0
  175. package/dist/oauth2/dpop-client.d.mts +1 -0
  176. package/dist/oauth2/dpop-client.mjs +2 -0
  177. package/dist/oauth2/errors.mjs +48 -0
  178. package/dist/oauth2/index.d.mts +5 -0
  179. package/dist/oauth2/index.mjs +5 -0
  180. package/dist/oauth2/link-account.d.mts +126 -0
  181. package/dist/oauth2/link-account.mjs +429 -0
  182. package/dist/oauth2/state.d.mts +49 -0
  183. package/dist/oauth2/state.mjs +66 -0
  184. package/dist/oauth2/utils.d.mts +21 -0
  185. package/dist/oauth2/utils.mjs +44 -0
  186. package/dist/package.mjs +3 -0
  187. package/dist/plugins/access/access.d.mts +13 -0
  188. package/dist/plugins/access/access.mjs +77 -0
  189. package/dist/plugins/access/index.d.mts +3 -0
  190. package/dist/plugins/access/index.mjs +1 -0
  191. package/dist/plugins/access/types.d.mts +20 -0
  192. package/dist/plugins/additional-fields/client.d.mts +96 -0
  193. package/dist/plugins/additional-fields/client.mjs +10 -0
  194. package/dist/plugins/admin/access/index.d.mts +2 -0
  195. package/dist/plugins/admin/access/index.mjs +1 -0
  196. package/dist/plugins/admin/access/statement.d.mts +49 -0
  197. package/dist/plugins/admin/access/statement.mjs +53 -0
  198. package/dist/plugins/admin/admin.d.mts +908 -0
  199. package/dist/plugins/admin/admin.mjs +90 -0
  200. package/dist/plugins/admin/client.d.mts +84 -0
  201. package/dist/plugins/admin/client.mjs +38 -0
  202. package/dist/plugins/admin/error-codes.d.mts +30 -0
  203. package/dist/plugins/admin/error-codes.mjs +33 -0
  204. package/dist/plugins/admin/has-permission.mjs +11 -0
  205. package/dist/plugins/admin/index.d.mts +3 -0
  206. package/dist/plugins/admin/index.mjs +1 -0
  207. package/dist/plugins/admin/routes.mjs +940 -0
  208. package/dist/plugins/admin/schema.d.mts +37 -0
  209. package/dist/plugins/admin/schema.mjs +32 -0
  210. package/dist/plugins/admin/types.d.mts +89 -0
  211. package/dist/plugins/anonymous/client.d.mts +28 -0
  212. package/dist/plugins/anonymous/client.mjs +20 -0
  213. package/dist/plugins/anonymous/error-codes.d.mts +10 -0
  214. package/dist/plugins/anonymous/error-codes.mjs +13 -0
  215. package/dist/plugins/anonymous/index.d.mts +170 -0
  216. package/dist/plugins/anonymous/index.mjs +220 -0
  217. package/dist/plugins/anonymous/schema.d.mts +12 -0
  218. package/dist/plugins/anonymous/schema.mjs +8 -0
  219. package/dist/plugins/anonymous/types.d.mts +62 -0
  220. package/dist/plugins/bearer/index.d.mts +39 -0
  221. package/dist/plugins/bearer/index.mjs +73 -0
  222. package/dist/plugins/captcha/constants.d.mts +7 -0
  223. package/dist/plugins/captcha/constants.mjs +27 -0
  224. package/dist/plugins/captcha/error-codes.mjs +12 -0
  225. package/dist/plugins/captcha/index.d.mts +22 -0
  226. package/dist/plugins/captcha/index.mjs +84 -0
  227. package/dist/plugins/captcha/types.d.mts +90 -0
  228. package/dist/plugins/captcha/utils.mjs +18 -0
  229. package/dist/plugins/captcha/verify-handlers/captchafox.mjs +26 -0
  230. package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +46 -0
  231. package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +31 -0
  232. package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +26 -0
  233. package/dist/plugins/captcha/verify-handlers/vercel-botid.mjs +26 -0
  234. package/dist/plugins/custom-session/client.d.mts +13 -0
  235. package/dist/plugins/custom-session/client.mjs +6 -0
  236. package/dist/plugins/custom-session/index.d.mts +65 -0
  237. package/dist/plugins/custom-session/index.mjs +57 -0
  238. package/dist/plugins/device-authorization/client.d.mts +13 -0
  239. package/dist/plugins/device-authorization/client.mjs +17 -0
  240. package/dist/plugins/device-authorization/error-codes.mjs +18 -0
  241. package/dist/plugins/device-authorization/index.d.mts +550 -0
  242. package/dist/plugins/device-authorization/index.mjs +79 -0
  243. package/dist/plugins/device-authorization/routes.d.mts +96 -0
  244. package/dist/plugins/device-authorization/routes.mjs +734 -0
  245. package/dist/plugins/device-authorization/schema.d.mts +15 -0
  246. package/dist/plugins/device-authorization/schema.mjs +62 -0
  247. package/dist/plugins/email-otp/client.d.mts +17 -0
  248. package/dist/plugins/email-otp/client.mjs +16 -0
  249. package/dist/plugins/email-otp/error-codes.d.mts +5 -0
  250. package/dist/plugins/email-otp/error-codes.mjs +8 -0
  251. package/dist/plugins/email-otp/index.d.mts +542 -0
  252. package/dist/plugins/email-otp/index.mjs +144 -0
  253. package/dist/plugins/email-otp/otp-token.mjs +66 -0
  254. package/dist/plugins/email-otp/routes.mjs +774 -0
  255. package/dist/plugins/email-otp/types.d.mts +105 -0
  256. package/dist/plugins/email-otp/utils.mjs +16 -0
  257. package/dist/plugins/generic-oauth/error-codes.mjs +8 -0
  258. package/dist/plugins/generic-oauth/index.d.mts +57 -0
  259. package/dist/plugins/generic-oauth/index.mjs +459 -0
  260. package/dist/plugins/generic-oauth/providers/auth0.d.mts +32 -0
  261. package/dist/plugins/generic-oauth/providers/auth0.mjs +48 -0
  262. package/dist/plugins/generic-oauth/providers/gumroad.d.mts +27 -0
  263. package/dist/plugins/generic-oauth/providers/gumroad.mjs +61 -0
  264. package/dist/plugins/generic-oauth/providers/hubspot.d.mts +32 -0
  265. package/dist/plugins/generic-oauth/providers/hubspot.mjs +65 -0
  266. package/dist/plugins/generic-oauth/providers/index.d.mts +11 -0
  267. package/dist/plugins/generic-oauth/providers/keycloak.d.mts +32 -0
  268. package/dist/plugins/generic-oauth/providers/keycloak.mjs +46 -0
  269. package/dist/plugins/generic-oauth/providers/line.d.mts +50 -0
  270. package/dist/plugins/generic-oauth/providers/line.mjs +92 -0
  271. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +35 -0
  272. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +104 -0
  273. package/dist/plugins/generic-oauth/providers/okta.d.mts +32 -0
  274. package/dist/plugins/generic-oauth/providers/okta.mjs +47 -0
  275. package/dist/plugins/generic-oauth/providers/patreon.d.mts +25 -0
  276. package/dist/plugins/generic-oauth/providers/patreon.mjs +60 -0
  277. package/dist/plugins/generic-oauth/providers/slack.d.mts +25 -0
  278. package/dist/plugins/generic-oauth/providers/slack.mjs +65 -0
  279. package/dist/plugins/generic-oauth/providers/token-endpoint-audience.mjs +15 -0
  280. package/dist/plugins/generic-oauth/providers/yandex.d.mts +25 -0
  281. package/dist/plugins/generic-oauth/providers/yandex.mjs +66 -0
  282. package/dist/plugins/generic-oauth/types.d.mts +328 -0
  283. package/dist/plugins/haveibeenpwned/index.d.mts +57 -0
  284. package/dist/plugins/haveibeenpwned/index.mjs +80 -0
  285. package/dist/plugins/index.d.mts +76 -0
  286. package/dist/plugins/index.mjs +53 -0
  287. package/dist/plugins/jwt/adapter.mjs +78 -0
  288. package/dist/plugins/jwt/client.d.mts +38 -0
  289. package/dist/plugins/jwt/client.mjs +18 -0
  290. package/dist/plugins/jwt/cookie-cache.mjs +71 -0
  291. package/dist/plugins/jwt/index.d.mts +241 -0
  292. package/dist/plugins/jwt/index.mjs +213 -0
  293. package/dist/plugins/jwt/schema.d.mts +30 -0
  294. package/dist/plugins/jwt/schema.mjs +28 -0
  295. package/dist/plugins/jwt/sign.d.mts +127 -0
  296. package/dist/plugins/jwt/sign.mjs +134 -0
  297. package/dist/plugins/jwt/types.d.mts +255 -0
  298. package/dist/plugins/jwt/utils.d.mts +36 -0
  299. package/dist/plugins/jwt/utils.mjs +63 -0
  300. package/dist/plugins/jwt/verify.d.mts +7 -0
  301. package/dist/plugins/jwt/verify.mjs +50 -0
  302. package/dist/plugins/last-login-method/client.d.mts +45 -0
  303. package/dist/plugins/last-login-method/client.mjs +47 -0
  304. package/dist/plugins/last-login-method/index.d.mts +121 -0
  305. package/dist/plugins/last-login-method/index.mjs +98 -0
  306. package/dist/plugins/magic-link/client.d.mts +6 -0
  307. package/dist/plugins/magic-link/client.mjs +10 -0
  308. package/dist/plugins/magic-link/index.d.mts +208 -0
  309. package/dist/plugins/magic-link/index.mjs +223 -0
  310. package/dist/plugins/magic-link/utils.mjs +8 -0
  311. package/dist/plugins/multi-session/client.d.mts +15 -0
  312. package/dist/plugins/multi-session/client.mjs +18 -0
  313. package/dist/plugins/multi-session/error-codes.d.mts +3 -0
  314. package/dist/plugins/multi-session/error-codes.mjs +4 -0
  315. package/dist/plugins/multi-session/index.d.mts +206 -0
  316. package/dist/plugins/multi-session/index.mjs +216 -0
  317. package/dist/plugins/oauth-popup/client.d.mts +74 -0
  318. package/dist/plugins/oauth-popup/client.mjs +204 -0
  319. package/dist/plugins/oauth-popup/constants.d.mts +8 -0
  320. package/dist/plugins/oauth-popup/constants.mjs +10 -0
  321. package/dist/plugins/oauth-popup/error-codes.d.mts +6 -0
  322. package/dist/plugins/oauth-popup/error-codes.mjs +9 -0
  323. package/dist/plugins/oauth-popup/index.d.mts +61 -0
  324. package/dist/plugins/oauth-popup/index.mjs +232 -0
  325. package/dist/plugins/oauth-popup/types.d.mts +26 -0
  326. package/dist/plugins/oauth-proxy/index.d.mts +123 -0
  327. package/dist/plugins/oauth-proxy/index.mjs +397 -0
  328. package/dist/plugins/oauth-proxy/utils.mjs +54 -0
  329. package/dist/plugins/one-tap/client.d.mts +187 -0
  330. package/dist/plugins/one-tap/client.mjs +208 -0
  331. package/dist/plugins/one-tap/index.d.mts +117 -0
  332. package/dist/plugins/one-tap/index.mjs +146 -0
  333. package/dist/plugins/one-time-token/client.d.mts +7 -0
  334. package/dist/plugins/one-time-token/client.mjs +10 -0
  335. package/dist/plugins/one-time-token/index.d.mts +128 -0
  336. package/dist/plugins/one-time-token/index.mjs +106 -0
  337. package/dist/plugins/one-time-token/utils.mjs +8 -0
  338. package/dist/plugins/open-api/generator.d.mts +124 -0
  339. package/dist/plugins/open-api/generator.mjs +557 -0
  340. package/dist/plugins/open-api/index.d.mts +93 -0
  341. package/dist/plugins/open-api/index.mjs +64 -0
  342. package/dist/plugins/open-api/logo.mjs +12 -0
  343. package/dist/plugins/organization/access/index.d.mts +2 -0
  344. package/dist/plugins/organization/access/index.mjs +1 -0
  345. package/dist/plugins/organization/access/statement.d.mts +111 -0
  346. package/dist/plugins/organization/access/statement.mjs +76 -0
  347. package/dist/plugins/organization/adapter.d.mts +786 -0
  348. package/dist/plugins/organization/adapter.mjs +821 -0
  349. package/dist/plugins/organization/call.mjs +14 -0
  350. package/dist/plugins/organization/client.d.mts +375 -0
  351. package/dist/plugins/organization/client.mjs +108 -0
  352. package/dist/plugins/organization/error-codes.d.mts +62 -0
  353. package/dist/plugins/organization/error-codes.mjs +65 -0
  354. package/dist/plugins/organization/has-permission.d.mts +12 -0
  355. package/dist/plugins/organization/has-permission.mjs +72 -0
  356. package/dist/plugins/organization/index.d.mts +7 -0
  357. package/dist/plugins/organization/index.mjs +5 -0
  358. package/dist/plugins/organization/organization.d.mts +418 -0
  359. package/dist/plugins/organization/organization.mjs +888 -0
  360. package/dist/plugins/organization/permission.d.mts +12 -0
  361. package/dist/plugins/organization/permission.mjs +13 -0
  362. package/dist/plugins/organization/roles.d.mts +6 -0
  363. package/dist/plugins/organization/roles.mjs +25 -0
  364. package/dist/plugins/organization/routes/crud-access-control.d.mts +509 -0
  365. package/dist/plugins/organization/routes/crud-access-control.mjs +674 -0
  366. package/dist/plugins/organization/routes/crud-invites.d.mts +1173 -0
  367. package/dist/plugins/organization/routes/crud-invites.mjs +619 -0
  368. package/dist/plugins/organization/routes/crud-members.d.mts +1010 -0
  369. package/dist/plugins/organization/routes/crud-members.mjs +515 -0
  370. package/dist/plugins/organization/routes/crud-org.d.mts +914 -0
  371. package/dist/plugins/organization/routes/crud-org.mjs +465 -0
  372. package/dist/plugins/organization/routes/crud-team.d.mts +1235 -0
  373. package/dist/plugins/organization/routes/crud-team.mjs +767 -0
  374. package/dist/plugins/organization/schema.d.mts +388 -0
  375. package/dist/plugins/organization/schema.mjs +64 -0
  376. package/dist/plugins/organization/types.d.mts +688 -0
  377. package/dist/plugins/phone-number/client.d.mts +29 -0
  378. package/dist/plugins/phone-number/client.mjs +18 -0
  379. package/dist/plugins/phone-number/error-codes.d.mts +16 -0
  380. package/dist/plugins/phone-number/error-codes.mjs +19 -0
  381. package/dist/plugins/phone-number/index.d.mts +376 -0
  382. package/dist/plugins/phone-number/index.mjs +72 -0
  383. package/dist/plugins/phone-number/routes.mjs +612 -0
  384. package/dist/plugins/phone-number/schema.d.mts +19 -0
  385. package/dist/plugins/phone-number/schema.mjs +17 -0
  386. package/dist/plugins/phone-number/types.d.mts +119 -0
  387. package/dist/plugins/siwe/client.d.mts +10 -0
  388. package/dist/plugins/siwe/client.mjs +14 -0
  389. package/dist/plugins/siwe/index.d.mts +58 -0
  390. package/dist/plugins/siwe/index.mjs +288 -0
  391. package/dist/plugins/siwe/parse-message.mjs +57 -0
  392. package/dist/plugins/siwe/schema.d.mts +32 -0
  393. package/dist/plugins/siwe/schema.mjs +29 -0
  394. package/dist/plugins/siwe/types.d.mts +41 -0
  395. package/dist/plugins/test-utils/auth-helpers.mjs +34 -0
  396. package/dist/plugins/test-utils/cookie-builder.mjs +54 -0
  397. package/dist/plugins/test-utils/db-helpers.mjs +64 -0
  398. package/dist/plugins/test-utils/factories.mjs +37 -0
  399. package/dist/plugins/test-utils/index.d.mts +69 -0
  400. package/dist/plugins/test-utils/index.mjs +96 -0
  401. package/dist/plugins/test-utils/otp-sink.mjs +20 -0
  402. package/dist/plugins/test-utils/types.d.mts +49 -0
  403. package/dist/plugins/two-factor/backup-codes/index.d.mts +286 -0
  404. package/dist/plugins/two-factor/backup-codes/index.mjs +354 -0
  405. package/dist/plugins/two-factor/claim.d.mts +86 -0
  406. package/dist/plugins/two-factor/claim.mjs +171 -0
  407. package/dist/plugins/two-factor/client.d.mts +76 -0
  408. package/dist/plugins/two-factor/client.mjs +40 -0
  409. package/dist/plugins/two-factor/constant.d.mts +7 -0
  410. package/dist/plugins/two-factor/constant.mjs +12 -0
  411. package/dist/plugins/two-factor/error-code.d.mts +20 -0
  412. package/dist/plugins/two-factor/error-code.mjs +23 -0
  413. package/dist/plugins/two-factor/index.d.mts +746 -0
  414. package/dist/plugins/two-factor/index.mjs +493 -0
  415. package/dist/plugins/two-factor/otp/index.d.mts +211 -0
  416. package/dist/plugins/two-factor/otp/index.mjs +262 -0
  417. package/dist/plugins/two-factor/passkey.mjs +47 -0
  418. package/dist/plugins/two-factor/schema.d.mts +66 -0
  419. package/dist/plugins/two-factor/schema.mjs +66 -0
  420. package/dist/plugins/two-factor/totp/index.d.mts +214 -0
  421. package/dist/plugins/two-factor/totp/index.mjs +290 -0
  422. package/dist/plugins/two-factor/types.d.mts +112 -0
  423. package/dist/plugins/two-factor/utils.mjs +8 -0
  424. package/dist/plugins/two-factor/verify-two-factor.d.mts +121 -0
  425. package/dist/plugins/two-factor/verify-two-factor.mjs +314 -0
  426. package/dist/plugins/username/client.d.mts +34 -0
  427. package/dist/plugins/username/client.mjs +16 -0
  428. package/dist/plugins/username/error-codes.d.mts +11 -0
  429. package/dist/plugins/username/error-codes.mjs +14 -0
  430. package/dist/plugins/username/index.d.mts +319 -0
  431. package/dist/plugins/username/index.mjs +304 -0
  432. package/dist/plugins/username/schema.d.mts +45 -0
  433. package/dist/plugins/username/schema.mjs +24 -0
  434. package/dist/social-providers/index.d.mts +1 -0
  435. package/dist/social-providers/index.mjs +2 -0
  436. package/dist/state.d.mts +48 -0
  437. package/dist/state.mjs +153 -0
  438. package/dist/test-utils/headers.d.mts +5 -0
  439. package/dist/test-utils/headers.mjs +16 -0
  440. package/dist/test-utils/http-test-instance.d.mts +420 -0
  441. package/dist/test-utils/http-test-instance.mjs +106 -0
  442. package/dist/test-utils/index.d.mts +4 -0
  443. package/dist/test-utils/index.mjs +4 -0
  444. package/dist/test-utils/test-instance.d.mts +55 -0
  445. package/dist/test-utils/test-instance.mjs +252 -0
  446. package/dist/types/adapter.d.mts +2 -0
  447. package/dist/types/api.d.mts +24 -0
  448. package/dist/types/auth.d.mts +28 -0
  449. package/dist/types/helper.d.mts +23 -0
  450. package/dist/types/index.d.mts +10 -0
  451. package/dist/types/index.mjs +1 -0
  452. package/dist/types/models.d.mts +7 -0
  453. package/dist/types/plugins.d.mts +16 -0
  454. package/dist/utils/constants.mjs +3 -0
  455. package/dist/utils/date.mjs +5 -0
  456. package/dist/utils/hashing.mjs +17 -0
  457. package/dist/utils/hide-metadata.d.mts +2 -0
  458. package/dist/utils/hide-metadata.mjs +1 -0
  459. package/dist/utils/index.d.mts +5 -0
  460. package/dist/utils/is-api-error.d.mts +2 -0
  461. package/dist/utils/is-api-error.mjs +1 -0
  462. package/dist/utils/is-atom.mjs +5 -0
  463. package/dist/utils/is-promise.mjs +5 -0
  464. package/dist/utils/middleware-response.mjs +9 -0
  465. package/dist/utils/password.mjs +90 -0
  466. package/dist/utils/plugin-helper.mjs +13 -0
  467. package/dist/utils/request.mjs +22 -0
  468. package/dist/utils/shim.mjs +21 -0
  469. package/dist/utils/time.d.mts +46 -0
  470. package/dist/utils/time.mjs +97 -0
  471. package/dist/utils/url.d.mts +74 -0
  472. package/dist/utils/url.mjs +237 -0
  473. package/dist/utils/validate-user-info.mjs +43 -0
  474. package/dist/utils/wildcard.mjs +107 -0
  475. package/dist/version.mjs +4 -0
  476. package/package.json +601 -3
@@ -0,0 +1 @@
1
+ export * from "@entro314labs/entro-auth-core/social-providers";
@@ -0,0 +1,2 @@
1
+ export * from "@entro314labs/entro-auth-core/social-providers";
2
+ export {};
@@ -0,0 +1,48 @@
1
+ import { GenericEndpointContext } from "@entro314labs/entro-auth-core";
2
+ import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
3
+ import * as z from "zod";
4
+ import { getAuthStateVerificationIdentifier } from "@entro314labs/entro-auth-core/utils/state";
5
+ declare const stateDataSchema: z.ZodObject<{
6
+ callbackURL: z.ZodString;
7
+ codeVerifier: z.ZodString;
8
+ errorURL: z.ZodOptional<z.ZodString>;
9
+ newUserURL: z.ZodOptional<z.ZodString>;
10
+ expiresAt: z.ZodNumber;
11
+ oauthState: z.ZodOptional<z.ZodString>;
12
+ link: z.ZodOptional<z.ZodObject<{
13
+ email: z.ZodString;
14
+ userId: z.ZodCoercedString<unknown>;
15
+ encryptedSessionToken: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>>;
17
+ requestSignUp: z.ZodOptional<z.ZodBoolean>;
18
+ idTokenNonce: z.ZodOptional<z.ZodString>;
19
+ serverContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
20
+ }, z.core.$loose>;
21
+ export type StateData = z.infer<typeof stateDataSchema>;
22
+ export declare function generateGenericState(c: GenericEndpointContext, stateData: StateData, settings?: {
23
+ cookieName: string;
24
+ }): Promise<{
25
+ state: string;
26
+ codeVerifier: string;
27
+ }>;
28
+ export declare function parseGenericState(c: GenericEndpointContext, state: string | undefined, settings?: {
29
+ cookieName?: string;
30
+ skipStateCookieCheck?: boolean;
31
+ }): Promise<{
32
+ [x: string]: unknown;
33
+ callbackURL: string;
34
+ codeVerifier: string;
35
+ expiresAt: number;
36
+ errorURL?: string | undefined;
37
+ newUserURL?: string | undefined;
38
+ oauthState?: string | undefined;
39
+ link?: {
40
+ email: string;
41
+ userId: string;
42
+ encryptedSessionToken?: string | undefined;
43
+ } | undefined;
44
+ requestSignUp?: boolean | undefined;
45
+ idTokenNonce?: string | undefined;
46
+ serverContext?: Record<string, unknown> | undefined;
47
+ }>;
48
+ export { getAuthStateVerificationIdentifier };
package/dist/state.mjs ADDED
@@ -0,0 +1,153 @@
1
+ import { expireCookie } from "./cookies/index.mjs";
2
+ import { generateRandomString } from "./crypto/random.mjs";
3
+ import { symmetricDecrypt, symmetricEncrypt } from "./crypto/index.mjs";
4
+ import { deriveEncryptionKey } from "./crypto/purpose.mjs";
5
+ import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
6
+ import * as z from "zod";
7
+ import { getAuthStateVerificationIdentifier } from "@entro314labs/entro-auth-core/utils/state";
8
+ // src/state.ts
9
+ const stateDataSchema = z.looseObject({
10
+ callbackURL: z.string(),
11
+ codeVerifier: z.string(),
12
+ errorURL: z.string().optional(),
13
+ newUserURL: z.string().optional(),
14
+ expiresAt: z.number(),
15
+ /**
16
+ * CSRF nonce returned to the OAuth provider. When using cookie state storage,
17
+ * this must match the callback `state` query parameter.
18
+ */
19
+ oauthState: z.string().optional(),
20
+ link: z.object({
21
+ email: z.string(),
22
+ userId: z.coerce.string(),
23
+ /**
24
+ * Encrypted source session token for callback-time liveness checks.
25
+ */
26
+ encryptedSessionToken: z.string().optional()
27
+ }).optional(),
28
+ requestSignUp: z.boolean().optional(),
29
+ /**
30
+ * OIDC nonce sent as the authorization request `nonce` parameter when the
31
+ * provider requires an ID token to be bound to this redirect flow.
32
+ */
33
+ idTokenNonce: z.string().optional(),
34
+ /**
35
+ * Server-controlled values that ride the state across the provider redirect.
36
+ * Populated only by `generateState` from `addOAuthServerContext`, never from
37
+ * the request body, so it is safe to trust on the callback.
38
+ */
39
+ serverContext: z.record(z.string(), z.unknown()).optional()
40
+ });
41
+ const INTERNAL_STATE_KEYS = new Set(Object.keys(stateDataSchema.shape));
42
+ var StateError = class extends EntroAuthError {
43
+ code;
44
+ details;
45
+ /**
46
+ * The per-flow `errorCallbackURL` recovered from the parsed state, when the
47
+ * failure happened after the state was successfully parsed (for example a
48
+ * nonce or state-cookie mismatch). It was origin-validated at sign-in, so
49
+ * the callback can safely redirect there instead of the default error page.
50
+ * Absent when the state could not be parsed at all.
51
+ */
52
+ errorURL;
53
+ constructor(message, options) {
54
+ super(message, options);
55
+ this.code = options.code;
56
+ this.details = options.details;
57
+ this.errorURL = options.errorURL;
58
+ }
59
+ };
60
+ async function generateGenericState(c, stateData, settings) {
61
+ const state = generateRandomString(32);
62
+ if (c.context.oauthConfig.storeStateStrategy === "cookie") {
63
+ const payload = {
64
+ ...stateData,
65
+ oauthState: state
66
+ };
67
+ const encryptedData = await symmetricEncrypt({
68
+ key: deriveEncryptionKey(c.context.secretConfig, "oauth-state-cookie"),
69
+ data: JSON.stringify(payload)
70
+ });
71
+ const stateCookie = c.context.createAuthCookie(settings?.cookieName ?? "oauth_state", { maxAge: 600 });
72
+ c.setCookie(stateCookie.name, encryptedData, stateCookie.attributes);
73
+ return {
74
+ state,
75
+ codeVerifier: stateData.codeVerifier
76
+ };
77
+ }
78
+ const stateCookie = c.context.createAuthCookie(settings?.cookieName ?? "state", { maxAge: 300 });
79
+ await c.setSignedCookie(stateCookie.name, state, c.context.secret, stateCookie.attributes);
80
+ const expiresAt = new Date(Date.now() + 6e5);
81
+ if (!await c.context.internalAdapter.createVerificationValue({
82
+ value: JSON.stringify({
83
+ ...stateData,
84
+ oauthState: state
85
+ }),
86
+ identifier: getAuthStateVerificationIdentifier(state),
87
+ expiresAt
88
+ })) throw new StateError("Unable to create verification. Make sure the database adapter is properly working and there is a verification table in the database", { code: "state_generation_error" });
89
+ return {
90
+ state,
91
+ codeVerifier: stateData.codeVerifier
92
+ };
93
+ }
94
+ async function parseGenericState(c, state, settings) {
95
+ if (!state) throw new StateError("State not found in OAuth callback", { code: "state_not_found" });
96
+ const storeStateStrategy = c.context.oauthConfig.storeStateStrategy;
97
+ let parsedData;
98
+ if (storeStateStrategy === "cookie") {
99
+ const stateCookie = c.context.createAuthCookie(settings?.cookieName ?? "oauth_state");
100
+ const encryptedData = c.getCookie(stateCookie.name);
101
+ if (!encryptedData) throw new StateError("State mismatch: auth state cookie not found", {
102
+ code: "state_mismatch",
103
+ details: { state }
104
+ });
105
+ try {
106
+ const decryptedData = await symmetricDecrypt({
107
+ key: deriveEncryptionKey(c.context.secretConfig, "oauth-state-cookie"),
108
+ data: encryptedData
109
+ });
110
+ parsedData = stateDataSchema.parse(JSON.parse(decryptedData));
111
+ } catch (error) {
112
+ throw new StateError("State invalid: Failed to decrypt or parse auth state", {
113
+ code: "state_invalid",
114
+ details: { state },
115
+ cause: error
116
+ });
117
+ }
118
+ if (!parsedData.oauthState || parsedData.oauthState !== state) throw new StateError("State mismatch: OAuth state parameter does not match stored state", {
119
+ code: "state_security_mismatch",
120
+ details: { state },
121
+ errorURL: parsedData.errorURL
122
+ });
123
+ expireCookie(c, stateCookie);
124
+ } else {
125
+ const data = await c.context.internalAdapter.findVerificationValue(getAuthStateVerificationIdentifier(state));
126
+ if (!data) throw new StateError("State mismatch: verification not found", {
127
+ code: "state_mismatch",
128
+ details: { state }
129
+ });
130
+ parsedData = stateDataSchema.parse(JSON.parse(data.value));
131
+ if (parsedData.oauthState !== void 0 && parsedData.oauthState !== state) throw new StateError("State mismatch: OAuth state parameter does not match stored state", {
132
+ code: "state_security_mismatch",
133
+ details: { state },
134
+ errorURL: parsedData.errorURL
135
+ });
136
+ const stateCookie = c.context.createAuthCookie(settings?.cookieName ?? "state");
137
+ const stateCookieValue = await c.getSignedCookie(stateCookie.name, c.context.secret);
138
+ if (!(settings?.skipStateCookieCheck ?? c.context.oauthConfig.skipStateCookieCheck) && (!stateCookieValue || stateCookieValue !== state)) throw new StateError("State mismatch: State not persisted correctly", {
139
+ code: "state_security_mismatch",
140
+ details: { state },
141
+ errorURL: parsedData.errorURL
142
+ });
143
+ expireCookie(c, stateCookie);
144
+ await c.context.internalAdapter.deleteVerificationByIdentifier(getAuthStateVerificationIdentifier(state));
145
+ }
146
+ if (parsedData.expiresAt < Date.now()) throw new StateError("Invalid state: request expired", {
147
+ code: "state_mismatch",
148
+ details: { expiresAt: parsedData.expiresAt },
149
+ errorURL: parsedData.errorURL
150
+ });
151
+ return parsedData;
152
+ }
153
+ export { INTERNAL_STATE_KEYS, StateError, generateGenericState, getAuthStateVerificationIdentifier, parseGenericState };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * converts set cookie containing headers to
3
+ * cookie containing headers
4
+ */
5
+ export declare function convertSetCookieToCookie(headers: Headers): Headers;
@@ -0,0 +1,16 @@
1
+ import { applySetCookies } from "../cookies/cookie-utils.mjs";
2
+ // src/test-utils/headers.ts
3
+ /**
4
+ * converts set cookie containing headers to
5
+ * cookie containing headers
6
+ */
7
+ function convertSetCookieToCookie(headers) {
8
+ const setCookieHeaders = [];
9
+ headers.forEach((value, name) => {
10
+ if (name.toLowerCase() === "set-cookie") setCookieHeaders.push(value);
11
+ });
12
+ if (setCookieHeaders.length === 0) return headers;
13
+ applySetCookies(headers, setCookieHeaders);
14
+ return headers;
15
+ }
16
+ export { convertSetCookieToCookie };
@@ -0,0 +1,420 @@
1
+ import { SessionQueryParams } from "../client/types.mjs";
2
+ import { Auth } from "../types/auth.mjs";
3
+ import "../index.mjs";
4
+ import { setCookieToHeader } from "../cookies/cookie-utils.mjs";
5
+ import "../cookies/index.mjs";
6
+ import { getTestInstance } from "./test-instance.mjs";
7
+ import { EntroAuthClientOptions, EntroAuthOptions } from "@entro314labs/entro-auth-core";
8
+ import { IncomingMessage, ServerResponse, createServer } from "node:http";
9
+ import { AddressInfo } from "node:net";
10
+ /** A Node request handler that can be installed on an HTTP test listener. */
11
+ export type HttpTestRequestHandler = (req: IncomingMessage, res: ServerResponse) => unknown | Promise<unknown>;
12
+ /** A bound HTTP test listener whose request handler can be installed later. */
13
+ export type HttpTestServer = {
14
+ url: string;
15
+ address: AddressInfo;
16
+ server: ReturnType<typeof createServer>;
17
+ setRequestHandler: (handler: HttpTestRequestHandler) => void;
18
+ close: () => Promise<void>;
19
+ };
20
+ type GetTestInstanceConfig = NonNullable<Parameters<typeof getTestInstance>[1]>;
21
+ export type HttpTestInstanceConfig<C extends EntroAuthClientOptions> = Omit<GetTestInstanceConfig, "port" | "clientOptions"> & {
22
+ clientOptions?: C;
23
+ /**
24
+ * Customizes the HTTP request listener. Receives the bound auth instance
25
+ * and returns a Node request handler. Defaults to
26
+ * `toNodeHandler(auth.handler)`.
27
+ *
28
+ * Use this when the test needs to expose extra routes alongside the auth
29
+ * handler (e.g. a `.well-known/openid-configuration` shim that calls
30
+ * `auth.api.getOpenIdConfig()`).
31
+ */
32
+ handler?: (auth: Awaited<ReturnType<typeof getTestInstance>>["auth"]) => HttpTestRequestHandler;
33
+ };
34
+ /**
35
+ * Binds an HTTP listener to an OS-assigned port before the final request
36
+ * handler exists. This lets tests construct URL-sensitive applications only
37
+ * after the listener owns its port, then install the application handler.
38
+ */
39
+ export declare function createHttpTestServer(): Promise<HttpTestServer>;
40
+ /**
41
+ * Like `getTestInstance`, but bound to an actual HTTP listener on an
42
+ * OS-assigned port (`port: 0`). The discovered URL is fed back into the auth
43
+ * instance so its `baseURL` matches the listener.
44
+ *
45
+ * This removes the race window that the temp-server-then-rebind pattern
46
+ * introduces. The listener is bound once, holds the port for its lifetime,
47
+ * and only swaps in the real request handler after the auth instance is
48
+ * fully constructed.
49
+ *
50
+ * The caller is responsible for calling `server.close()` in `afterAll`. Any
51
+ * `baseURL` passed in `options` is ignored — the URL must match the
52
+ * listener.
53
+ */
54
+ export declare function getHttpTestInstance<O extends Partial<EntroAuthOptions>, C extends EntroAuthClientOptions>(options?: O, config?: HttpTestInstanceConfig<C>): Promise<{
55
+ server: HttpTestServer;
56
+ baseURL: string;
57
+ port: number;
58
+ auth: Auth<O>;
59
+ client: {
60
+ hydrateSession(session: null): void;
61
+ useSession: import("nanostores").Atom<{
62
+ data: never;
63
+ error: import("@better-fetch/fetch").BetterFetchError | null;
64
+ isPending: boolean;
65
+ isRefetching: boolean;
66
+ refetch: (queryParams?: {
67
+ query?: SessionQueryParams;
68
+ } | undefined) => Promise<void>;
69
+ }>;
70
+ $fetch: import("@better-fetch/fetch").BetterFetch<{
71
+ plugins: (import("@better-fetch/fetch").BetterFetchPlugin<Record<string, any>> | {
72
+ id: string;
73
+ name: string;
74
+ hooks: {
75
+ onSuccess: ((context: import("@better-fetch/fetch").SuccessContext<any>) => Promise<void> | void) | undefined;
76
+ onError: ((context: import("@better-fetch/fetch").ErrorContext) => Promise<void> | void) | undefined;
77
+ onRequest: (<T extends Record<string, any>>(context: import("@better-fetch/fetch").RequestContext<T>) => Promise<import("@better-fetch/fetch").RequestContext | void> | import("@better-fetch/fetch").RequestContext | void) | undefined;
78
+ onResponse: ((context: import("@better-fetch/fetch").ResponseContext) => Promise<Response | void | import("@better-fetch/fetch").ResponseContext> | Response | import("@better-fetch/fetch").ResponseContext | void) | undefined;
79
+ };
80
+ } | {
81
+ id: string;
82
+ name: string;
83
+ hooks: {
84
+ onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): void;
85
+ };
86
+ })[];
87
+ method: string;
88
+ redirect?: RequestRedirect | undefined;
89
+ window?: null | undefined;
90
+ cache?: RequestCache | undefined;
91
+ credentials?: RequestCredentials;
92
+ integrity?: string | undefined;
93
+ keepalive?: boolean | undefined;
94
+ mode?: RequestMode | undefined;
95
+ priority?: RequestPriority | undefined;
96
+ referrer?: string | undefined;
97
+ referrerPolicy?: ReferrerPolicy | undefined;
98
+ signal?: AbortSignal | null;
99
+ onRetry?: ((response: import("@better-fetch/fetch").ResponseContext) => Promise<void> | void) | undefined;
100
+ hookOptions?: {
101
+ cloneResponse?: boolean;
102
+ } | undefined;
103
+ timeout?: number | undefined;
104
+ customFetchImpl: import("@better-fetch/fetch").FetchEsque;
105
+ baseURL: string;
106
+ throw?: boolean | undefined;
107
+ auth?: ({
108
+ type: "Bearer";
109
+ token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
110
+ } | {
111
+ type: "Basic";
112
+ username: string | (() => string | undefined) | undefined;
113
+ password: string | (() => string | undefined) | undefined;
114
+ } | {
115
+ type: "Custom";
116
+ prefix: string | (() => string | undefined) | undefined;
117
+ value: string | (() => string | undefined) | undefined;
118
+ }) | undefined;
119
+ headers?: {} | {
120
+ [x: string]: string | undefined;
121
+ accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
122
+ "content-type"?: ((string & {}) | "application/x-www-form-urlencoded" | "application/json" | "text/plain" | "application/octet-stream" | "multipart/form-data") | undefined;
123
+ authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
124
+ } | undefined;
125
+ body?: any;
126
+ query?: any;
127
+ params?: any;
128
+ duplex?: "full" | "half" | undefined;
129
+ jsonParser: (text: string) => Promise<any> | any;
130
+ retry?: import("@better-fetch/fetch").RetryOptions | undefined;
131
+ retryAttempt?: number | undefined;
132
+ output?: (import("@better-fetch/fetch").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
133
+ errorSchema?: import("@better-fetch/fetch").StandardSchemaV1 | undefined;
134
+ disableValidation?: boolean | undefined;
135
+ disableSignal?: boolean | undefined;
136
+ }, unknown, unknown, {}>;
137
+ $store: {
138
+ notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
139
+ listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
140
+ atoms: Record<string, import("nanostores").WritableAtom<any>>;
141
+ };
142
+ $Infer: {
143
+ Session: never;
144
+ };
145
+ $ERROR_CODES: {
146
+ USER_NOT_FOUND: {
147
+ readonly code: "USER_NOT_FOUND";
148
+ message: string;
149
+ };
150
+ FAILED_TO_CREATE_USER: {
151
+ readonly code: "FAILED_TO_CREATE_USER";
152
+ message: string;
153
+ };
154
+ FAILED_TO_CREATE_SESSION: {
155
+ readonly code: "FAILED_TO_CREATE_SESSION";
156
+ message: string;
157
+ };
158
+ FAILED_TO_UPDATE_USER: {
159
+ readonly code: "FAILED_TO_UPDATE_USER";
160
+ message: string;
161
+ };
162
+ FAILED_TO_DELETE_USER: {
163
+ readonly code: "FAILED_TO_DELETE_USER";
164
+ message: string;
165
+ };
166
+ FAILED_TO_GET_SESSION: {
167
+ readonly code: "FAILED_TO_GET_SESSION";
168
+ message: string;
169
+ };
170
+ INVALID_PASSWORD: {
171
+ readonly code: "INVALID_PASSWORD";
172
+ message: string;
173
+ };
174
+ INVALID_EMAIL: {
175
+ readonly code: "INVALID_EMAIL";
176
+ message: string;
177
+ };
178
+ INVALID_EMAIL_OR_PASSWORD: {
179
+ readonly code: "INVALID_EMAIL_OR_PASSWORD";
180
+ message: string;
181
+ };
182
+ INVALID_USER: {
183
+ readonly code: "INVALID_USER";
184
+ message: string;
185
+ };
186
+ SOCIAL_ACCOUNT_ALREADY_LINKED: {
187
+ readonly code: "SOCIAL_ACCOUNT_ALREADY_LINKED";
188
+ message: string;
189
+ };
190
+ PROVIDER_NOT_FOUND: {
191
+ readonly code: "PROVIDER_NOT_FOUND";
192
+ message: string;
193
+ };
194
+ INVALID_TOKEN: {
195
+ readonly code: "INVALID_TOKEN";
196
+ message: string;
197
+ };
198
+ TOKEN_EXPIRED: {
199
+ readonly code: "TOKEN_EXPIRED";
200
+ message: string;
201
+ };
202
+ ID_TOKEN_NOT_SUPPORTED: {
203
+ readonly code: "ID_TOKEN_NOT_SUPPORTED";
204
+ message: string;
205
+ };
206
+ INVALID_ID_TOKEN_NONCE: {
207
+ readonly code: "INVALID_ID_TOKEN_NONCE";
208
+ message: string;
209
+ };
210
+ ID_TOKEN_NONCE_NOT_ENABLED: {
211
+ readonly code: "ID_TOKEN_NONCE_NOT_ENABLED";
212
+ message: string;
213
+ };
214
+ FAILED_TO_GET_USER_INFO: {
215
+ readonly code: "FAILED_TO_GET_USER_INFO";
216
+ message: string;
217
+ };
218
+ USER_EMAIL_NOT_FOUND: {
219
+ readonly code: "USER_EMAIL_NOT_FOUND";
220
+ message: string;
221
+ };
222
+ EMAIL_NOT_VERIFIED: {
223
+ readonly code: "EMAIL_NOT_VERIFIED";
224
+ message: string;
225
+ };
226
+ PASSWORD_TOO_SHORT: {
227
+ readonly code: "PASSWORD_TOO_SHORT";
228
+ message: string;
229
+ };
230
+ PASSWORD_TOO_LONG: {
231
+ readonly code: "PASSWORD_TOO_LONG";
232
+ message: string;
233
+ };
234
+ USER_ALREADY_EXISTS: {
235
+ readonly code: "USER_ALREADY_EXISTS";
236
+ message: string;
237
+ };
238
+ USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: {
239
+ readonly code: "USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL";
240
+ message: string;
241
+ };
242
+ EMAIL_CAN_NOT_BE_UPDATED: {
243
+ readonly code: "EMAIL_CAN_NOT_BE_UPDATED";
244
+ message: string;
245
+ };
246
+ CHANGE_EMAIL_DISABLED: {
247
+ readonly code: "CHANGE_EMAIL_DISABLED";
248
+ message: string;
249
+ };
250
+ CREDENTIAL_ACCOUNT_NOT_FOUND: {
251
+ readonly code: "CREDENTIAL_ACCOUNT_NOT_FOUND";
252
+ message: string;
253
+ };
254
+ ACCOUNT_NOT_FOUND: {
255
+ readonly code: "ACCOUNT_NOT_FOUND";
256
+ message: string;
257
+ };
258
+ SESSION_EXPIRED: {
259
+ readonly code: "SESSION_EXPIRED";
260
+ message: string;
261
+ };
262
+ FAILED_TO_UNLINK_LAST_ACCOUNT: {
263
+ readonly code: "FAILED_TO_UNLINK_LAST_ACCOUNT";
264
+ message: string;
265
+ };
266
+ USER_ALREADY_HAS_PASSWORD: {
267
+ readonly code: "USER_ALREADY_HAS_PASSWORD";
268
+ message: string;
269
+ };
270
+ CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: {
271
+ readonly code: "CROSS_SITE_NAVIGATION_LOGIN_BLOCKED";
272
+ message: string;
273
+ };
274
+ VERIFICATION_EMAIL_NOT_ENABLED: {
275
+ readonly code: "VERIFICATION_EMAIL_NOT_ENABLED";
276
+ message: string;
277
+ };
278
+ EMAIL_ALREADY_VERIFIED: {
279
+ readonly code: "EMAIL_ALREADY_VERIFIED";
280
+ message: string;
281
+ };
282
+ EMAIL_MISMATCH: {
283
+ readonly code: "EMAIL_MISMATCH";
284
+ message: string;
285
+ };
286
+ SESSION_NOT_FRESH: {
287
+ readonly code: "SESSION_NOT_FRESH";
288
+ message: string;
289
+ };
290
+ LINKED_ACCOUNT_ALREADY_EXISTS: {
291
+ readonly code: "LINKED_ACCOUNT_ALREADY_EXISTS";
292
+ message: string;
293
+ };
294
+ INVALID_ORIGIN: {
295
+ readonly code: "INVALID_ORIGIN";
296
+ message: string;
297
+ };
298
+ INVALID_CALLBACK_URL: {
299
+ readonly code: "INVALID_CALLBACK_URL";
300
+ message: string;
301
+ };
302
+ INVALID_REDIRECT_URL: {
303
+ readonly code: "INVALID_REDIRECT_URL";
304
+ message: string;
305
+ };
306
+ INVALID_ERROR_CALLBACK_URL: {
307
+ readonly code: "INVALID_ERROR_CALLBACK_URL";
308
+ message: string;
309
+ };
310
+ INVALID_NEW_USER_CALLBACK_URL: {
311
+ readonly code: "INVALID_NEW_USER_CALLBACK_URL";
312
+ message: string;
313
+ };
314
+ MISSING_OR_NULL_ORIGIN: {
315
+ readonly code: "MISSING_OR_NULL_ORIGIN";
316
+ message: string;
317
+ };
318
+ CALLBACK_URL_REQUIRED: {
319
+ readonly code: "CALLBACK_URL_REQUIRED";
320
+ message: string;
321
+ };
322
+ FAILED_TO_CREATE_VERIFICATION: {
323
+ readonly code: "FAILED_TO_CREATE_VERIFICATION";
324
+ message: string;
325
+ };
326
+ FIELD_NOT_ALLOWED: {
327
+ readonly code: "FIELD_NOT_ALLOWED";
328
+ message: string;
329
+ };
330
+ ASYNC_VALIDATION_NOT_SUPPORTED: {
331
+ readonly code: "ASYNC_VALIDATION_NOT_SUPPORTED";
332
+ message: string;
333
+ };
334
+ VALIDATION_ERROR: {
335
+ readonly code: "VALIDATION_ERROR";
336
+ message: string;
337
+ };
338
+ MISSING_FIELD: {
339
+ readonly code: "MISSING_FIELD";
340
+ message: string;
341
+ };
342
+ METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED: {
343
+ readonly code: "METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED";
344
+ message: string;
345
+ };
346
+ BODY_MUST_BE_AN_OBJECT: {
347
+ readonly code: "BODY_MUST_BE_AN_OBJECT";
348
+ message: string;
349
+ };
350
+ PASSWORD_ALREADY_SET: {
351
+ readonly code: "PASSWORD_ALREADY_SET";
352
+ message: string;
353
+ };
354
+ };
355
+ };
356
+ testUser: {
357
+ id?: string | undefined;
358
+ createdAt?: Date | undefined;
359
+ updatedAt?: Date | undefined;
360
+ email: string;
361
+ emailVerified?: boolean | undefined;
362
+ name: string;
363
+ image?: string | null | undefined;
364
+ password: string;
365
+ };
366
+ signInWithTestUser: () => Promise<{
367
+ session: {
368
+ id: string;
369
+ createdAt: Date;
370
+ updatedAt: Date;
371
+ userId: string;
372
+ expiresAt: Date;
373
+ token: string;
374
+ ipAddress?: string | null | undefined;
375
+ userAgent?: string | null | undefined;
376
+ };
377
+ user: {
378
+ id: string;
379
+ createdAt: Date;
380
+ updatedAt: Date;
381
+ email: string;
382
+ emailVerified: boolean;
383
+ name: string;
384
+ image?: string | null | undefined;
385
+ };
386
+ headers: Headers;
387
+ setCookie: (name: string, value: string) => void;
388
+ runWithUser: (fn: (headers: Headers) => Promise<void>) => Promise<void>;
389
+ }>;
390
+ signInWithUser: (email: string, password: string) => Promise<{
391
+ res: {
392
+ user: {
393
+ id: string;
394
+ createdAt: Date;
395
+ updatedAt: Date;
396
+ email: string;
397
+ emailVerified: boolean;
398
+ name: string;
399
+ image?: string | null | undefined;
400
+ };
401
+ session: {
402
+ id: string;
403
+ createdAt: Date;
404
+ updatedAt: Date;
405
+ userId: string;
406
+ expiresAt: Date;
407
+ token: string;
408
+ ipAddress?: string | null | undefined;
409
+ userAgent?: string | null | undefined;
410
+ };
411
+ };
412
+ headers: Headers;
413
+ }>;
414
+ cookieSetter: typeof setCookieToHeader;
415
+ customFetchImpl: (url: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
416
+ sessionSetter: (headers: Headers) => (context: import("@better-fetch/fetch").SuccessContext) => void;
417
+ db: import("@entro314labs/entro-auth-core/db/adapter").DBAdapter<EntroAuthOptions>;
418
+ runWithUser: (email: string, password: string, fn: (headers: Headers) => import("@entro314labs/entro-auth-core").Awaitable<void>) => Promise<void>;
419
+ }>;
420
+ export {};