@effect-auth/core 0.1.0-alpha.15 → 0.1.0-alpha.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (627) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +332 -131
  3. package/dist/AbuseProtection.d.ts +100 -0
  4. package/dist/AbuseProtection.d.ts.map +1 -0
  5. package/dist/AbuseProtection.js +71 -0
  6. package/dist/AbuseProtection.js.map +1 -0
  7. package/dist/AccessGrant.d.ts +344 -0
  8. package/dist/AccessGrant.d.ts.map +1 -0
  9. package/dist/AccessGrant.js +687 -0
  10. package/dist/AccessGrant.js.map +1 -0
  11. package/dist/ApiKey.d.ts +2 -14
  12. package/dist/ApiKey.d.ts.map +1 -1
  13. package/dist/ApiKey.js +36 -27
  14. package/dist/ApiKey.js.map +1 -1
  15. package/dist/Assurance.d.ts +415 -0
  16. package/dist/Assurance.d.ts.map +1 -0
  17. package/dist/Assurance.js +764 -0
  18. package/dist/Assurance.js.map +1 -0
  19. package/dist/AtomicPlanExecutor.d.ts +28 -0
  20. package/dist/AtomicPlanExecutor.d.ts.map +1 -0
  21. package/dist/AtomicPlanExecutor.js +5 -0
  22. package/dist/AtomicPlanExecutor.js.map +1 -0
  23. package/dist/AuditLog.d.ts +2314 -52
  24. package/dist/AuditLog.d.ts.map +1 -1
  25. package/dist/AuditLog.js +511 -33
  26. package/dist/AuditLog.js.map +1 -1
  27. package/dist/AuthConfig.d.ts.map +1 -1
  28. package/dist/AuthConfig.js.map +1 -1
  29. package/dist/AuthFlow.d.ts +326 -220
  30. package/dist/AuthFlow.d.ts.map +1 -1
  31. package/dist/AuthFlow.js +611 -263
  32. package/dist/AuthFlow.js.map +1 -1
  33. package/dist/AuthKernel.d.ts +1 -1
  34. package/dist/AuthRateLimit.d.ts +96 -0
  35. package/dist/AuthRateLimit.d.ts.map +1 -0
  36. package/dist/AuthRateLimit.js +212 -0
  37. package/dist/AuthRateLimit.js.map +1 -0
  38. package/dist/Challenge.d.ts +0 -3
  39. package/dist/Challenge.d.ts.map +1 -1
  40. package/dist/Challenge.js +1 -4
  41. package/dist/Challenge.js.map +1 -1
  42. package/dist/Client.d.ts +205 -10
  43. package/dist/Client.d.ts.map +1 -1
  44. package/dist/Client.js +397 -16
  45. package/dist/Client.js.map +1 -1
  46. package/dist/CloudflareTurnstile.d.ts +28 -0
  47. package/dist/CloudflareTurnstile.d.ts.map +1 -0
  48. package/dist/CloudflareTurnstile.js +205 -0
  49. package/dist/CloudflareTurnstile.js.map +1 -0
  50. package/dist/Crypto.d.ts +0 -3
  51. package/dist/Crypto.d.ts.map +1 -1
  52. package/dist/Crypto.js +5 -7
  53. package/dist/Crypto.js.map +1 -1
  54. package/dist/DelegatedAccessStorageMigrations.d.ts +7 -0
  55. package/dist/DelegatedAccessStorageMigrations.d.ts.map +1 -0
  56. package/dist/DelegatedAccessStorageMigrations.js +159 -0
  57. package/dist/DelegatedAccessStorageMigrations.js.map +1 -0
  58. package/dist/DisposableEmailDomains.d.ts +19 -0
  59. package/dist/DisposableEmailDomains.d.ts.map +1 -0
  60. package/dist/DisposableEmailDomains.js +85 -0
  61. package/dist/DisposableEmailDomains.js.map +1 -0
  62. package/dist/DomainVerification.d.ts +0 -9
  63. package/dist/DomainVerification.d.ts.map +1 -1
  64. package/dist/DomainVerification.js +36 -22
  65. package/dist/DomainVerification.js.map +1 -1
  66. package/dist/DrizzleBunSqliteStorage.d.ts +18 -0
  67. package/dist/DrizzleBunSqliteStorage.d.ts.map +1 -0
  68. package/dist/DrizzleBunSqliteStorage.js +11 -0
  69. package/dist/DrizzleBunSqliteStorage.js.map +1 -0
  70. package/dist/DrizzleD1SqliteStorage.d.ts +28 -0
  71. package/dist/DrizzleD1SqliteStorage.d.ts.map +1 -0
  72. package/dist/DrizzleD1SqliteStorage.js +10 -0
  73. package/dist/DrizzleD1SqliteStorage.js.map +1 -0
  74. package/dist/DrizzleDurableObjectSqliteStorage.d.ts +19 -0
  75. package/dist/DrizzleDurableObjectSqliteStorage.d.ts.map +1 -0
  76. package/dist/DrizzleDurableObjectSqliteStorage.js +14 -0
  77. package/dist/DrizzleDurableObjectSqliteStorage.js.map +1 -0
  78. package/dist/DrizzleEffectSqliteStorage.d.ts +31 -0
  79. package/dist/DrizzleEffectSqliteStorage.d.ts.map +1 -0
  80. package/dist/DrizzleEffectSqliteStorage.js +108 -0
  81. package/dist/DrizzleEffectSqliteStorage.js.map +1 -0
  82. package/dist/DrizzleNodeSqliteStorage.d.ts +18 -0
  83. package/dist/DrizzleNodeSqliteStorage.d.ts.map +1 -0
  84. package/dist/DrizzleNodeSqliteStorage.js +11 -0
  85. package/dist/DrizzleNodeSqliteStorage.js.map +1 -0
  86. package/dist/DrizzleWasmSqliteStorage.d.ts +23 -0
  87. package/dist/DrizzleWasmSqliteStorage.d.ts.map +1 -0
  88. package/dist/DrizzleWasmSqliteStorage.js +15 -0
  89. package/dist/DrizzleWasmSqliteStorage.js.map +1 -0
  90. package/dist/EffectQbPostgresDelegatedAccessStorage.d.ts +34 -0
  91. package/dist/EffectQbPostgresDelegatedAccessStorage.d.ts.map +1 -0
  92. package/dist/EffectQbPostgresDelegatedAccessStorage.js +499 -0
  93. package/dist/EffectQbPostgresDelegatedAccessStorage.js.map +1 -0
  94. package/dist/EffectQbPostgresStorage.d.ts +171 -0
  95. package/dist/EffectQbPostgresStorage.d.ts.map +1 -0
  96. package/dist/EffectQbPostgresStorage.js +4280 -0
  97. package/dist/EffectQbPostgresStorage.js.map +1 -0
  98. package/dist/EffectQbSqliteDelegatedAccessStorage.d.ts +112 -0
  99. package/dist/EffectQbSqliteDelegatedAccessStorage.d.ts.map +1 -0
  100. package/dist/EffectQbSqliteDelegatedAccessStorage.js +602 -0
  101. package/dist/EffectQbSqliteDelegatedAccessStorage.js.map +1 -0
  102. package/dist/EffectQbSqliteStorage.d.ts +184 -27
  103. package/dist/EffectQbSqliteStorage.d.ts.map +1 -1
  104. package/dist/EffectQbSqliteStorage.js +1729 -135
  105. package/dist/EffectQbSqliteStorage.js.map +1 -1
  106. package/dist/EmailAuth.d.ts +65 -0
  107. package/dist/EmailAuth.d.ts.map +1 -0
  108. package/dist/EmailAuth.js +171 -0
  109. package/dist/EmailAuth.js.map +1 -0
  110. package/dist/EmailIdentityAuth.d.ts +30 -0
  111. package/dist/EmailIdentityAuth.d.ts.map +1 -0
  112. package/dist/EmailIdentityAuth.js +142 -0
  113. package/dist/EmailIdentityAuth.js.map +1 -0
  114. package/dist/EmailOtp.d.ts +10 -11
  115. package/dist/EmailOtp.d.ts.map +1 -1
  116. package/dist/EmailOtp.js +44 -81
  117. package/dist/EmailOtp.js.map +1 -1
  118. package/dist/EmailRisk.d.ts +48 -0
  119. package/dist/EmailRisk.d.ts.map +1 -0
  120. package/dist/EmailRisk.js +33 -0
  121. package/dist/EmailRisk.js.map +1 -0
  122. package/dist/EmailVerification.d.ts +10 -16
  123. package/dist/EmailVerification.d.ts.map +1 -1
  124. package/dist/EmailVerification.js +85 -42
  125. package/dist/EmailVerification.js.map +1 -1
  126. package/dist/Guard.d.ts +11 -0
  127. package/dist/Guard.d.ts.map +1 -0
  128. package/dist/Guard.js +11 -0
  129. package/dist/Guard.js.map +1 -0
  130. package/dist/HibpPwnedPasswords.d.ts +56 -0
  131. package/dist/HibpPwnedPasswords.d.ts.map +1 -0
  132. package/dist/HibpPwnedPasswords.js +232 -0
  133. package/dist/HibpPwnedPasswords.js.map +1 -0
  134. package/dist/HttpApi/AdminPermissionDefinition.d.ts +4 -0
  135. package/dist/HttpApi/AdminPermissionDefinition.d.ts.map +1 -0
  136. package/dist/HttpApi/AdminPermissionDefinition.js +4 -0
  137. package/dist/HttpApi/AdminPermissionDefinition.js.map +1 -0
  138. package/dist/HttpApi/AdminSecurityTimeline.d.ts +4 -0
  139. package/dist/HttpApi/AdminSecurityTimeline.d.ts.map +1 -0
  140. package/dist/HttpApi/AdminSecurityTimeline.js +4 -0
  141. package/dist/HttpApi/AdminSecurityTimeline.js.map +1 -0
  142. package/dist/HttpApi/AdminSession.d.ts +4 -0
  143. package/dist/HttpApi/AdminSession.d.ts.map +1 -0
  144. package/dist/HttpApi/AdminSession.js +4 -0
  145. package/dist/HttpApi/AdminSession.js.map +1 -0
  146. package/dist/HttpApi/AdminTrustedDevice.d.ts +4 -0
  147. package/dist/HttpApi/AdminTrustedDevice.d.ts.map +1 -0
  148. package/dist/HttpApi/AdminTrustedDevice.js +4 -0
  149. package/dist/HttpApi/AdminTrustedDevice.js.map +1 -0
  150. package/dist/HttpApi/Api.d.ts +1172 -1172
  151. package/dist/HttpApi/Api.d.ts.map +1 -1
  152. package/dist/HttpApi/Api.js +2160 -896
  153. package/dist/HttpApi/Api.js.map +1 -1
  154. package/dist/HttpApi/ApiKey.d.ts +4 -0
  155. package/dist/HttpApi/ApiKey.d.ts.map +1 -0
  156. package/dist/HttpApi/ApiKey.js +4 -0
  157. package/dist/HttpApi/ApiKey.js.map +1 -0
  158. package/dist/HttpApi/Audit.d.ts +6 -0
  159. package/dist/HttpApi/Audit.d.ts.map +1 -0
  160. package/dist/HttpApi/Audit.js +10 -0
  161. package/dist/HttpApi/Audit.js.map +1 -0
  162. package/dist/HttpApi/ClientApi.d.ts +917 -0
  163. package/dist/HttpApi/ClientApi.d.ts.map +1 -0
  164. package/dist/HttpApi/ClientApi.js +101 -0
  165. package/dist/HttpApi/ClientApi.js.map +1 -0
  166. package/dist/HttpApi/EmailAuth.d.ts +6 -0
  167. package/dist/HttpApi/EmailAuth.d.ts.map +1 -0
  168. package/dist/HttpApi/EmailAuth.js +6 -0
  169. package/dist/HttpApi/EmailAuth.js.map +1 -0
  170. package/dist/HttpApi/EmailGuards.d.ts +115 -0
  171. package/dist/HttpApi/EmailGuards.d.ts.map +1 -0
  172. package/dist/HttpApi/EmailGuards.js +191 -0
  173. package/dist/HttpApi/EmailGuards.js.map +1 -0
  174. package/dist/HttpApi/EmailOtp.d.ts +6 -0
  175. package/dist/HttpApi/EmailOtp.d.ts.map +1 -0
  176. package/dist/HttpApi/EmailOtp.js +6 -0
  177. package/dist/HttpApi/EmailOtp.js.map +1 -0
  178. package/dist/HttpApi/EmailVerification.d.ts +6 -0
  179. package/dist/HttpApi/EmailVerification.d.ts.map +1 -0
  180. package/dist/HttpApi/EmailVerification.js +6 -0
  181. package/dist/HttpApi/EmailVerification.js.map +1 -0
  182. package/dist/HttpApi/Endpoints.d.ts +629 -301
  183. package/dist/HttpApi/Endpoints.d.ts.map +1 -1
  184. package/dist/HttpApi/Endpoints.js +178 -120
  185. package/dist/HttpApi/Endpoints.js.map +1 -1
  186. package/dist/HttpApi/Errors.d.ts +26 -7
  187. package/dist/HttpApi/Errors.d.ts.map +1 -1
  188. package/dist/HttpApi/Errors.js +26 -4
  189. package/dist/HttpApi/Errors.js.map +1 -1
  190. package/dist/HttpApi/Identity.d.ts +6 -0
  191. package/dist/HttpApi/Identity.d.ts.map +1 -0
  192. package/dist/HttpApi/Identity.js +6 -0
  193. package/dist/HttpApi/Identity.js.map +1 -0
  194. package/dist/HttpApi/IdentityGuards.d.ts +31 -0
  195. package/dist/HttpApi/IdentityGuards.d.ts.map +1 -0
  196. package/dist/HttpApi/IdentityGuards.js +33 -0
  197. package/dist/HttpApi/IdentityGuards.js.map +1 -0
  198. package/dist/HttpApi/Jwt.d.ts +4 -0
  199. package/dist/HttpApi/Jwt.d.ts.map +1 -0
  200. package/dist/HttpApi/Jwt.js +4 -0
  201. package/dist/HttpApi/Jwt.js.map +1 -0
  202. package/dist/HttpApi/JwtDiscovery.d.ts +4 -0
  203. package/dist/HttpApi/JwtDiscovery.d.ts.map +1 -0
  204. package/dist/HttpApi/JwtDiscovery.js +4 -0
  205. package/dist/HttpApi/JwtDiscovery.js.map +1 -0
  206. package/dist/HttpApi/LoginApproval.d.ts +5 -0
  207. package/dist/HttpApi/LoginApproval.d.ts.map +1 -0
  208. package/dist/HttpApi/LoginApproval.js +5 -0
  209. package/dist/HttpApi/LoginApproval.js.map +1 -0
  210. package/dist/HttpApi/LoginNotification.d.ts +5 -0
  211. package/dist/HttpApi/LoginNotification.d.ts.map +1 -0
  212. package/dist/HttpApi/LoginNotification.js +5 -0
  213. package/dist/HttpApi/LoginNotification.js.map +1 -0
  214. package/dist/HttpApi/MagicLink.d.ts +6 -0
  215. package/dist/HttpApi/MagicLink.d.ts.map +1 -0
  216. package/dist/HttpApi/MagicLink.js +6 -0
  217. package/dist/HttpApi/MagicLink.js.map +1 -0
  218. package/dist/HttpApi/Mfa.d.ts +5 -0
  219. package/dist/HttpApi/Mfa.d.ts.map +1 -0
  220. package/dist/HttpApi/Mfa.js +5 -0
  221. package/dist/HttpApi/Mfa.js.map +1 -0
  222. package/dist/HttpApi/Middleware.d.ts +14 -0
  223. package/dist/HttpApi/Middleware.d.ts.map +1 -0
  224. package/dist/HttpApi/Middleware.js +5 -0
  225. package/dist/HttpApi/Middleware.js.map +1 -0
  226. package/dist/HttpApi/OAuth.d.ts +4 -0
  227. package/dist/HttpApi/OAuth.d.ts.map +1 -0
  228. package/dist/HttpApi/OAuth.js +4 -0
  229. package/dist/HttpApi/OAuth.js.map +1 -0
  230. package/dist/HttpApi/OAuthProviderAuthorization.d.ts +4 -0
  231. package/dist/HttpApi/OAuthProviderAuthorization.d.ts.map +1 -0
  232. package/dist/HttpApi/OAuthProviderAuthorization.js +4 -0
  233. package/dist/HttpApi/OAuthProviderAuthorization.js.map +1 -0
  234. package/dist/HttpApi/OAuthToken.d.ts +4 -0
  235. package/dist/HttpApi/OAuthToken.d.ts.map +1 -0
  236. package/dist/HttpApi/OAuthToken.js +4 -0
  237. package/dist/HttpApi/OAuthToken.js.map +1 -0
  238. package/dist/HttpApi/OidcDiscovery.d.ts +4 -0
  239. package/dist/HttpApi/OidcDiscovery.d.ts.map +1 -0
  240. package/dist/HttpApi/OidcDiscovery.js +4 -0
  241. package/dist/HttpApi/OidcDiscovery.js.map +1 -0
  242. package/dist/HttpApi/Operations/AdminPermissionDefinition.d.ts +28 -0
  243. package/dist/HttpApi/Operations/AdminPermissionDefinition.d.ts.map +1 -0
  244. package/dist/HttpApi/Operations/AdminPermissionDefinition.js +5 -0
  245. package/dist/HttpApi/Operations/AdminPermissionDefinition.js.map +1 -0
  246. package/dist/HttpApi/Operations/AdminSession.d.ts +16 -0
  247. package/dist/HttpApi/Operations/AdminSession.d.ts.map +1 -0
  248. package/dist/HttpApi/Operations/AdminSession.js +5 -0
  249. package/dist/HttpApi/Operations/AdminSession.js.map +1 -0
  250. package/dist/HttpApi/Operations/ApiKey.d.ts +16 -0
  251. package/dist/HttpApi/Operations/ApiKey.d.ts.map +1 -0
  252. package/dist/HttpApi/Operations/ApiKey.js +5 -0
  253. package/dist/HttpApi/Operations/ApiKey.js.map +1 -0
  254. package/dist/HttpApi/Operations/Discovery.d.ts +19 -0
  255. package/dist/HttpApi/Operations/Discovery.d.ts.map +1 -0
  256. package/dist/HttpApi/Operations/Discovery.js +7 -0
  257. package/dist/HttpApi/Operations/Discovery.js.map +1 -0
  258. package/dist/HttpApi/Operations/EmailAuth.d.ts +12 -0
  259. package/dist/HttpApi/Operations/EmailAuth.d.ts.map +1 -0
  260. package/dist/HttpApi/Operations/EmailAuth.js +5 -0
  261. package/dist/HttpApi/Operations/EmailAuth.js.map +1 -0
  262. package/dist/HttpApi/Operations/EmailOtp.d.ts +14 -0
  263. package/dist/HttpApi/Operations/EmailOtp.d.ts.map +1 -0
  264. package/dist/HttpApi/Operations/EmailOtp.js +5 -0
  265. package/dist/HttpApi/Operations/EmailOtp.js.map +1 -0
  266. package/dist/HttpApi/Operations/EmailVerification.d.ts +14 -0
  267. package/dist/HttpApi/Operations/EmailVerification.d.ts.map +1 -0
  268. package/dist/HttpApi/Operations/EmailVerification.js +5 -0
  269. package/dist/HttpApi/Operations/EmailVerification.js.map +1 -0
  270. package/dist/HttpApi/Operations/HttpOperation.d.ts +4 -0
  271. package/dist/HttpApi/Operations/HttpOperation.d.ts.map +1 -0
  272. package/dist/HttpApi/Operations/HttpOperation.js +2 -0
  273. package/dist/HttpApi/Operations/HttpOperation.js.map +1 -0
  274. package/dist/HttpApi/Operations/Identity.d.ts +22 -0
  275. package/dist/HttpApi/Operations/Identity.d.ts.map +1 -0
  276. package/dist/HttpApi/Operations/Identity.js +5 -0
  277. package/dist/HttpApi/Operations/Identity.js.map +1 -0
  278. package/dist/HttpApi/Operations/Jwt.d.ts +14 -0
  279. package/dist/HttpApi/Operations/Jwt.d.ts.map +1 -0
  280. package/dist/HttpApi/Operations/Jwt.js +5 -0
  281. package/dist/HttpApi/Operations/Jwt.js.map +1 -0
  282. package/dist/HttpApi/Operations/LoginApproval.d.ts +16 -0
  283. package/dist/HttpApi/Operations/LoginApproval.d.ts.map +1 -0
  284. package/dist/HttpApi/Operations/LoginApproval.js +5 -0
  285. package/dist/HttpApi/Operations/LoginApproval.js.map +1 -0
  286. package/dist/HttpApi/Operations/MagicLink.d.ts +14 -0
  287. package/dist/HttpApi/Operations/MagicLink.d.ts.map +1 -0
  288. package/dist/HttpApi/Operations/MagicLink.js +5 -0
  289. package/dist/HttpApi/Operations/MagicLink.js.map +1 -0
  290. package/dist/HttpApi/Operations/Mfa.d.ts +24 -0
  291. package/dist/HttpApi/Operations/Mfa.d.ts.map +1 -0
  292. package/dist/HttpApi/Operations/Mfa.js +5 -0
  293. package/dist/HttpApi/Operations/Mfa.js.map +1 -0
  294. package/dist/HttpApi/Operations/OAuth.d.ts +20 -0
  295. package/dist/HttpApi/Operations/OAuth.d.ts.map +1 -0
  296. package/dist/HttpApi/Operations/OAuth.js +5 -0
  297. package/dist/HttpApi/Operations/OAuth.js.map +1 -0
  298. package/dist/HttpApi/Operations/OAuthProviderAuthorization.d.ts +12 -0
  299. package/dist/HttpApi/Operations/OAuthProviderAuthorization.d.ts.map +1 -0
  300. package/dist/HttpApi/Operations/OAuthProviderAuthorization.js +5 -0
  301. package/dist/HttpApi/Operations/OAuthProviderAuthorization.js.map +1 -0
  302. package/dist/HttpApi/Operations/OAuthToken.d.ts +16 -0
  303. package/dist/HttpApi/Operations/OAuthToken.d.ts.map +1 -0
  304. package/dist/HttpApi/Operations/OAuthToken.js +5 -0
  305. package/dist/HttpApi/Operations/OAuthToken.js.map +1 -0
  306. package/dist/HttpApi/Operations/Passkey.d.ts +22 -0
  307. package/dist/HttpApi/Operations/Passkey.d.ts.map +1 -0
  308. package/dist/HttpApi/Operations/Passkey.js +5 -0
  309. package/dist/HttpApi/Operations/Passkey.js.map +1 -0
  310. package/dist/HttpApi/Operations/Password.d.ts +22 -0
  311. package/dist/HttpApi/Operations/Password.d.ts.map +1 -0
  312. package/dist/HttpApi/Operations/Password.js +5 -0
  313. package/dist/HttpApi/Operations/Password.js.map +1 -0
  314. package/dist/HttpApi/Operations/RecoveryCodes.d.ts +20 -0
  315. package/dist/HttpApi/Operations/RecoveryCodes.d.ts.map +1 -0
  316. package/dist/HttpApi/Operations/RecoveryCodes.js +5 -0
  317. package/dist/HttpApi/Operations/RecoveryCodes.js.map +1 -0
  318. package/dist/HttpApi/Operations/RefreshToken.d.ts +12 -0
  319. package/dist/HttpApi/Operations/RefreshToken.d.ts.map +1 -0
  320. package/dist/HttpApi/Operations/RefreshToken.js +5 -0
  321. package/dist/HttpApi/Operations/RefreshToken.js.map +1 -0
  322. package/dist/HttpApi/Operations/Security.d.ts +12 -0
  323. package/dist/HttpApi/Operations/Security.d.ts.map +1 -0
  324. package/dist/HttpApi/Operations/Security.js +5 -0
  325. package/dist/HttpApi/Operations/Security.js.map +1 -0
  326. package/dist/HttpApi/Operations/SecurityTimeline.d.ts +19 -0
  327. package/dist/HttpApi/Operations/SecurityTimeline.d.ts.map +1 -0
  328. package/dist/HttpApi/Operations/SecurityTimeline.js +7 -0
  329. package/dist/HttpApi/Operations/SecurityTimeline.js.map +1 -0
  330. package/dist/HttpApi/Operations/Session.d.ts +22 -0
  331. package/dist/HttpApi/Operations/Session.d.ts.map +1 -0
  332. package/dist/HttpApi/Operations/Session.js +5 -0
  333. package/dist/HttpApi/Operations/Session.js.map +1 -0
  334. package/dist/HttpApi/Operations/StepUp.d.ts +22 -0
  335. package/dist/HttpApi/Operations/StepUp.d.ts.map +1 -0
  336. package/dist/HttpApi/Operations/StepUp.js +5 -0
  337. package/dist/HttpApi/Operations/StepUp.js.map +1 -0
  338. package/dist/HttpApi/Operations/Totp.d.ts +20 -0
  339. package/dist/HttpApi/Operations/Totp.d.ts.map +1 -0
  340. package/dist/HttpApi/Operations/Totp.js +5 -0
  341. package/dist/HttpApi/Operations/Totp.js.map +1 -0
  342. package/dist/HttpApi/Operations/TrustedDevice.d.ts +23 -0
  343. package/dist/HttpApi/Operations/TrustedDevice.d.ts.map +1 -0
  344. package/dist/HttpApi/Operations/TrustedDevice.js +7 -0
  345. package/dist/HttpApi/Operations/TrustedDevice.js.map +1 -0
  346. package/dist/HttpApi/Operations/index.d.ts +27 -0
  347. package/dist/HttpApi/Operations/index.d.ts.map +1 -0
  348. package/dist/HttpApi/Operations/index.js +27 -0
  349. package/dist/HttpApi/Operations/index.js.map +1 -0
  350. package/dist/HttpApi/Passkey.d.ts +5 -0
  351. package/dist/HttpApi/Passkey.d.ts.map +1 -0
  352. package/dist/HttpApi/Passkey.js +5 -0
  353. package/dist/HttpApi/Passkey.js.map +1 -0
  354. package/dist/HttpApi/Password.d.ts +220 -0
  355. package/dist/HttpApi/Password.d.ts.map +1 -0
  356. package/dist/HttpApi/Password.js +237 -0
  357. package/dist/HttpApi/Password.js.map +1 -0
  358. package/dist/HttpApi/PasswordContract.d.ts +307 -0
  359. package/dist/HttpApi/PasswordContract.d.ts.map +1 -0
  360. package/dist/HttpApi/PasswordContract.js +63 -0
  361. package/dist/HttpApi/PasswordContract.js.map +1 -0
  362. package/dist/HttpApi/PasswordGuards.d.ts +82 -0
  363. package/dist/HttpApi/PasswordGuards.d.ts.map +1 -0
  364. package/dist/HttpApi/PasswordGuards.js +179 -0
  365. package/dist/HttpApi/PasswordGuards.js.map +1 -0
  366. package/dist/HttpApi/RecoveryCodes.d.ts +5 -0
  367. package/dist/HttpApi/RecoveryCodes.d.ts.map +1 -0
  368. package/dist/HttpApi/RecoveryCodes.js +5 -0
  369. package/dist/HttpApi/RecoveryCodes.js.map +1 -0
  370. package/dist/HttpApi/RefreshToken.d.ts +4 -0
  371. package/dist/HttpApi/RefreshToken.d.ts.map +1 -0
  372. package/dist/HttpApi/RefreshToken.js +4 -0
  373. package/dist/HttpApi/RefreshToken.js.map +1 -0
  374. package/dist/HttpApi/RequestGuards.d.ts +42 -0
  375. package/dist/HttpApi/RequestGuards.d.ts.map +1 -0
  376. package/dist/HttpApi/RequestGuards.js +194 -0
  377. package/dist/HttpApi/RequestGuards.js.map +1 -0
  378. package/dist/HttpApi/Schemas.d.ts +361 -84
  379. package/dist/HttpApi/Schemas.d.ts.map +1 -1
  380. package/dist/HttpApi/Schemas.js +190 -27
  381. package/dist/HttpApi/Schemas.js.map +1 -1
  382. package/dist/HttpApi/Security.d.ts +12 -93
  383. package/dist/HttpApi/Security.d.ts.map +1 -1
  384. package/dist/HttpApi/Security.js +65 -356
  385. package/dist/HttpApi/Security.js.map +1 -1
  386. package/dist/HttpApi/SecurityTimeline.d.ts +4 -0
  387. package/dist/HttpApi/SecurityTimeline.d.ts.map +1 -0
  388. package/dist/HttpApi/SecurityTimeline.js +4 -0
  389. package/dist/HttpApi/SecurityTimeline.js.map +1 -0
  390. package/dist/HttpApi/Session.d.ts +5 -0
  391. package/dist/HttpApi/Session.d.ts.map +1 -0
  392. package/dist/HttpApi/Session.js +5 -0
  393. package/dist/HttpApi/Session.js.map +1 -0
  394. package/dist/HttpApi/SessionGuards.d.ts +15 -0
  395. package/dist/HttpApi/SessionGuards.d.ts.map +1 -0
  396. package/dist/HttpApi/SessionGuards.js +37 -0
  397. package/dist/HttpApi/SessionGuards.js.map +1 -0
  398. package/dist/HttpApi/StepUp.d.ts +5 -0
  399. package/dist/HttpApi/StepUp.d.ts.map +1 -0
  400. package/dist/HttpApi/StepUp.js +5 -0
  401. package/dist/HttpApi/StepUp.js.map +1 -0
  402. package/dist/HttpApi/Totp.d.ts +5 -0
  403. package/dist/HttpApi/Totp.d.ts.map +1 -0
  404. package/dist/HttpApi/Totp.js +5 -0
  405. package/dist/HttpApi/Totp.js.map +1 -0
  406. package/dist/HttpApi/Transport.d.ts +4 -6
  407. package/dist/HttpApi/Transport.d.ts.map +1 -1
  408. package/dist/HttpApi/Transport.js +62 -36
  409. package/dist/HttpApi/Transport.js.map +1 -1
  410. package/dist/HttpApi/TrustedDevice.d.ts +4 -0
  411. package/dist/HttpApi/TrustedDevice.d.ts.map +1 -0
  412. package/dist/HttpApi/TrustedDevice.js +4 -0
  413. package/dist/HttpApi/TrustedDevice.js.map +1 -0
  414. package/dist/HttpApi/index.d.ts +9 -3
  415. package/dist/HttpApi/index.d.ts.map +1 -1
  416. package/dist/HttpApi/index.js +8 -2
  417. package/dist/HttpApi/index.js.map +1 -1
  418. package/dist/Identity.d.ts +138 -0
  419. package/dist/Identity.d.ts.map +1 -0
  420. package/dist/Identity.js +105 -0
  421. package/dist/Identity.js.map +1 -0
  422. package/dist/IdentityManagement.d.ts +189 -0
  423. package/dist/IdentityManagement.d.ts.map +1 -0
  424. package/dist/IdentityManagement.js +317 -0
  425. package/dist/IdentityManagement.js.map +1 -0
  426. package/dist/IncidentAction.d.ts +1 -4
  427. package/dist/IncidentAction.d.ts.map +1 -1
  428. package/dist/IncidentAction.js +15 -9
  429. package/dist/IncidentAction.js.map +1 -1
  430. package/dist/Internal.d.ts +2 -0
  431. package/dist/Internal.d.ts.map +1 -1
  432. package/dist/Internal.js +30 -0
  433. package/dist/Internal.js.map +1 -1
  434. package/dist/Invitation.d.ts +362 -0
  435. package/dist/Invitation.d.ts.map +1 -0
  436. package/dist/Invitation.js +633 -0
  437. package/dist/Invitation.js.map +1 -0
  438. package/dist/IpQualityScore.d.ts +38 -0
  439. package/dist/IpQualityScore.d.ts.map +1 -0
  440. package/dist/IpQualityScore.js +215 -0
  441. package/dist/IpQualityScore.js.map +1 -0
  442. package/dist/Jwt.d.ts +9 -30
  443. package/dist/Jwt.d.ts.map +1 -1
  444. package/dist/Jwt.js +72 -60
  445. package/dist/Jwt.js.map +1 -1
  446. package/dist/LoginApproval.d.ts +16 -31
  447. package/dist/LoginApproval.d.ts.map +1 -1
  448. package/dist/LoginApproval.js +47 -41
  449. package/dist/LoginApproval.js.map +1 -1
  450. package/dist/LoginNotification.d.ts +8 -12
  451. package/dist/LoginNotification.d.ts.map +1 -1
  452. package/dist/LoginNotification.js +30 -17
  453. package/dist/LoginNotification.js.map +1 -1
  454. package/dist/LoginRisk.d.ts +11 -13
  455. package/dist/LoginRisk.d.ts.map +1 -1
  456. package/dist/LoginRisk.js +66 -26
  457. package/dist/LoginRisk.js.map +1 -1
  458. package/dist/LoginRiskEnrichment.d.ts +145 -0
  459. package/dist/LoginRiskEnrichment.d.ts.map +1 -0
  460. package/dist/LoginRiskEnrichment.js +220 -0
  461. package/dist/LoginRiskEnrichment.js.map +1 -0
  462. package/dist/MachineAuth.d.ts.map +1 -1
  463. package/dist/MachineAuth.js.map +1 -1
  464. package/dist/MagicLink.d.ts +9 -8
  465. package/dist/MagicLink.d.ts.map +1 -1
  466. package/dist/MagicLink.js +40 -73
  467. package/dist/MagicLink.js.map +1 -1
  468. package/dist/Mailer.d.ts +20 -13
  469. package/dist/Mailer.d.ts.map +1 -1
  470. package/dist/Mailer.js +10 -12
  471. package/dist/Mailer.js.map +1 -1
  472. package/dist/OAuth.d.ts +100 -103
  473. package/dist/OAuth.d.ts.map +1 -1
  474. package/dist/OAuth.js +404 -217
  475. package/dist/OAuth.js.map +1 -1
  476. package/dist/Passkey.d.ts +17 -19
  477. package/dist/Passkey.d.ts.map +1 -1
  478. package/dist/Passkey.js +86 -39
  479. package/dist/Passkey.js.map +1 -1
  480. package/dist/PasskeyBrowser.d.ts +39 -0
  481. package/dist/PasskeyBrowser.d.ts.map +1 -0
  482. package/dist/PasskeyBrowser.js +206 -0
  483. package/dist/PasskeyBrowser.js.map +1 -0
  484. package/dist/PasskeySimpleWebAuthn.d.ts.map +1 -1
  485. package/dist/PasskeySimpleWebAuthn.js +19 -7
  486. package/dist/PasskeySimpleWebAuthn.js.map +1 -1
  487. package/dist/Password.d.ts +71 -37
  488. package/dist/Password.d.ts.map +1 -1
  489. package/dist/Password.js +296 -82
  490. package/dist/Password.js.map +1 -1
  491. package/dist/PasswordRisk.d.ts +63 -0
  492. package/dist/PasswordRisk.d.ts.map +1 -0
  493. package/dist/PasswordRisk.js +37 -0
  494. package/dist/PasswordRisk.js.map +1 -0
  495. package/dist/Permission.d.ts +308 -0
  496. package/dist/Permission.d.ts.map +1 -0
  497. package/dist/Permission.js +827 -0
  498. package/dist/Permission.js.map +1 -0
  499. package/dist/Policy.d.ts +31 -18
  500. package/dist/Policy.d.ts.map +1 -1
  501. package/dist/Policy.js +58 -14
  502. package/dist/Policy.js.map +1 -1
  503. package/dist/PostgresDelegatedAccessStorageMigrations.d.ts +7 -0
  504. package/dist/PostgresDelegatedAccessStorageMigrations.d.ts.map +1 -0
  505. package/dist/PostgresDelegatedAccessStorageMigrations.js +119 -0
  506. package/dist/PostgresDelegatedAccessStorageMigrations.js.map +1 -0
  507. package/dist/PostgresStorageMigrations.d.ts +15 -0
  508. package/dist/PostgresStorageMigrations.d.ts.map +1 -0
  509. package/dist/PostgresStorageMigrations.js +620 -0
  510. package/dist/PostgresStorageMigrations.js.map +1 -0
  511. package/dist/Privacy.d.ts +0 -3
  512. package/dist/Privacy.d.ts.map +1 -1
  513. package/dist/Privacy.js +2 -5
  514. package/dist/Privacy.js.map +1 -1
  515. package/dist/RateLimiter.d.ts +0 -3
  516. package/dist/RateLimiter.d.ts.map +1 -1
  517. package/dist/RateLimiter.js +1 -4
  518. package/dist/RateLimiter.js.map +1 -1
  519. package/dist/RecoveryCode.d.ts +84 -12
  520. package/dist/RecoveryCode.d.ts.map +1 -1
  521. package/dist/RecoveryCode.js +273 -75
  522. package/dist/RecoveryCode.js.map +1 -1
  523. package/dist/RecoveryPolicy.d.ts +81 -0
  524. package/dist/RecoveryPolicy.d.ts.map +1 -0
  525. package/dist/RecoveryPolicy.js +119 -0
  526. package/dist/RecoveryPolicy.js.map +1 -0
  527. package/dist/RefreshToken.d.ts +1 -10
  528. package/dist/RefreshToken.d.ts.map +1 -1
  529. package/dist/RefreshToken.js +31 -22
  530. package/dist/RefreshToken.js.map +1 -1
  531. package/dist/Retention.d.ts.map +1 -1
  532. package/dist/Retention.js.map +1 -1
  533. package/dist/SecurityTimeline.d.ts +1 -4
  534. package/dist/SecurityTimeline.d.ts.map +1 -1
  535. package/dist/SecurityTimeline.js +110 -17
  536. package/dist/SecurityTimeline.js.map +1 -1
  537. package/dist/Sessions.d.ts +124 -29
  538. package/dist/Sessions.d.ts.map +1 -1
  539. package/dist/Sessions.js +626 -94
  540. package/dist/Sessions.js.map +1 -1
  541. package/dist/StepUp.d.ts +132 -11
  542. package/dist/StepUp.d.ts.map +1 -1
  543. package/dist/StepUp.js +387 -19
  544. package/dist/StepUp.js.map +1 -1
  545. package/dist/Storage.d.ts +89 -23
  546. package/dist/Storage.d.ts.map +1 -1
  547. package/dist/Storage.js +10 -12
  548. package/dist/Storage.js.map +1 -1
  549. package/dist/StorageMigrations.d.ts +6 -1
  550. package/dist/StorageMigrations.d.ts.map +1 -1
  551. package/dist/StorageMigrations.js +224 -0
  552. package/dist/StorageMigrations.js.map +1 -1
  553. package/dist/StorageSchemaGenerator.d.ts +486 -0
  554. package/dist/StorageSchemaGenerator.d.ts.map +1 -0
  555. package/dist/StorageSchemaGenerator.js +1022 -0
  556. package/dist/StorageSchemaGenerator.js.map +1 -0
  557. package/dist/StrongFactor.d.ts +64 -0
  558. package/dist/StrongFactor.d.ts.map +1 -0
  559. package/dist/StrongFactor.js +100 -0
  560. package/dist/StrongFactor.js.map +1 -0
  561. package/dist/Testing.d.ts +1 -1
  562. package/dist/Testing.js +2 -2
  563. package/dist/Testing.js.map +1 -1
  564. package/dist/Totp.d.ts +88 -13
  565. package/dist/Totp.d.ts.map +1 -1
  566. package/dist/Totp.js +194 -36
  567. package/dist/Totp.js.map +1 -1
  568. package/dist/TrustedDevice.d.ts +0 -9
  569. package/dist/TrustedDevice.d.ts.map +1 -1
  570. package/dist/TrustedDevice.js +15 -17
  571. package/dist/TrustedDevice.js.map +1 -1
  572. package/dist/WaitUntil.d.ts +0 -3
  573. package/dist/WaitUntil.d.ts.map +1 -1
  574. package/dist/WaitUntil.js +1 -4
  575. package/dist/WaitUntil.js.map +1 -1
  576. package/dist/Webhook.d.ts +42 -12
  577. package/dist/Webhook.d.ts.map +1 -1
  578. package/dist/Webhook.js +165 -26
  579. package/dist/Webhook.js.map +1 -1
  580. package/dist/alchemy/cloudflare/Email.d.ts +4 -4
  581. package/dist/alchemy/cloudflare/Email.d.ts.map +1 -1
  582. package/dist/alchemy/cloudflare/Email.js +10 -5
  583. package/dist/alchemy/cloudflare/Email.js.map +1 -1
  584. package/dist/alchemy/cloudflare/RateLimitDurableObject.d.ts +4 -4
  585. package/dist/alchemy/cloudflare/RateLimitDurableObject.d.ts.map +1 -1
  586. package/dist/alchemy/cloudflare/RateLimitDurableObject.js +5 -4
  587. package/dist/alchemy/cloudflare/RateLimitDurableObject.js.map +1 -1
  588. package/dist/cloudflare/Email.d.ts.map +1 -1
  589. package/dist/cloudflare/Email.js +1 -1
  590. package/dist/cloudflare/Email.js.map +1 -1
  591. package/dist/cloudflare/RateLimitDurableObject.d.ts +6 -5
  592. package/dist/cloudflare/RateLimitDurableObject.d.ts.map +1 -1
  593. package/dist/cloudflare/RateLimitDurableObject.js.map +1 -1
  594. package/dist/cloudflare/RequestMetadata.d.ts +49 -0
  595. package/dist/cloudflare/RequestMetadata.d.ts.map +1 -0
  596. package/dist/cloudflare/RequestMetadata.js +71 -0
  597. package/dist/cloudflare/RequestMetadata.js.map +1 -0
  598. package/dist/index.d.ts +0 -35
  599. package/dist/index.d.ts.map +1 -1
  600. package/dist/index.js +0 -35
  601. package/dist/index.js.map +1 -1
  602. package/dist/internal/AuthFlowFinalizer.d.ts +31 -0
  603. package/dist/internal/AuthFlowFinalizer.d.ts.map +1 -0
  604. package/dist/internal/AuthFlowFinalizer.js +182 -0
  605. package/dist/internal/AuthFlowFinalizer.js.map +1 -0
  606. package/dist/internal/RateLimitDurableObject.d.ts.map +1 -1
  607. package/dist/internal/RateLimitDurableObject.js +3 -0
  608. package/dist/internal/RateLimitDurableObject.js.map +1 -1
  609. package/migrations/0001_auth_storage.sql +1 -0
  610. package/migrations/0006_auth_totp_factor.sql +1 -0
  611. package/migrations/0024_auth_permission.sql +39 -0
  612. package/migrations/0025_auth_permission_definition.sql +19 -0
  613. package/migrations/0026_auth_user_identity.sql +59 -0
  614. package/migrations/0027_auth_audit_log_storage_order.sql +46 -0
  615. package/migrations/0028_auth_oauth_client_secret_key.sql +39 -0
  616. package/migrations/delegated-access/0001_auth_delegated_access.sql +152 -0
  617. package/migrations/postgres/0001_auth_core.sql +77 -0
  618. package/migrations/postgres/0002_auth_security_oauth.sql +65 -0
  619. package/migrations/postgres/0003_auth_credentials_tokens.sql +43 -0
  620. package/migrations/postgres/0004_auth_security_history.sql +103 -0
  621. package/migrations/postgres/0005_auth_webhooks.sql +29 -0
  622. package/migrations/postgres/0006_auth_domain_timeline.sql +50 -0
  623. package/migrations/postgres/0007_auth_oauth_clients.sql +85 -0
  624. package/migrations/postgres/0008_auth_oauth_tokens.sql +63 -0
  625. package/migrations/postgres/0009_auth_permissions.sql +66 -0
  626. package/migrations/postgres/delegated-access/0001_auth_delegated_access.sql +112 -0
  627. package/package.json +309 -2
package/README.md CHANGED
@@ -6,44 +6,72 @@ The current alpha surface is primitive-first: service contracts, small helpers,
6
6
 
7
7
  ## Public API Surface
8
8
 
9
- The root import is the stable alpha primitive surface:
9
+ The root entry is metadata-only:
10
10
 
11
11
  ```ts
12
- import { PasswordLogin, Sessions, UserId } from "@effect-auth/core";
12
+ import { packageName } from "@effect-auth/core";
13
13
  ```
14
14
 
15
- Root exports are runtime-neutral auth primitives, service contracts, factory functions, reference layers, identifiers, storage ports, and policy helpers. They should not require framework, database, Cloudflare, Alchemy, SimpleWebAuthn, or test-only dependencies.
15
+ Import every auth primitive, service, layer, identifier, and integration from its named public subpath:
16
16
 
17
- Primitive module subpaths mirror the root surface for focused imports and are also stable alpha API. Examples include `@effect-auth/core/Password`, `@effect-auth/core/Sessions`, `@effect-auth/core/OAuth`, `@effect-auth/core/Jwt`, `@effect-auth/core/ApiKey`, `@effect-auth/core/Storage`, and `@effect-auth/core/StorageMigrations`.
17
+ ```ts
18
+ import { UserId } from "@effect-auth/core/Identifiers";
19
+ import { PasswordLogin } from "@effect-auth/core/Password";
20
+ import { Sessions } from "@effect-auth/core/Sessions";
21
+ ```
22
+
23
+ Runtime-neutral primitive subpaths are stable alpha API. Examples include `@effect-auth/core/Password`, `@effect-auth/core/Sessions`, `@effect-auth/core/OAuth`, `@effect-auth/core/Jwt`, `@effect-auth/core/ApiKey`, `@effect-auth/core/Storage`, and `@effect-auth/core/RateLimiter`.
24
+
25
+ Utility subpaths are stable alpha APIs:
26
+
27
+ ```txt
28
+ @effect-auth/core/StorageMigrations
29
+ ```
18
30
 
19
31
  Integration subpaths are public but opt-in. They may expose runtime-specific or transport-specific types and require the app to install their adapter packages when used:
20
32
 
21
33
  ```txt
22
34
  @effect-auth/core/Client
23
35
  @effect-auth/core/HttpApi
24
- @effect-auth/core/EffectQbSqliteStorage
25
- @effect-auth/core/RateLimiter
36
+ @effect-auth/core/PasskeyBrowser
26
37
  ```
27
38
 
28
- Adapter subpaths are public alpha adapters. Their names may still be normalized before beta:
39
+ Storage and runtime adapter subpaths are public alpha adapters. Their names may still be normalized before beta:
29
40
 
30
41
  ```txt
42
+ @effect-auth/core/EffectQbSqliteStorage
43
+ @effect-auth/core/DrizzleEffectSqliteStorage
44
+ @effect-auth/core/DrizzleD1SqliteStorage
45
+ @effect-auth/core/DrizzleBunSqliteStorage
46
+ @effect-auth/core/DrizzleNodeSqliteStorage
47
+ @effect-auth/core/DrizzleDurableObjectSqliteStorage
48
+ @effect-auth/core/DrizzleWasmSqliteStorage
31
49
  @effect-auth/core/CloudflareEmail
50
+ @effect-auth/core/CloudflareRequestMetadata
32
51
  @effect-auth/core/CloudflareRateLimitDurableObject
33
52
  @effect-auth/core/AlchemyCloudflareEmail
34
53
  @effect-auth/core/AlchemyCloudflareRateLimitDurableObject
35
54
  @effect-auth/core/PasskeySimpleWebAuthn
55
+ @effect-auth/core/StorageSchemaGenerator
36
56
  ```
37
57
 
38
58
  `@effect-auth/core/Testing` is test/dev-only API. Do not wire it into production applications.
39
59
 
40
- SQL migrations are packaged as files for copy/read workflows, but the supported TypeScript API is `@effect-auth/core/StorageMigrations` and `authStorageMigrations`. Raw SQL files are not importable package subpaths.
60
+ SQL migrations are packaged as files for copy/read workflows, but the supported TypeScript APIs are `authStorageMigrations` from `@effect-auth/core/StorageMigrations` and `postgresAuthStorageMigrations` from `@effect-auth/core/PostgresStorageMigrations`. Raw SQL files are not importable package subpaths.
61
+
62
+ For fresh PostgreSQL + Drizzle schema planning, `@effect-auth/core/StorageSchemaGenerator` exposes the same deterministic feature resolver used by the public API at `https://effect-auth.itsbroly.com/api/generator/v1`. Tools and AI agents should call `/catalog`, then `POST /generate` for both `migration-sql` and `drizzle-schema`; they should not infer physical tables from store service types. The packaged runtime Drizzle/PostgreSQL adapter is not available yet.
63
+
64
+ Before beta, breaking changes are still allowed when they simplify this API surface. Keep the root metadata-only and add public APIs through explicit subpaths.
41
65
 
42
- Before beta, breaking changes are still allowed when they simplify this API surface. Prefer adding new app-specific code through subpaths instead of expanding the root barrel.
66
+ ### Cloudflare Request Metadata
67
+
68
+ `@effect-auth/core/CloudflareRequestMetadata` is an opt-in Worker-boundary adapter for login-risk composition. It uses structural request types and reads geographic facts from Cloudflare's `request.cf`. Client IP is omitted unless `trustCloudflareConnectingIp` is explicitly enabled at a verified Cloudflare boundary. It does not require `@cloudflare/workers-types`, `nodejs_compat`, or an IP database.
69
+
70
+ Call `readCloudflareRequestMetadata(request)` in Worker-owned code, then pass its coarse `request`, `locationKey`, and safe `metadata` fields into custom risk composition. Missing or malformed preview metadata produces unknown fields rather than an error. Never construct the input from browser JSON or forwarded geographic headers. Persist only the returned `durable` projection; the full result may contain transient IP and city values.
43
71
 
44
72
  ## HTTP Client
45
73
 
46
- `@effect-auth/core/Client` exposes a browser-friendly client generated from the same `AuthApi` contract used by the server. It accepts plain JSON input types, includes cookies by default, and decodes successful/error responses through Effect Schema.
74
+ `@effect-auth/core/Client` exposes one browser-friendly client for the standard user-facing auth groups. Applications still choose which groups to mount and which policies to apply on the server. The client accepts plain JSON input types, includes cookies by default, and decodes successful/error responses through Effect Schema.
47
75
 
48
76
  ```ts
49
77
  import { createAuthClient } from "@effect-auth/core/Client";
@@ -56,13 +84,100 @@ const result = await authClient.password.signIn({
56
84
  });
57
85
 
58
86
  const session = await authClient.session.currentOrUndefined();
87
+
88
+ if (authClient.passkey.isSupported()) {
89
+ await authClient.passkey.signIn();
90
+ }
59
91
  ```
60
92
 
93
+ `createAuthClient()` also includes combined email auth, passkeys, TOTP, recovery codes, login MFA, and step-up. Its passkey methods complete the standard start/browser/finish sequence. The focused `createPasskeyClient`, `createTotpClient`, `createMfaClient`, and other factories remain available for custom paths and low-level protocol control.
94
+
95
+ Authentication continuations such as `requires_mfa`, `requires_email_verification`, and `requires_login_approval` are successful protocol results, not exceptions. Handle the returned discriminated union in the UI.
96
+
61
97
  Use `@effect-auth/core/HttpApi` when you are wiring the server or need the raw `HttpApi` contract. Use `@effect-auth/core/Client` in application UI code.
62
98
 
99
+ ### HTTP Operations
100
+
101
+ Applications that own their routes can use the per-feature operation services instead of mounting the built-in API groups. Every built-in HTTP API group has a corresponding portable, typed operations service and `Live` layer. Each layer acquires its feature dependencies once and exposes ready endpoint operations with the same responses, cookies, errors, optional-service behavior, extension hooks, configuration, and security checks as the built-in handlers.
102
+
103
+ ```ts
104
+ import { Effect } from "effect";
105
+ import {
106
+ PasswordHttpOperations,
107
+ PasswordHttpOperationsLive,
108
+ type PasswordHttpOperationsService,
109
+ } from "@effect-auth/core/HttpApi/Password";
110
+
111
+ const signIn = (
112
+ input: Parameters<PasswordHttpOperationsService["signIn"]>[0]
113
+ ) => PasswordHttpOperations.use((operations) => operations.signIn(input));
114
+
115
+ // Provide PasswordLogin, PasswordRegistration, PasswordReset,
116
+ // PasswordManagement, Sessions, SessionCookie, AuthHttp,
117
+ // EmailVerificationFlow, and an explicit AuthRateLimit layer.
118
+ const PasswordRoutesLive = PasswordHttpOperationsLive;
119
+ ```
120
+
121
+ `@effect-auth/core/HttpApi/Password` also exports the standalone `PasswordHttpApiLive` preset and the password endpoint contracts without loading the full server API assembly. The broad `@effect-auth/core/HttpApi` entry remains the aggregate boundary for `CoreAuthHttpApiLive` and cross-feature composition.
122
+
123
+ Feature operation services can also be replaced directly in tests with `FeatureHttpOperations.of(...)`. Secured feature layers always require `AuthRateLimit`; they never install a no-op implementation.
124
+
125
+ ### Client Composition
126
+
127
+ The standard client is a starting point rather than an all-or-nothing abstraction. Its `protocol` option is a deep patch:
128
+
129
+ - omitted properties keep the standard implementation,
130
+ - functions and objects replace or extend it,
131
+ - `null` removes an operation or group,
132
+ - `extensions` adds app-owned auth operations under a collision-free namespace.
133
+
134
+ ```ts
135
+ const auth = createAuthClient({
136
+ protocol: {
137
+ passkey: null,
138
+ password: {
139
+ signUp: customSignUp,
140
+ },
141
+ extensions: {
142
+ organization: {
143
+ select: selectActiveOrganization,
144
+ },
145
+ },
146
+ },
147
+ });
148
+
149
+ await auth.password.signUp(customInput);
150
+ await auth.extensions.organization.select({ organizationId: "org-1" });
151
+ ```
152
+
153
+ Literal `null` values also remove the corresponding property from the inferred client type.
154
+
155
+ Use `defineAuthHttpApiExtension` for an app-owned auth `HttpApi` contract that should share the standard client's base URL, Fetch configuration, cookies, cancellation, runtime, and disposal:
156
+
157
+ ```ts
158
+ const appAuthExtension = defineAuthHttpApiExtension(
159
+ AppAuthExtensionApi,
160
+ ({ run }) => ({
161
+ discoverSso: (email: string, options?: AuthClientRequestOptions) =>
162
+ run(
163
+ (client) => client.appAuth.discoverSso({ payload: { email } }),
164
+ options
165
+ ),
166
+ })
167
+ );
168
+
169
+ const auth = createAuthClient({
170
+ protocol: { extensions: appAuthExtension },
171
+ });
172
+
173
+ await auth.extensions.discoverSso("reader@example.com");
174
+ ```
175
+
176
+ Extension contracts should contain browser-safe endpoint/schema declarations, use unique group identifiers, and require no client-side middleware services. Product APIs that merely require an auth cookie should remain separate from the auth client.
177
+
63
178
  ## Policy
64
179
 
65
- `Policy` is an `Effect` used for authorization. Success means access is allowed. `AuthzError` means access is denied. Other failures stay operational errors.
180
+ `Policy` is an `Effect` used for authorization. Success means access is allowed. `AuthorizationError` means access is denied. Other failures stay operational errors.
66
181
 
67
182
  ```ts
68
183
  import { Effect } from "effect";
@@ -80,6 +195,29 @@ const detailed = Policy.checkDetailed(canEditProject);
80
195
 
81
196
  Use `Policy.check` when callers should branch on allowed/denied and let operational errors fail. Use `Policy.checkDetailed` when callers need a value for allowed, denied, or failed.
82
197
 
198
+ Permission policies read a trusted `CurrentPrincipal`, not session-specific
199
+ `CurrentActor`. `Permissions` checks are subject-first, so the same policy seam
200
+ can authorize a user, service account, API key, or another app-defined subject:
201
+
202
+ ```ts
203
+ import { Effect } from "effect";
204
+ import {
205
+ CurrentPrincipal,
206
+ PermissionSubject,
207
+ } from "@effect-auth/core/Permission";
208
+
209
+ const principal = PermissionSubject.user(validated.actor.userId);
210
+
211
+ const authorized = operation.pipe(
212
+ Effect.provideService(CurrentPrincipal, CurrentPrincipal.of(principal))
213
+ );
214
+ ```
215
+
216
+ `CurrentActor` remains the authenticated session context containing `userId`
217
+ and `sessionId`. Credential adapters must choose the authorization principal
218
+ explicitly at a trusted boundary; never accept it from request input. Machine
219
+ credential scopes and durable permissions are cumulative restrictions.
220
+
83
221
  Policies compose with `all`, `any`, and `not`:
84
222
 
85
223
  ```ts
@@ -162,12 +300,13 @@ const AuthPrivacyLive = PrivacyLive({
162
300
  });
163
301
  ```
164
302
 
165
- The built-in HTTP auth API includes default IP and email rate limits. Production deployments still provide their own durable `RateLimiter` store and HMAC `Privacy` secret. `AuthServicesLive` below stands for your app-owned auth service wiring.
303
+ The built-in HTTP auth API consumes standard limits through `AuthRateLimitStandardLive(config)`. Production deployments provide a durable `RateLimiter` store and HMAC `Privacy` secret. In `config`, an undefined operation uses its standard rules, a rule array replaces them, and `null` disables that operation. `AuthServicesLive` below stands for your app-owned auth service wiring.
166
304
 
167
305
  ```ts
168
- import { Layer, Redacted } from "effect";
306
+ import { Duration, Layer, Redacted } from "effect";
169
307
  import { RateLimiter as PersistenceRateLimiter } from "effect/unstable/persistence";
170
- import { AuthHttpApiLive } from "@effect-auth/core/HttpApi";
308
+ import { AuthRateLimitStandardLive } from "@effect-auth/core/AuthRateLimit";
309
+ import { CoreAuthHttpApiLive } from "@effect-auth/core/HttpApi";
171
310
  import {
172
311
  RateLimitStoreDurableObject,
173
312
  type CloudflareRateLimitDurableObjectNamespace,
@@ -184,29 +323,43 @@ export const makeAuthHttpApiLayer = (
184
323
  Layer.provide(RateLimitStoreDurableObject.layer({ namespace }))
185
324
  );
186
325
 
187
- return AuthHttpApiLive.pipe(
326
+ return CoreAuthHttpApiLive.pipe(
188
327
  Layer.provide(AuthServicesLive),
328
+ Layer.provide(
329
+ AuthRateLimitStandardLive({
330
+ // Keep standard sign-in rules, replace sign-up, disable reset-start.
331
+ "auth.password.sign_up": [
332
+ {
333
+ id: "app.password.sign_up.ip",
334
+ key: "ip",
335
+ limit: 5,
336
+ window: Duration.hours(1),
337
+ },
338
+ ],
339
+ "auth.password.reset_start": null,
340
+ })
341
+ ),
189
342
  Layer.provide(DurableObjectRateLimiterLive),
190
343
  Layer.provide(PrivacyLive({ secret: Redacted.make(privacySecret) }))
191
344
  );
192
345
  };
193
346
  ```
194
347
 
195
- `AuthHttpApiLive` enforces IP limits in HTTP middleware and email limits after schema decoding in the built-in handlers. A single request may consume both a request-level rule and a payload-level rule. `RateLimitPolicy.all(...)` is still available for custom flows and consumes sequentially; put the most specific limits first, such as `ip + email`, then broader limits such as `email`.
196
-
197
- Advanced apps can replace the `AuthApiRateLimit` service directly. `AuthApiRateLimitMiddlewareLive` delegates request-level checks to that service, so custom policies can still use the built-in endpoint middleware and handler hooks.
198
-
199
- Use `AuthHttpApiBareLive` only when you explicitly do not want built-in auth rate limits:
348
+ `AuthRateLimitStandardLive()` applies all standard rules. The explicit escape hatch is `AuthRateLimitNoopLive`; use it only when another boundary enforces equivalent controls or while deliberately running without them:
200
349
 
201
350
  ```ts
202
351
  import { Layer } from "effect";
203
- import { AuthHttpApiBareLive } from "@effect-auth/core/HttpApi";
352
+ import { AuthRateLimitNoopLive } from "@effect-auth/core/AuthRateLimit";
353
+ import { CoreAuthHttpApiLive } from "@effect-auth/core/HttpApi";
204
354
 
205
- export const AuthHttpApiLayer = AuthHttpApiBareLive.pipe(
206
- Layer.provide(AuthServicesLive)
355
+ export const AuthHttpApiLayer = CoreAuthHttpApiLive.pipe(
356
+ Layer.provide(AuthServicesLive),
357
+ Layer.provide(AuthRateLimitNoopLive)
207
358
  );
208
359
  ```
209
360
 
361
+ App-owned workflows can use `RateLimiter.require`, `StepUp`/`Policy` requirements, and `Guard.requireAll` directly. At an HTTP boundary, pipe the composed effect through `mapAuthGuardErrors` so rate-limit, step-up, policy, privacy, and permission failures become the declared auth HTTP errors while unrelated application errors remain unchanged.
362
+
210
363
  ## AuthFlow
211
364
 
212
365
  Login methods should verify a factor, then hand the result to `AuthFlow`. `AuthFlow` returns a flat `AuthResult` tagged enum: authenticated, step-up/verification requirements, or successful auth outcomes such as invalid credentials.
@@ -240,7 +393,7 @@ declare const issuedSession: IssuedSession;
240
393
 
241
394
  const AuthFlowLive = Layer.succeed(
242
395
  AuthFlow,
243
- AuthFlow.make({
396
+ AuthFlow.of({
244
397
  startPrimaryFactor: () =>
245
398
  Effect.succeed(AuthResult.PolicyDenied({ reason: "test" })),
246
399
  completePrimaryFactor: () =>
@@ -255,6 +408,31 @@ const AuthFlowLive = Layer.succeed(
255
408
 
256
409
  The same pattern is available on core services such as `AuditLog.make`, `Sessions.make`, `SessionCookie.make`, `Challenge.make`, `Crypto.make`, `Privacy.make`, and `WaitUntil.make`.
257
410
 
411
+ The reference flow is a resumable pipeline. It assesses risk before deciding whether MFA is required, resumes the same risk and approval path after MFA, and preserves MFA freshness through a later login-approval challenge. Applications can provide `AuthFlowPipeline` to run app-owned policy checks or deny the flow without replacing the reference orchestration. Pipeline stages cannot replace authentication state, claims, risk, or trusted request facts:
412
+
413
+ ```ts
414
+ import { Effect, Layer } from "effect";
415
+ import {
416
+ AuthFlowLive,
417
+ AuthFlowPipeline,
418
+ AuthFlowPipelineLive,
419
+ } from "@effect-auth/core/AuthFlow";
420
+
421
+ const AppAuthPipelineLive = AuthFlowPipelineLive([
422
+ {
423
+ phases: ["before-login-approval"],
424
+ run: (context) =>
425
+ invitationIsValid(context.input)
426
+ ? Effect.succeed(AuthFlowPipeline.continueWith())
427
+ : Effect.succeed(AuthFlowPipeline.deny("Invitation required")),
428
+ },
429
+ ]);
430
+
431
+ const AppAuthFlowLive = AuthFlowLive.pipe(Layer.provide(AppAuthPipelineLive));
432
+ ```
433
+
434
+ Available phases are `before-risk`, `after-risk`, `before-mfa`, `after-mfa`, and `before-login-approval`. Every stage receives `mfaSatisfied`, so stages can distinguish the initial primary-factor pass from a resumed MFA flow. Stages run again when the flow resumes; side effects that must execute exactly once should use an idempotency key or inspect `mfaSatisfied`.
435
+
258
436
  The first default live implementations are available for the phase-3 web session path:
259
437
 
260
438
  ```ts
@@ -340,17 +518,17 @@ const PasswordHashingLive = Layer.mergeAll(
340
518
 
341
519
  ## HTTP API
342
520
 
343
- `@effect-auth/core/HttpApi` contains the first Effect v4 HttpApi contract for the built-in auth surface. It exports `AuthApi`, module-owned endpoint groups, and handler layers for the core services.
521
+ `@effect-auth/core/HttpApi` contains the first Effect v4 HttpApi contract for the built-in auth surface. It exports `CoreAuthHttpApi`, module-owned endpoint groups, and handler layers for the core services.
344
522
 
345
523
  ```ts
346
524
  import { Layer } from "effect";
347
525
  import { HttpRouter } from "effect/unstable/http";
348
- import { AuthHttpApiLive } from "@effect-auth/core/HttpApi";
526
+ import { CoreAuthHttpApiLive } from "@effect-auth/core/HttpApi";
349
527
  import { PrivacyLive } from "./auth/privacy";
350
528
  import { RateLimiterLive } from "./auth/rate-limiter";
351
529
 
352
530
  export const AuthRoutesLive = HttpRouter.serve(
353
- AuthHttpApiLive.pipe(
531
+ CoreAuthHttpApiLive.pipe(
354
532
  Layer.provide(AuthServicesLive),
355
533
  Layer.provide(RateLimiterLive),
356
534
  Layer.provide(PrivacyLive)
@@ -360,25 +538,25 @@ export const AuthRoutesLive = HttpRouter.serve(
360
538
 
361
539
  The contract currently includes these endpoint groups:
362
540
 
363
- | Group | Endpoints |
364
- | --- | --- |
365
- | Password | `POST /auth/password/sign-in`, `POST /auth/password/sign-up`, `POST /auth/password/reset/start`, `POST /auth/password/reset/verify`, `POST /auth/password/set`, `POST /auth/password/change`. |
366
- | Sessions | `GET /auth/session`, `POST /auth/session/refresh`, `POST /auth/logout`, `GET /auth/sessions`, `POST /auth/sessions/revoke`, `POST /auth/sessions/revoke-others`. |
367
- | Email verification | `POST /auth/email-verification/start`, `POST /auth/email-verification/verify`. |
368
- | Email OTP | `POST /auth/email-otp/start`, `POST /auth/email-otp/verify`. |
369
- | Magic link | `POST /auth/magic-link/start`, `POST /auth/magic-link/verify`. |
370
- | Login approval | `POST /auth/login-approval/approve`, `POST /auth/login-approval/status`, `POST /auth/login-approval/finalize`. |
371
- | Security | `POST /auth/security/login/report`. |
541
+ | Group | Endpoints |
542
+ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
543
+ | Password | `POST /auth/password/sign-in`, `POST /auth/password/sign-up`, `POST /auth/password/reset/start`, `POST /auth/password/reset/verify`, `POST /auth/password/set`, `POST /auth/password/change`. |
544
+ | Sessions | `GET /auth/session`, `POST /auth/session/refresh`, `POST /auth/logout`, `GET /auth/sessions`, `POST /auth/sessions/revoke`, `POST /auth/sessions/revoke-others`. |
545
+ | Email verification | `POST /auth/email-verification/start`, `POST /auth/email-verification/verify`. |
546
+ | Email OTP | `POST /auth/email-otp/start`, `POST /auth/email-otp/verify`. |
547
+ | Magic link | `POST /auth/magic-link/start`, `POST /auth/magic-link/verify`. |
548
+ | Login approval | `POST /auth/login-approval/approve`, `POST /auth/login-approval/status`, `POST /auth/login-approval/finalize`. |
549
+ | Security | `POST /auth/security/login/report`. |
372
550
 
373
- `AuthHttpApiLive` wires the full built-in surface. Apps can own the final HTTP contract and reuse individual endpoints, handlers, or services when a feature needs app-specific payloads or responses.
551
+ `CoreAuthHttpApiLive` wires the full built-in surface. Apps can own the final HTTP contract and reuse individual endpoints, services, and the public OAuth/WebAuthn protocol adapters when a feature needs app-specific payloads or responses.
374
552
 
375
553
  `Authenticated` results set the configured session cookie and never include the opaque session token in JSON bodies. Invalid credentials and disabled accounts map to the same `401 invalid_credentials` response by default. Duplicate password sign-up emails fail as `EmailAlreadyRegisteredError` in the domain layer and map to a `409 email_already_registered` HTTP API error.
376
554
 
377
- `SessionApi` reads the configured session cookie and validates it with `Sessions`, returning a safe current-session JSON body or `401 unauthenticated`. Refresh extends the current session when it is eligible, commits the refreshed session cookie, and returns the safe current-session JSON body. Safe authenticated bodies include session claims when present, but never include the opaque session token. Logout revokes the current session when present and clears the session cookie with a `204` response.
555
+ `SessionHttpApiGroup` reads the configured session cookie and validates it with `Sessions`, returning a safe current-session JSON body or `401 unauthenticated`. Refresh extends the current session when it is eligible, commits the refreshed session cookie, and returns the safe current-session JSON body. Safe authenticated bodies include session claims when present, but never include the opaque session token. Logout revokes the current session when present and clears the session cookie with a `204` response.
378
556
 
379
- `AuthHttpApiLive` includes `AuthOriginCheckMiddlewareLive()` for cookie-based unsafe methods and built-in IP/email rate limits for auth abuse control. Origin checks allow same-origin requests, reject cross-origin browser requests with `403 request_rejected`, and allow missing `Origin`/`Referer` headers by default for non-browser clients. Browser-only apps can compose their own `HttpApiBuilder.layer(AuthApi)` and provide `AuthOriginCheckMiddlewareLive({ allowMissingOrigin: false })`.
557
+ `CoreAuthHttpApiLive` includes `AuthOriginCheckMiddlewareLive()` for cookie-based unsafe methods and requires an `AuthRateLimit` service for built-in operation limits. Origin checks allow same-origin requests, reject cross-origin browser requests with `403 request_rejected`, and allow missing `Origin`/`Referer` headers by default for non-browser clients. Browser-only apps can compose their own `HttpApiBuilder.layer(CoreAuthHttpApi)` and provide `AuthOriginCheckMiddlewareLive({ allowMissingOrigin: false })`.
380
558
 
381
- `AuthCsrfMiddlewareLive()` is available for apps that want double-submit CSRF checks on unsafe cookie endpoints. It compares the `__Host-csrf` cookie to the `x-csrf-token` header by default and rejects mismatches with `403 request_rejected`. App-owned HTTP handlers should map core `AuthzError` policy failures to safe `403 policy_denied` responses without exposing policy reasons or internal details.
559
+ `AuthCsrfMiddlewareLive()` is available for apps that want double-submit CSRF checks on unsafe cookie endpoints. It compares the `__Host-csrf` cookie to the `x-csrf-token` header by default and rejects mismatches with `403 request_rejected`. App-owned HTTP handlers should use `mapAuthGuardErrors` to map core guard failures to safe HTTP errors without exposing policy reasons or internal details.
382
560
 
383
561
  Apps using `AuthCsrfMiddleware` must issue the CSRF token themselves, usually from an app-owned bootstrap endpoint or page render. The token should be high-entropy, set as the `__Host-csrf` cookie, and echoed by browser code in the `x-csrf-token` header on unsafe cookie requests:
384
562
 
@@ -399,127 +577,93 @@ await fetch("/auth/session/refresh", {
399
577
  });
400
578
  ```
401
579
 
402
- `AuthRequestMetadataMiddlewareLive()` can provide method, URL, origin, user-agent, and trusted proxy IP metadata to app-owned handlers. Built-in auth rate limiting is configured in one place with `AuthHttpApiConfigLive(...)`. It applies IP limits in HTTP middleware, then payload-level email limits after schema decoding:
580
+ `AuthRequestMetadataMiddlewareLive()` can provide method, URL, origin, user-agent, and trusted proxy IP metadata to app-owned handlers. IP metadata uses direct request headers by default; set `requestMetadata.trustProxyHeaders` when your deployment terminates trusted proxy headers before the app:
403
581
 
404
582
  ```ts
405
- import { Duration, Layer } from "effect";
583
+ import { Layer } from "effect";
584
+ import { AuthRateLimitStandardLive } from "@effect-auth/core/AuthRateLimit";
406
585
  import {
407
586
  AuthHttpApiConfigLive,
408
- AuthHttpApiLive,
587
+ CoreAuthHttpApiLive,
409
588
  } from "@effect-auth/core/HttpApi";
410
- import { PrivacyLive } from "./auth/privacy";
411
- import { RateLimiterLive } from "./auth/rate-limiter";
412
589
 
413
- export const AuthHttpApiLayer = AuthHttpApiLive.pipe(
590
+ export const AuthHttpApiLayer = CoreAuthHttpApiLive.pipe(
414
591
  Layer.provide(
415
592
  AuthHttpApiConfigLive({
416
- rateLimit: {
593
+ requestMetadata: {
417
594
  trustProxyHeaders: true,
418
- passwordSignIn: {
419
- byIp: { limit: 20, window: Duration.minutes(10) },
420
- byEmail: { limit: 5, window: Duration.minutes(10) },
421
- },
422
- passwordSignUp: {
423
- byIp: false,
424
- byEmail: { limit: 3, window: Duration.hours(1) },
425
- },
426
- emailVerificationStart: false,
427
595
  },
428
596
  })
429
597
  ),
598
+ Layer.provide(AuthRateLimitStandardLive()),
430
599
  Layer.provide(AuthServicesLive),
431
600
  Layer.provide(RateLimiterLive),
432
601
  Layer.provide(PrivacyLive)
433
602
  );
434
603
  ```
435
604
 
436
- Using `AuthHttpApiLive` without `AuthHttpApiConfigLive(...)` uses conservative defaults for `passwordSignIn`, `passwordSignUp`, and `emailVerificationStart`. In `rateLimit` config, `true` means default rules, `false` disables that endpoint or rule, omitted values keep defaults, and an object overrides `limit`, `window`, or `tokens`. Use `AuthHttpApiBareLive` to opt out explicitly. `AuthHttpApiLive` never installs a process-local store by itself; production apps still provide a durable `RateLimiter` and `PrivacyLive`.
437
-
438
- ```ts
439
- import { AuthHttpApiBareLive } from "@effect-auth/core/HttpApi";
440
-
441
- export const AuthHttpApiLayer = AuthHttpApiBareLive.pipe(
442
- Layer.provide(AuthServicesLive)
443
- );
444
- ```
445
-
446
- `EmailVerificationApi` exposes `start` and `verify` endpoints. `start` calls `EmailVerificationFlow` to issue and send a verification challenge through the app-owned `EmailDelivery` adapter. `verify` calls `EmailVerification` and returns `204` on success. When the request includes a valid current session cookie for the same user, `verify` also marks that session's claims as email verified and removes the `email_verification` requirement. Error responses are generic and do not include emails, user ids, challenge secrets, or provider details.
605
+ `EmailVerificationHttpApiGroup` exposes `start` and `verify` endpoints. `start` calls `EmailVerificationFlow` to issue and send a verification challenge through the app-owned `EmailDelivery` adapter. `verify` calls `EmailVerification` and returns `204` on success. When the request includes a valid current session cookie for the same user, `verify` also marks that session's claims as email verified and removes the `email_verification` requirement. Error responses are generic and do not include emails, user ids, challenge secrets, or provider details.
447
606
 
448
607
  Password HTTP handlers can start `EmailVerificationFlow` automatically when a custom auth flow returns `RequiresEmailVerification`. The HTTP response remains `requires_email_verification` and does not include the user id, email, challenge secret, or delivery provider details.
449
608
 
450
- You can own the final HTTP contract while reusing core endpoints. For example, replace only password sign-up with an app-specific phone payload and keep the default sign-in endpoint:
609
+ Application workflow handlers belong in the app. Compose domain/application effects with guards, then map only guard failures into the endpoint's HTTP error contract:
451
610
 
452
611
  ```ts
453
- import { Effect, Schema } from "effect";
612
+ import { Duration, Effect, Schema } from "effect";
454
613
  import {
455
614
  HttpApi,
456
615
  HttpApiBuilder,
457
616
  HttpApiEndpoint,
458
617
  HttpApiGroup,
459
618
  } from "effect/unstable/httpapi";
619
+ import * as Guard from "@effect-auth/core/Guard";
620
+ import * as RateLimiter from "@effect-auth/core/RateLimiter";
460
621
  import {
461
- AuthBadRequestError,
462
- AuthEmailAlreadyRegisteredError,
463
- AuthHttp,
464
622
  AuthInternalError,
465
- AuthOriginCheckMiddleware,
466
- AuthPolicyDeniedError,
467
623
  AuthRateLimitedError,
468
- AuthSchemaErrorMiddleware,
469
- makePasswordSignInHandler,
470
- passwordSignInEndpoint,
471
- PasswordAuthSuccess,
624
+ mapAuthGuardErrors,
472
625
  } from "@effect-auth/core/HttpApi";
473
- import { EmailSchema } from "@effect-auth/core/Identifiers";
474
- import { PasswordLogin } from "@effect-auth/core/Password";
475
-
476
- const PhoneNumber = Schema.String.check(Schema.isPattern(/^\+[1-9]\d{7,14}$/));
477
626
 
478
- const PhoneSignUpBody = Schema.Struct({
479
- email: EmailSchema,
480
- password: Schema.String,
481
- phone: PhoneNumber,
627
+ const updateProfileEndpoint = HttpApiEndpoint.post("update", "/profile", {
628
+ payload: Schema.Struct({ displayName: Schema.String }),
629
+ success: Schema.Struct({ updated: Schema.Boolean }),
630
+ error: [AuthRateLimitedError, AuthInternalError],
482
631
  });
483
632
 
484
- const phoneSignUpEndpoint = HttpApiEndpoint.post("signUp", "/sign-up", {
485
- payload: PhoneSignUpBody,
486
- success: PasswordAuthSuccess,
487
- error: [
488
- AuthBadRequestError,
489
- AuthEmailAlreadyRegisteredError,
490
- AuthPolicyDeniedError,
491
- AuthRateLimitedError,
492
- AuthInternalError,
493
- ],
633
+ const UpdateProfileRateLimit = RateLimiter.RateLimitPolicy.fixedWindow({
634
+ id: "app.profile.update",
635
+ key: RateLimiter.RateLimitKey.global,
636
+ limit: 20,
637
+ window: Duration.minutes(1),
494
638
  });
495
639
 
496
- class PasswordApi extends HttpApiGroup.make("password")
497
- .add(passwordSignInEndpoint, phoneSignUpEndpoint)
498
- .prefix("/auth/password")
499
- .middleware(AuthSchemaErrorMiddleware)
500
- .middleware(AuthOriginCheckMiddleware) {}
501
-
502
- class AppAuthApi extends HttpApi.make("AppAuthApi").add(PasswordApi) {}
503
-
504
- export const AppPasswordApiLive = HttpApiBuilder.group(
505
- AppAuthApi,
506
- "password",
507
- Effect.fn("app.auth.password.group")(function* (handlers) {
508
- const password = yield* PasswordLogin;
509
- const authHttp = yield* AuthHttp;
510
-
511
- return handlers
512
- .handle("signIn", makePasswordSignInHandler({ password, authHttp }))
513
- .handle(
514
- "signUp",
515
- Effect.fn("app.auth.password.sign_up")(function* ({ payload }) {
516
- return yield* signUpWithPhone(payload, authHttp);
517
- })
518
- );
519
- })
640
+ class ProfileHttpApiGroup extends HttpApiGroup.make("profile")
641
+ .add(updateProfileEndpoint)
642
+ .prefix("/auth") {}
643
+
644
+ class AppApi extends HttpApi.make("AppApi").add(ProfileHttpApiGroup) {}
645
+
646
+ const updateProfile = (displayName: string) =>
647
+ Effect.succeed({ updated: displayName.length > 0 });
648
+
649
+ export const ProfileHttpApiGroupLive = HttpApiBuilder.group(
650
+ AppApi,
651
+ "profile",
652
+ (handlers) =>
653
+ handlers.handle(
654
+ "update",
655
+ Effect.fn("app.auth.profile.update")(function* ({ payload }) {
656
+ return yield* updateProfile(payload.displayName).pipe(
657
+ Guard.requireAll(RateLimiter.require(UpdateProfileRateLimit)),
658
+ mapAuthGuardErrors
659
+ );
660
+ })
661
+ )
520
662
  );
521
663
  ```
522
664
 
665
+ Use `Guard.requireAll` with `RateLimiter.require(...)`, `AuthRateLimit.require(...)`, direct `StepUp` effects, direct `Policy` effects, or any app-owned guard. This keeps workflow ownership local instead of importing a thin core handler factory. `mapAuthGuardErrors` preserves unrelated domain errors, so include those separately in the endpoint error schema.
666
+
523
667
  ## Sessions
524
668
 
525
669
  `Sessions` is the server-side session authority. Transports such as cookies are separate services so browser, API, and custom transports can share the same session strategy.
@@ -556,15 +700,15 @@ export const createBrowserSession = (userId: UserId) =>
556
700
  Password auth passes the user's email verification state into `AuthFlow`, where `EmailVerificationSessionPolicy` decides whether unverified users get a normal session or a constrained session. The default mode is `allow-unverified` for compatibility. Use `limited-session` to issue sessions with an `email_verification` requirement. Per-login email approval is a separate `UserSecurityPolicy` / `LoginApprovalPolicy` concern, not an email verification session mode.
557
701
 
558
702
  ```ts
559
- import { AuthFlowLiveWithEmailVerificationPolicy } from "@effect-auth/core/AuthFlow";
703
+ import { AuthFlowWithEmailVerificationPolicyLive } from "@effect-auth/core/AuthFlow";
560
704
 
561
705
  export const AllowUnverifiedAuthFlowLive =
562
- AuthFlowLiveWithEmailVerificationPolicy({
706
+ AuthFlowWithEmailVerificationPolicyLive({
563
707
  mode: "allow-unverified",
564
708
  });
565
709
 
566
710
  export const LimitedSessionAuthFlowLive =
567
- AuthFlowLiveWithEmailVerificationPolicy({
711
+ AuthFlowWithEmailVerificationPolicyLive({
568
712
  mode: "limited-session",
569
713
  });
570
714
  ```
@@ -721,7 +865,7 @@ import {
721
865
  } from "@effect-auth/core/EmailVerification";
722
866
  import type { ChallengeId, Email, UserId } from "@effect-auth/core/Identifiers";
723
867
 
724
- const emailDelivery = EmailDelivery.make({
868
+ const emailDelivery = EmailDelivery.of({
725
869
  sendEmailVerification: ({ email, secret, challengeId }) =>
726
870
  sendMail({
727
871
  to: email,
@@ -785,7 +929,7 @@ Core still leaves the scheduler, retention windows, tenant/legal-hold policy, SI
785
929
 
786
930
  ## Storage
787
931
 
788
- Storage is exposed as ORM-free ports. Core flows depend on store services, while Effect-QB, future Drizzle, or app-owned adapters provide the implementations.
932
+ Storage is exposed as ORM-free ports. Core flows depend on store services, while Effect-QB, Drizzle, or app-owned adapters provide the implementations.
789
933
 
790
934
  ```ts
791
935
  import { Effect, Option } from "effect";
@@ -796,19 +940,19 @@ import {
796
940
  VerificationStore,
797
941
  } from "@effect-auth/core/Storage";
798
942
 
799
- const UserStoreLive = UserStore.make({
943
+ const UserStoreLive = UserStore.of({
800
944
  findById: () => Effect.succeed(Option.none()),
801
945
  findByEmail: () => Effect.succeed(Option.none()),
802
946
  insert: () => Effect.void,
803
947
  markEmailVerified: () => Effect.succeed(Option.none()),
804
948
  });
805
949
 
806
- const CredentialStoreLive = CredentialStore.make({
950
+ const CredentialStoreLive = CredentialStore.of({
807
951
  findPasswordByUserId: () => Effect.succeed(Option.none()),
808
952
  insertPassword: () => Effect.void,
809
953
  });
810
954
 
811
- const SessionStoreLive = SessionStore.make({
955
+ const SessionStoreLive = SessionStore.of({
812
956
  findById: () => Effect.succeed(Option.none()),
813
957
  insert: () => Effect.void,
814
958
  refresh: () => Effect.succeed(Option.none()),
@@ -817,7 +961,7 @@ const SessionStoreLive = SessionStore.make({
817
961
  revokeAllForUser: () => Effect.void,
818
962
  });
819
963
 
820
- const VerificationStoreLive = VerificationStore.make({
964
+ const VerificationStoreLive = VerificationStore.of({
821
965
  findById: () => Effect.succeed(Option.none()),
822
966
  insert: () => Effect.void,
823
967
  consume: () => Effect.succeed(Option.none()),
@@ -829,9 +973,10 @@ The default schema is exported as SQL and as package assets:
829
973
 
830
974
  ```ts
831
975
  import { authStorageMigrations } from "@effect-auth/core/StorageMigrations";
976
+ import { postgresAuthStorageMigrations } from "@effect-auth/core/PostgresStorageMigrations";
832
977
  ```
833
978
 
834
- Effect-QB SQLite/D1 storage is the first-party durable adapter. The default path uses the auth schema and requires no table mapping:
979
+ Effect-QB SQLite/D1 storage is a first-party durable adapter. The default path uses the auth schema and requires no table mapping:
835
980
 
836
981
  ```ts
837
982
  import { EffectQbSqliteAuthStorageLive } from "@effect-auth/core/EffectQbSqliteStorage";
@@ -841,6 +986,18 @@ const StorageLive = EffectQbSqliteAuthStorageLive(executor);
841
986
 
842
987
  `EffectQbSqliteAuthStorageLive` provides all durable auth stores in the default schema, including audit log storage, domain verification storage, and the OAuth provider-token vault for already-encrypted provider token ciphertexts. Apps still own provider-token encryption, KMS/secrets-service policy, DNS/HTTP proof checking, and tenant authorization before values reach storage.
843
988
 
989
+ The native Effect-QB Postgres adapter also provides the complete grouped store set, including `PermissionStore`. Apply the exported Postgres migrations through `0009_auth_permissions`, then provide `EffectQbPostgresCoreStoresLive(sql)` or construct `makeEffectQbPostgresPermissionStore(executor)` directly.
990
+
991
+ Application-owned queries can reuse the adapter's canonical table objects instead of redeclaring `Table.make(...)` metadata:
992
+
993
+ ```ts
994
+ import { effectQbPostgresTables } from "@effect-auth/core/EffectQbPostgresStorage";
995
+
996
+ const { user, session, permissionDefinition } = effectQbPostgresTables;
997
+ ```
998
+
999
+ Use the public store services for auth mutations unless custom writes preserve the adapter's security and atomicity invariants.
1000
+
844
1001
  For Cloudflare D1, create an effect-qb SQLite executor from the D1 binding:
845
1002
 
846
1003
  ```ts
@@ -853,6 +1010,48 @@ const executor = makeD1EffectQbSqliteExecutor(env.DB);
853
1010
  const StorageLive = EffectQbSqliteAuthStorageLive(executor);
854
1011
  ```
855
1012
 
1013
+ Drizzle Effect SQLite storage is also available as an additive adapter. For Cloudflare D1, use the D1 convenience subpath:
1014
+
1015
+ ```ts
1016
+ import { DrizzleD1SqliteAuthStorageLive } from "@effect-auth/core/DrizzleD1SqliteStorage";
1017
+
1018
+ const StorageLive = DrizzleD1SqliteAuthStorageLive(env.DB);
1019
+ ```
1020
+
1021
+ Runtime-specific Drizzle SQLite helpers are available for Node, Bun, Cloudflare Durable Object SQLite storage, and WASM/OPFS-style SQLite. They construct the matching Drizzle Effect SQLite database from the Effect SQL client layer, then reuse the same auth storage bridge:
1022
+
1023
+ ```ts
1024
+ import { DrizzleBunSqliteAuthStorageLive } from "@effect-auth/core/DrizzleBunSqliteStorage";
1025
+
1026
+ const StorageLive = DrizzleBunSqliteAuthStorageLive({
1027
+ filename: "auth.sqlite",
1028
+ });
1029
+ ```
1030
+
1031
+ Install the matching runtime package when using a runtime-specific subpath, such as `@effect/sql-sqlite-bun`, `@effect/sql-sqlite-node`, `@effect/sql-sqlite-do`, or `@effect/sql-sqlite-wasm`.
1032
+
1033
+ Database and ORM packages used only by storage subpaths are optional peers. The metadata-only root does not load them; install the matching optional peers for the adapter subpath your application imports.
1034
+
1035
+ If your app already builds a Drizzle Effect SQLite database, use the generic subpath instead. This keeps D1-specific dependencies out of non-D1 runtimes:
1036
+
1037
+ ```ts
1038
+ import { DrizzleEffectSqliteAuthStorageLive } from "@effect-auth/core/DrizzleEffectSqliteStorage";
1039
+
1040
+ const StorageLive = DrizzleEffectSqliteAuthStorageLive(drizzle);
1041
+ ```
1042
+
1043
+ Both Drizzle paths use the same default auth schema and table mapping options as the Effect-QB SQLite storage. Apps using a typed Drizzle relations config can pass it through the D1 helper so the constructed Drizzle database keeps relation typing:
1044
+
1045
+ ```ts
1046
+ import { makeD1DrizzleEffectSqliteDatabase } from "@effect-auth/core/DrizzleD1SqliteStorage";
1047
+
1048
+ const drizzle =
1049
+ yield *
1050
+ makeD1DrizzleEffectSqliteDatabase(env.DB, {
1051
+ relations,
1052
+ });
1053
+ ```
1054
+
856
1055
  Applications with their own Effect-QB tables can map semantic auth fields to app-owned columns with `defineEffectQbAuthTables`:
857
1056
 
858
1057
  ```ts
@@ -906,7 +1105,9 @@ const authTables = defineEffectQbAuthTables({
906
1105
  // credential/session/verification/audit/review/trusted-device/passkey/TOTP/recovery-code/API-key/refresh-token/OAuth-account/provider-token-vault/domain-verification mappings follow the same pattern.
907
1106
  });
908
1107
 
909
- const StorageLive = EffectQbSqliteAuthStorageLive(executor, {
1108
+ const StorageLive = EffectQbSqliteAuthStorageLive(executor, atomic, {
910
1109
  tables: authTables,
911
1110
  });
912
1111
  ```
1112
+
1113
+ Mappings used by atomic composite stores must select direct bound columns and return literal driver values from mutation functions. Expression-valued mutation mappings require an application-owned store implementation.