@pithy-sh/auth 0.10.0 → 0.12.0

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 (283) hide show
  1. package/README.md +30 -2
  2. package/dist/admin/users.js +1 -1
  3. package/dist/audit/actions.d.ts +58 -0
  4. package/dist/audit/actions.d.ts.map +1 -1
  5. package/dist/audit/actions.js +59 -1
  6. package/dist/audit/emit.d.ts +36 -0
  7. package/dist/audit/emit.d.ts.map +1 -1
  8. package/dist/audit/emit.js +48 -2
  9. package/dist/audit/evidence.d.ts +8 -2
  10. package/dist/audit/evidence.d.ts.map +1 -1
  11. package/dist/capability.d.ts +47 -8
  12. package/dist/capability.d.ts.map +1 -1
  13. package/dist/capability.js +56 -6
  14. package/dist/client/api.d.ts +55 -12
  15. package/dist/client/api.d.ts.map +1 -1
  16. package/dist/client/api.js +57 -18
  17. package/dist/client/bearer.d.ts +110 -0
  18. package/dist/client/bearer.d.ts.map +1 -0
  19. package/dist/client/bearer.js +265 -0
  20. package/dist/client/handoff.d.ts +77 -0
  21. package/dist/client/handoff.d.ts.map +1 -0
  22. package/dist/client/handoff.js +119 -0
  23. package/dist/client/mcp.d.ts +70 -0
  24. package/dist/client/mcp.d.ts.map +1 -0
  25. package/dist/client/mcp.js +65 -0
  26. package/dist/data/betterAuth.d.ts +3 -2
  27. package/dist/data/betterAuth.d.ts.map +1 -1
  28. package/dist/data/betterAuth.js +5 -3
  29. package/dist/data/kitFields.d.ts +5 -0
  30. package/dist/data/kitFields.d.ts.map +1 -1
  31. package/dist/data/kitFields.js +5 -0
  32. package/dist/data/tables.d.ts +26 -4
  33. package/dist/data/tables.d.ts.map +1 -1
  34. package/dist/data/tables.js +5 -3
  35. package/dist/data/userLifecycle.d.ts +10 -0
  36. package/dist/data/userLifecycle.d.ts.map +1 -1
  37. package/dist/data/userLifecycle.js +8 -3
  38. package/dist/data/verificationOutcome.d.ts +53 -0
  39. package/dist/data/verificationOutcome.d.ts.map +1 -0
  40. package/dist/data/verificationOutcome.js +50 -0
  41. package/dist/email/send.js +6 -2
  42. package/dist/http/adminRoutes.d.ts.map +1 -1
  43. package/dist/http/adminRoutes.js +319 -8
  44. package/dist/http/csrf.d.ts.map +1 -1
  45. package/dist/http/csrf.js +2 -1
  46. package/dist/http/guards.d.ts +15 -10
  47. package/dist/http/guards.d.ts.map +1 -1
  48. package/dist/http/guards.js +76 -10
  49. package/dist/http/handoff.d.ts +76 -0
  50. package/dist/http/handoff.d.ts.map +1 -0
  51. package/dist/http/handoff.js +316 -0
  52. package/dist/http/middleware.d.ts +37 -1
  53. package/dist/http/middleware.d.ts.map +1 -1
  54. package/dist/http/middleware.js +68 -6
  55. package/dist/http/resolve.d.ts.map +1 -1
  56. package/dist/http/resolve.js +9 -3
  57. package/dist/http/responses.d.ts +322 -0
  58. package/dist/http/responses.d.ts.map +1 -1
  59. package/dist/http/responses.js +202 -5
  60. package/dist/http/routes.d.ts +3 -0
  61. package/dist/http/routes.d.ts.map +1 -1
  62. package/dist/http/routes.js +78 -5
  63. package/dist/http/schemas.d.ts +114 -0
  64. package/dist/http/schemas.d.ts.map +1 -1
  65. package/dist/http/schemas.js +94 -1
  66. package/dist/http/views.d.ts +60 -3
  67. package/dist/http/views.d.ts.map +1 -1
  68. package/dist/http/views.js +143 -3
  69. package/dist/index.d.ts +2 -0
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +4 -2
  72. package/dist/instance/auth.d.ts +148 -10
  73. package/dist/instance/auth.d.ts.map +1 -1
  74. package/dist/instance/auth.js +87 -42
  75. package/dist/instance/plugins.d.ts +6 -0
  76. package/dist/instance/plugins.d.ts.map +1 -1
  77. package/dist/instance/plugins.js +14 -1
  78. package/dist/ledger/read.d.ts +53 -0
  79. package/dist/ledger/read.d.ts.map +1 -0
  80. package/dist/ledger/read.js +85 -0
  81. package/dist/ledger/record.d.ts +35 -0
  82. package/dist/ledger/record.d.ts.map +1 -0
  83. package/dist/ledger/record.js +98 -0
  84. package/dist/lifecycle/audited.d.ts +48 -0
  85. package/dist/lifecycle/audited.d.ts.map +1 -0
  86. package/dist/lifecycle/audited.js +65 -0
  87. package/dist/lifecycle/enforce.d.ts +37 -2
  88. package/dist/lifecycle/enforce.d.ts.map +1 -1
  89. package/dist/lifecycle/enforce.js +46 -5
  90. package/dist/lifecycle/erasure.d.ts +9 -0
  91. package/dist/lifecycle/erasure.d.ts.map +1 -0
  92. package/dist/lifecycle/erasure.js +96 -0
  93. package/dist/lifecycle/inactivity.d.ts +19 -0
  94. package/dist/lifecycle/inactivity.d.ts.map +1 -0
  95. package/dist/lifecycle/inactivity.js +28 -0
  96. package/dist/lifecycle/reason.d.ts +11 -0
  97. package/dist/lifecycle/reason.d.ts.map +1 -0
  98. package/dist/lifecycle/reason.js +13 -0
  99. package/dist/lifecycle/request.d.ts +5 -2
  100. package/dist/lifecycle/request.d.ts.map +1 -1
  101. package/dist/lifecycle/request.js +6 -2
  102. package/dist/lifecycle/transitions.d.ts +179 -18
  103. package/dist/lifecycle/transitions.d.ts.map +1 -1
  104. package/dist/lifecycle/transitions.js +391 -70
  105. package/dist/mcp/argumentClass.d.ts +51 -0
  106. package/dist/mcp/argumentClass.d.ts.map +1 -0
  107. package/dist/mcp/argumentClass.js +69 -0
  108. package/dist/mcp/capability.d.ts +50 -0
  109. package/dist/mcp/capability.d.ts.map +1 -0
  110. package/dist/mcp/capability.js +140 -0
  111. package/dist/mcp/clientMetadata.d.ts +40 -0
  112. package/dist/mcp/clientMetadata.d.ts.map +1 -0
  113. package/dist/mcp/clientMetadata.js +68 -0
  114. package/dist/mcp/consent.d.ts +49 -0
  115. package/dist/mcp/consent.d.ts.map +1 -0
  116. package/dist/mcp/consent.js +69 -0
  117. package/dist/mcp/dispatch.d.ts +35 -0
  118. package/dist/mcp/dispatch.d.ts.map +1 -0
  119. package/dist/mcp/dispatch.js +135 -0
  120. package/dist/mcp/floor.d.ts +37 -0
  121. package/dist/mcp/floor.d.ts.map +1 -0
  122. package/dist/mcp/floor.js +41 -0
  123. package/dist/mcp/host.d.ts +34 -0
  124. package/dist/mcp/host.d.ts.map +1 -0
  125. package/dist/mcp/host.js +2 -0
  126. package/dist/mcp/http/redirectList.d.ts +9 -0
  127. package/dist/mcp/http/redirectList.d.ts.map +1 -0
  128. package/dist/mcp/http/redirectList.js +24 -0
  129. package/dist/mcp/http/responses.d.ts +143 -0
  130. package/dist/mcp/http/responses.d.ts.map +1 -0
  131. package/dist/mcp/http/responses.js +83 -0
  132. package/dist/mcp/http/routes.d.ts +28 -0
  133. package/dist/mcp/http/routes.d.ts.map +1 -0
  134. package/dist/mcp/http/routes.js +517 -0
  135. package/dist/mcp/http/schemas.d.ts +24 -0
  136. package/dist/mcp/http/schemas.d.ts.map +1 -0
  137. package/dist/mcp/http/schemas.js +18 -0
  138. package/dist/mcp/marker.d.ts +15 -0
  139. package/dist/mcp/marker.d.ts.map +1 -0
  140. package/dist/mcp/marker.js +15 -0
  141. package/dist/mcp/provider.d.ts +78 -0
  142. package/dist/mcp/provider.d.ts.map +1 -0
  143. package/dist/mcp/provider.js +108 -0
  144. package/dist/mcp/purge.d.ts +15 -0
  145. package/dist/mcp/purge.d.ts.map +1 -0
  146. package/dist/mcp/purge.js +31 -0
  147. package/dist/mcp/rpc.d.ts +79 -0
  148. package/dist/mcp/rpc.d.ts.map +1 -0
  149. package/dist/mcp/rpc.js +103 -0
  150. package/dist/mcp/toolAudit.d.ts +76 -0
  151. package/dist/mcp/toolAudit.d.ts.map +1 -0
  152. package/dist/mcp/toolAudit.js +86 -0
  153. package/dist/migrations/0005_purge_once.d.ts +22 -0
  154. package/dist/migrations/0005_purge_once.d.ts.map +1 -0
  155. package/dist/migrations/0005_purge_once.js +35 -0
  156. package/dist/migrations/0006_verification_outcomes.d.ts +15 -0
  157. package/dist/migrations/0006_verification_outcomes.d.ts.map +1 -0
  158. package/dist/migrations/0006_verification_outcomes.js +35 -0
  159. package/dist/migrations/0007_erasure_record.d.ts +17 -0
  160. package/dist/migrations/0007_erasure_record.d.ts.map +1 -0
  161. package/dist/migrations/0007_erasure_record.js +36 -0
  162. package/dist/migrations/0008_last_active.d.ts +15 -0
  163. package/dist/migrations/0008_last_active.d.ts.map +1 -0
  164. package/dist/migrations/0008_last_active.js +29 -0
  165. package/dist/migrations/pluginTables.d.ts +8 -0
  166. package/dist/migrations/pluginTables.d.ts.map +1 -1
  167. package/dist/migrations/pluginTables.js +8 -1
  168. package/dist/migrations/set.d.ts +5 -1
  169. package/dist/migrations/set.d.ts.map +1 -1
  170. package/dist/migrations/set.js +10 -2
  171. package/dist/peer.d.ts +3 -2
  172. package/dist/peer.d.ts.map +1 -1
  173. package/dist/processing/activities.d.ts +6 -0
  174. package/dist/processing/activities.d.ts.map +1 -0
  175. package/dist/processing/activities.js +12 -0
  176. package/dist/purge/contribution.d.ts +62 -0
  177. package/dist/purge/contribution.d.ts.map +1 -0
  178. package/dist/purge/contribution.js +155 -0
  179. package/dist/purge/retryPolicy.d.ts +22 -0
  180. package/dist/purge/retryPolicy.d.ts.map +1 -0
  181. package/dist/purge/retryPolicy.js +26 -0
  182. package/dist/purge/run.d.ts +158 -0
  183. package/dist/purge/run.d.ts.map +1 -0
  184. package/dist/purge/run.js +205 -0
  185. package/dist/purge/specs.d.ts +71 -0
  186. package/dist/purge/specs.d.ts.map +1 -0
  187. package/dist/purge/specs.js +72 -0
  188. package/dist/purge/start.d.ts +42 -0
  189. package/dist/purge/start.d.ts.map +1 -0
  190. package/dist/purge/start.js +37 -0
  191. package/dist/purge/workflow.d.ts +71 -0
  192. package/dist/purge/workflow.d.ts.map +1 -0
  193. package/dist/purge/workflow.js +140 -0
  194. package/dist/test-utils/accountFootprint.d.ts +13 -0
  195. package/dist/test-utils/accountFootprint.d.ts.map +1 -0
  196. package/dist/test-utils/accountFootprint.js +49 -0
  197. package/dist/test-utils/liveApp.d.ts +6 -0
  198. package/dist/test-utils/liveApp.d.ts.map +1 -1
  199. package/dist/test-utils/liveApp.js +7 -2
  200. package/dist/token/handoff.d.ts +80 -0
  201. package/dist/token/handoff.d.ts.map +1 -0
  202. package/dist/token/handoff.js +136 -0
  203. package/dist/version.generated.d.ts +1 -1
  204. package/dist/version.generated.js +1 -1
  205. package/docs/account-lifecycle.md +176 -12
  206. package/docs/apple-signin.md +32 -4
  207. package/docs/facebook-oauth.md +2 -2
  208. package/docs/github-oauth.md +2 -2
  209. package/docs/google-oauth.md +9 -7
  210. package/docs/microsoft-oauth.md +2 -2
  211. package/package.json +11 -5
  212. package/pithy.manifest.json +2 -2
  213. package/pithy.mcp.manifest.json +36 -0
  214. package/src/audit/actions.ts +58 -0
  215. package/src/audit/emit.ts +66 -1
  216. package/src/audit/evidence.ts +8 -4
  217. package/src/capability.ts +122 -18
  218. package/src/client/api.ts +69 -19
  219. package/src/client/bearer.ts +388 -0
  220. package/src/client/handoff.ts +172 -0
  221. package/src/client/mcp.ts +140 -0
  222. package/src/data/betterAuth.ts +8 -4
  223. package/src/data/kitFields.ts +2 -0
  224. package/src/data/tables.ts +4 -2
  225. package/src/data/userLifecycle.ts +19 -4
  226. package/src/data/verificationOutcome.ts +86 -0
  227. package/src/email/send.ts +2 -2
  228. package/src/http/adminRoutes.ts +465 -4
  229. package/src/http/csrf.ts +4 -1
  230. package/src/http/guards.ts +79 -10
  231. package/src/http/handoff.ts +350 -0
  232. package/src/http/middleware.ts +74 -5
  233. package/src/http/resolve.ts +25 -25
  234. package/src/http/responses.ts +374 -3
  235. package/src/http/routes.ts +116 -5
  236. package/src/http/schemas.ts +195 -0
  237. package/src/http/views.ts +192 -3
  238. package/src/index.ts +2 -0
  239. package/src/instance/auth.ts +58 -3
  240. package/src/instance/plugins.ts +20 -2
  241. package/src/ledger/read.ts +133 -0
  242. package/src/ledger/record.ts +198 -0
  243. package/src/lifecycle/audited.ts +104 -0
  244. package/src/lifecycle/enforce.ts +55 -5
  245. package/src/lifecycle/erasure.ts +118 -0
  246. package/src/lifecycle/inactivity.ts +56 -0
  247. package/src/lifecycle/reason.ts +11 -0
  248. package/src/lifecycle/request.ts +10 -2
  249. package/src/lifecycle/transitions.ts +552 -93
  250. package/src/mcp/argumentClass.ts +112 -0
  251. package/src/mcp/capability.ts +194 -0
  252. package/src/mcp/clientMetadata.ts +81 -0
  253. package/src/mcp/consent.ts +95 -0
  254. package/src/mcp/dispatch.ts +154 -0
  255. package/src/mcp/floor.ts +62 -0
  256. package/src/mcp/host.ts +36 -0
  257. package/src/mcp/http/redirectList.ts +26 -0
  258. package/src/mcp/http/responses.ts +157 -0
  259. package/src/mcp/http/routes.ts +635 -0
  260. package/src/mcp/http/schemas.ts +37 -0
  261. package/src/mcp/marker.ts +18 -0
  262. package/src/mcp/provider.ts +151 -0
  263. package/src/mcp/purge.ts +39 -0
  264. package/src/mcp/rpc.ts +135 -0
  265. package/src/mcp/toolAudit.ts +132 -0
  266. package/src/migrations/0005_purge_once.ts +42 -0
  267. package/src/migrations/0006_verification_outcomes.ts +51 -0
  268. package/src/migrations/0007_erasure_record.ts +43 -0
  269. package/src/migrations/0008_last_active.ts +30 -0
  270. package/src/migrations/pluginTables.ts +19 -1
  271. package/src/migrations/set.ts +9 -1
  272. package/src/processing/activities.ts +14 -0
  273. package/src/purge/contribution.ts +218 -0
  274. package/src/purge/retryPolicy.ts +26 -0
  275. package/src/purge/run.ts +348 -0
  276. package/src/purge/specs.ts +95 -0
  277. package/src/purge/start.ts +79 -0
  278. package/src/purge/workflow.ts +202 -0
  279. package/src/seeds/example.ts +2 -2
  280. package/src/test-utils/accountFootprint.ts +104 -0
  281. package/src/test-utils/liveApp.ts +10 -1
  282. package/src/token/handoff.ts +180 -0
  283. package/src/version.generated.ts +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Passwordless auth for Cloudflare. Magic link, email OTP, Google, Apple, Facebook, GitHub, Microsoft. Mobile and web, both first-class. Built on Better Auth. No email and password, ever.
4
4
 
5
- This capability fills core's identity seams. It mints sessions, issues short-lived JWT access tokens, registers devices, and validates every request — so other capabilities just call `requireAuth()`.
5
+ This capability fills core's identity seams. It mints and rotates sessions, whose token is the bearer credential, issues short-lived JWTs for services outside the Worker, registers devices, and validates every request — so other capabilities just call `requireAuth()`.
6
6
 
7
7
  ```sh
8
8
  pithy add auth
@@ -39,6 +39,8 @@ type AppAuth = AuthInstance<[ReturnType<typeof organization>]>;
39
39
  // …then `inferAdditionalFields<AppAuth>()` in the plugins list above.
40
40
  ```
41
41
 
42
+ **A native app takes the kit's own client, with an `origin`.** `src/client/api.ts` calls the Worker by rooted path on the page's own origin, with its httpOnly cookie, until an `origin` is set: then every request goes to that origin, sends no cookie, and carries the credential the handed-in `fetch` adds. `createBearerSession` in `src/client/bearer.ts` builds that fetch. The credential is the raw session token a sign-in answers with, held in memory and persisted through a secure store (`expo-secure-store`'s Keychain or Keystore), and sent as `Authorization: Bearer` to the Worker's origin and nowhere else. It rotates through `POST /auth/token/rotate` before it expires, one rotation in flight at a time, and the successor is stored before anything uses it. Another capability's client takes the session's `fetch` as its own. A redirect sign-in comes back with a one-time code rather than a cookie, and `src/client/handoff.ts` holds the helpers that trade it: `createHandoffVerifier`, `handoffCallbackURL`, `nativeSignInStartURL`, `handoffCode` and `exchangeHandoff` ([`docs/apple-signin.md`](docs/apple-signin.md) §6). `pithy ui add react-native` scaffolds an app wired to all three.
43
+
42
44
  **This section stays here.** `src/http/routes.ts` and `src/client/api.ts` both explain a design decision by pointing a reader at it by name — the flat response shape is read rather than rewritten precisely because `createAuthClient` is a first-class surface, and that argument is only checkable against the client this documents.
43
45
 
44
46
  ## Provider sign-in is identity-based, by design
@@ -60,7 +62,33 @@ So: **do not "improve" this by matching more addresses, and do not make the refu
60
62
 
61
63
  ## Account lifecycle
62
64
 
63
- An account can be suspended or deleted, and the kit refuses it at every door. Auth's own routes, sign-in and token refresh answer `auth/account_suspended` or `auth/account_deleted` (403); another capability's `requireAuth()` answers 401, and the client's next refresh gets the code. [`docs/account-lifecycle.md`](docs/account-lifecycle.md) has the two states, the record, the scopes, the mail, the hooks, the screens, and the purge contribution a capability declares for its own rows.
65
+ An account can be suspended or deleted, and the kit refuses it at every door. An operator suspends and reinstates one through `POST /auth/admin/users/:userId/suspend` and `/reinstate`, under `auth:users:suspend`, with a reason the trail keeps. They delete one through `DELETE /auth/admin/users/:userId` — soft by default, restorable through `POST …/restore` until the purge window closes, or `mode: "hard"` to purge now — under `auth:users:delete`, and export everything the kit holds about one person through `GET …/export`, under `auth:users:export`. A person deletes their own account with `DELETE /auth/account { confirm: true }`, which is what the App Store and Google Play require of an app with accounts. A purge Workflow, hosted by your own Worker, erases a deleted account from every capability that holds it, one step per capability; the four that keep a person's rows — payments, email, audit and the control plane's legal holds — say why, and the export says it with them. A legal hold on the account stops its purge until it is released, and when the Worker's `retention` block declares class ages, the daily pass soft-deletes an account inactive past them through this same lifecycle. Auth's own routes, sign-in and token refresh answer `auth/account_suspended` or `auth/account_deleted` (403); another capability's `requireAuth()` answers 401, and the client's next refresh gets the code. The admin user reads say where each account stands — `state`, `suspendedUntil` and `purgeAfter` — read the way enforcement reads them. [`docs/account-lifecycle.md`](docs/account-lifecycle.md) has the two states, the record, the scopes, the routes, the purge and the Workflow classes to export for it, the mail, the hooks, the screens, and the purge contribution a capability declares for its own rows.
66
+
67
+ **Every purge can be proved.** The purge records an audit event per step and on completion, and names the step it stopped at when it gives up. `GET /control-plane/erasure/user/:userId`, under `erasure:read`, attests one account's erasure from that record: when it was deleted, by which kind of actor and why, soft or hard, each step erased or kept with its reason, the purge's state, and the audit event behind each step by id and chain position. `GET /control-plane/erasure?since&until` counts every purge in a period and names each failed or overdue one. Nothing about the person crosses but the id. [`docs/CONTROL-PLANE.md` §12](../../docs/CONTROL-PLANE.md#erasure) has the shape.
68
+
69
+ ## Verification ledger
70
+
71
+ Every sign-in link and code auth sends is recorded in `pithy_auth_verification_outcomes`: its type (`magic_link` or `otp`), the verification row that carries it, the account it signs in to, the `pithy_email_jobs` id of the mail that carried it, and when it was issued, expires and was used. Never the token, never the address. Better Auth deletes a verification on its first use, so without this a used link leaves nothing behind and an unused one looks like one still waiting. A sign-up has no account when its link is sent: its row joins to its mail by the job id, and gains the account when the link is used. The row is written when the email seam answers, so a withheld mail is recorded with its suppressed job and a failed one with none, and it is stamped when the link or code creates a session. A wrong code moves the row with it, so the right one entered next still stamps it. A management client reads it through `GET /auth/admin/verifications`, under `auth:verifications:read`: over `since`/`until` (the last 30 days by default), the counts by type of issued, used, expired unused and still pending, and the rows, newest first and paged, narrowed by `type` or `state` if asked. Join `emailJobId` to `email:jobs:read` and `email:suppressions:read` to see which sign-ins failed because the mail did not land. The purge erases an account's rows with the rest of it, and the export carries them.
72
+
73
+ ## Agents: `mcp({ floor })`
74
+
75
+ `mcp` ships in this package beside `auth`, and lets your users' agents use your app as them. Composing it mounts an MCP endpoint at `POST /mcp` with the discovery an MCP client starts from, and composes an OAuth 2.1 authorization server into the auth instance: an agent identifies itself by the URL of a Client ID Metadata Document it publishes, or registers itself dynamically if it predates those, its user signs in and approves on your own consent screen, and the token it gets is bound to that endpoint and that user. A route is a tool only when its `describeRoute({ operation, tool })` says so, and every call runs through that route's own gates, so an agent does what its user can and nothing more.
76
+
77
+ ```sh
78
+ pithy add mcp --floor power:agents:use
79
+ ```
80
+
81
+ ```ts
82
+ mcp({ floor: { power: "agents:use" } }),
83
+ ```
84
+
85
+ **`floor` is required, and has no default.** `"signed-in"` admits every signed-in user, `{ power }` only a caller whose role holds it, `{ entitlement }` only a caller holding it. `pithy doctor` prints the floor in force. `database` must be the D1 binding `auth({ database })` uses; `pithy add mcp` writes it from auth's registration.
86
+
87
+ **Two screens.** `pithy ui add` writes `agent-consent.tsx`, where an agent's user signs in and approves, and `connected-applications.tsx`, where they see and revoke what they approved.
88
+
89
+ **Four tables**, `pithy_mcp_clients`, `pithy_mcp_consents`, `pithy_mcp_access_tokens` and `pithy_mcp_refresh_tokens`, in auth's database under the `mcp` migration namespace. `pithy migrate` creates them.
90
+
91
+ A Worker whose `auth({ plugins })` already composes an OAuth provider is refused: `mcp` composes the one its endpoint uses. [`docs/AGENT-ACCESS.md` §4](../../docs/AGENT-ACCESS.md#4-the-using-path) has the design.
64
92
 
65
93
  ## Server-authoritative writes
66
94
 
@@ -3,8 +3,8 @@
3
3
  import { Session, User } from "../data/betterAuth.js";
4
4
  import { Device } from "../data/device.js";
5
5
  import { ValidationError } from "@pithy-sh/core/src/error/pithyError";
6
- import { decodeCursor, pageLimit, toPage } from "@pithy-sh/core/src/data/cursor";
7
6
  import { MAX_BOUND_PARAMETERS, boundParameterBudget } from "@pithy-sh/core/src/data/boundParameters";
7
+ import { decodeCursor, pageLimit, toPage } from "@pithy-sh/core/src/data/cursor";
8
8
  import { sql } from "kysely";
9
9
  //#region src/admin/users.ts
10
10
  /**
@@ -96,6 +96,19 @@ export declare const AuthAuditActions: {
96
96
  * behind it at all, not the row a cascade wrote.
97
97
  */
98
98
  readonly oauthUnlinked: "auth/oauth_unlinked";
99
+ /**
100
+ * A redirect sign-in ended on a native app's deep link, and the session it made was left there as a one-time
101
+ * code instead of a cookie. Attributed to the account; `sessionId` names the session the code stands for. Outcome
102
+ * `denied`, severity `warning`, when the deep link carried no challenge to bind a code to: no code is issued and
103
+ * the session is deleted.
104
+ */
105
+ readonly handoffIssued: "auth/handoff_issued";
106
+ /**
107
+ * A native app traded a one-time code for its session. Outcome `denied`, severity `warning`, for a code that was
108
+ * spent, expired, never issued or presented with the wrong verifier, with which of those in `metadata.reason` as
109
+ * `expired`, `unknown` or `mismatch`.
110
+ */
111
+ readonly handoffExchanged: "auth/handoff_exchanged";
99
112
  /** A device was registered or updated from sign-in metadata. */
100
113
  readonly deviceRegistered: "auth/device_registered";
101
114
  /** A device was revoked (its session(s) signed out). */
@@ -141,6 +154,8 @@ export declare const AuthAuditActions: {
141
154
  readonly adminUserRead: "auth/admin_user_read";
142
155
  /** The device registry was walked from the management surface. */
143
156
  readonly adminDevicesListed: "auth/admin_devices_listed";
157
+ /** The verification ledger was read from the management surface (#829): counts and rows over a window. */
158
+ readonly adminVerificationsListed: "auth/admin_verifications_listed";
144
159
  /** One named session was revoked from the management surface. */
145
160
  readonly adminSessionRevoked: "auth/admin_session_revoked";
146
161
  /** Every session a user held was revoked from the management surface — signed out everywhere. */
@@ -155,6 +170,12 @@ export declare const AuthAuditActions: {
155
170
  *
156
171
  * The dashboard's own `customer/user_suspended` and `customer/user_restored` are the client side of the
157
172
  * same events, recorded where the operator pressed the button.
173
+ *
174
+ * **The suspend and reinstate routes record every call under the same action (#621)**, the ones the
175
+ * transition did not write included: a refusal as `denied` with its code in `metadata.code`, and a
176
+ * reinstatement that found nothing to lift as a `success` with `metadata.changed: false`. A restated
177
+ * suspension is the transition's own event, with `metadata.updated: true`. So one filter on the action
178
+ * finds every attempt on one account. `../lifecycle/audited.ts` writes the route's half.
158
179
  */
159
180
  /** An account was suspended from the management surface. Carries the reason and any end date. */
160
181
  readonly adminUserSuspended: "auth/admin_user_suspended";
@@ -162,12 +183,49 @@ export declare const AuthAuditActions: {
162
183
  readonly adminUserReinstated: "auth/admin_user_reinstated";
163
184
  /** An account was deleted from the management surface, with its purge window starting now. */
164
185
  readonly adminUserSoftDeleted: "auth/admin_user_soft_deleted";
186
+ /**
187
+ * An account was deleted from the management surface with no window — its purge starts now (#622). Also
188
+ * written when a hard deletion brings an already-deleted account's purge forward, with
189
+ * `metadata.broughtForward: true`. Never written by omission: the route reaches it only for `mode: "hard"`.
190
+ */
191
+ readonly adminUserHardDeleted: "auth/admin_user_hard_deleted";
165
192
  /** A deleted account was restored inside its purge window, from the management surface. */
166
193
  readonly adminUserRestored: "auth/admin_user_restored";
167
194
  /** A deleted account's data was erased. Recorded once, when the last purge step has run. */
168
195
  readonly adminUserPurged: "auth/admin_user_purged";
196
+ /**
197
+ * One purge step answered for a capability's rows: erased them, or kept them under a stated basis (#814).
198
+ * `metadata.step` names the capability and `metadata.disposition` says which. The erasure attestation cites it
199
+ * by event id and chain position (#823).
200
+ */
201
+ readonly adminUserPurgeStep: "auth/admin_user_purge_step";
202
+ /**
203
+ * A purge gave up at the step `metadata.step` names, until the next daily pass starts it again (#823). The
204
+ * erasure attestation cites it, and names every failed purge in a period.
205
+ */
206
+ readonly adminUserPurgeFailed: "auth/admin_user_purge_failed";
169
207
  /** The account's own holder deleted their account. Always a soft deletion, on the configured window. */
170
208
  readonly userSelfDeleted: "auth/user_self_deleted";
209
+ /**
210
+ * Everything the kit holds about one account was exported from the management surface — an access request
211
+ * answered (#622). A **disclosure**, and the largest one on this surface: it carries every composed
212
+ * capability's rows about the person. Recorded with the caller, the reason they gave, and which capabilities
213
+ * answered; never with any of the data.
214
+ */
215
+ readonly adminUserExported: "auth/admin_user_exported";
216
+ /**
217
+ * A user let an MCP client act as them in this application. The one decision the consent screen asks,
218
+ * recorded with the client's id and the redirect it will send tokens to — the thing that identifies it, since
219
+ * its name is whatever it said. Asking again is a new consent and a new row.
220
+ */
221
+ readonly mcpGrantApproved: "auth/mcp_grant_approved";
222
+ /** A user refused an MCP client on the consent screen. */
223
+ readonly mcpGrantDenied: "auth/mcp_grant_denied";
224
+ /**
225
+ * A user revoked an MCP client from their connected applications. Its consent and refresh tokens are gone
226
+ * and its next call is refused. Revocation is the only narrowing the user has, so it is recorded like a grant.
227
+ */
228
+ readonly mcpGrantRevoked: "auth/mcp_grant_revoked";
171
229
  };
172
230
  /** One of the auth audit action codes. */
173
231
  export type AuthAuditAction = (typeof AuthAuditActions)[keyof typeof AuthAuditActions];
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/audit/actions.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;IAC3B,+FAA+F;aAC/F,MAAM,EAAE,aAAa;IACrB;;;;;;;;OAQG;aACH,OAAO,EAAE,cAAc;IACvB;;;;OAIG;aACH,YAAY,EAAE,oBAAoB;IAClC,sHAAsH;aACtH,kBAAkB,EAAE,2BAA2B;IAC/C;;;;;OAKG;aACH,aAAa,EAAE,sBAAsB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;aACH,kBAAkB,EAAE,4BAA4B;IAChD;;;OAGG;aACH,oBAAoB,EAAE,8BAA8B;IACpD,wGAAwG;aACxG,eAAe,EAAE,wBAAwB;IACzC;;;;;OAKG;aACH,iBAAiB,EAAE,0BAA0B;IAC7C;;;;OAIG;aACH,gBAAgB,EAAE,yBAAyB;IAC3C,0DAA0D;aAC1D,cAAc,EAAE,uBAAuB;IACvC;;;OAGG;aACH,eAAe,EAAE,wBAAwB;CACjC,CAAC;AAEX,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC"}
@@ -97,6 +97,19 @@ const AuthAuditActions = {
97
97
  * behind it at all, not the row a cascade wrote.
98
98
  */
99
99
  oauthUnlinked: "auth/oauth_unlinked",
100
+ /**
101
+ * A redirect sign-in ended on a native app's deep link, and the session it made was left there as a one-time
102
+ * code instead of a cookie. Attributed to the account; `sessionId` names the session the code stands for. Outcome
103
+ * `denied`, severity `warning`, when the deep link carried no challenge to bind a code to: no code is issued and
104
+ * the session is deleted.
105
+ */
106
+ handoffIssued: "auth/handoff_issued",
107
+ /**
108
+ * A native app traded a one-time code for its session. Outcome `denied`, severity `warning`, for a code that was
109
+ * spent, expired, never issued or presented with the wrong verifier, with which of those in `metadata.reason` as
110
+ * `expired`, `unknown` or `mismatch`.
111
+ */
112
+ handoffExchanged: "auth/handoff_exchanged",
100
113
  /** A device was registered or updated from sign-in metadata. */
101
114
  deviceRegistered: "auth/device_registered",
102
115
  /** A device was revoked (its session(s) signed out). */
@@ -142,6 +155,8 @@ const AuthAuditActions = {
142
155
  adminUserRead: "auth/admin_user_read",
143
156
  /** The device registry was walked from the management surface. */
144
157
  adminDevicesListed: "auth/admin_devices_listed",
158
+ /** The verification ledger was read from the management surface (#829): counts and rows over a window. */
159
+ adminVerificationsListed: "auth/admin_verifications_listed",
145
160
  /** One named session was revoked from the management surface. */
146
161
  adminSessionRevoked: "auth/admin_session_revoked",
147
162
  /** Every session a user held was revoked from the management surface — signed out everywhere. */
@@ -156,6 +171,12 @@ const AuthAuditActions = {
156
171
  *
157
172
  * The dashboard's own `customer/user_suspended` and `customer/user_restored` are the client side of the
158
173
  * same events, recorded where the operator pressed the button.
174
+ *
175
+ * **The suspend and reinstate routes record every call under the same action (#621)**, the ones the
176
+ * transition did not write included: a refusal as `denied` with its code in `metadata.code`, and a
177
+ * reinstatement that found nothing to lift as a `success` with `metadata.changed: false`. A restated
178
+ * suspension is the transition's own event, with `metadata.updated: true`. So one filter on the action
179
+ * finds every attempt on one account. `../lifecycle/audited.ts` writes the route's half.
159
180
  */
160
181
  /** An account was suspended from the management surface. Carries the reason and any end date. */
161
182
  adminUserSuspended: "auth/admin_user_suspended",
@@ -163,12 +184,49 @@ const AuthAuditActions = {
163
184
  adminUserReinstated: "auth/admin_user_reinstated",
164
185
  /** An account was deleted from the management surface, with its purge window starting now. */
165
186
  adminUserSoftDeleted: "auth/admin_user_soft_deleted",
187
+ /**
188
+ * An account was deleted from the management surface with no window — its purge starts now (#622). Also
189
+ * written when a hard deletion brings an already-deleted account's purge forward, with
190
+ * `metadata.broughtForward: true`. Never written by omission: the route reaches it only for `mode: "hard"`.
191
+ */
192
+ adminUserHardDeleted: "auth/admin_user_hard_deleted",
166
193
  /** A deleted account was restored inside its purge window, from the management surface. */
167
194
  adminUserRestored: "auth/admin_user_restored",
168
195
  /** A deleted account's data was erased. Recorded once, when the last purge step has run. */
169
196
  adminUserPurged: "auth/admin_user_purged",
197
+ /**
198
+ * One purge step answered for a capability's rows: erased them, or kept them under a stated basis (#814).
199
+ * `metadata.step` names the capability and `metadata.disposition` says which. The erasure attestation cites it
200
+ * by event id and chain position (#823).
201
+ */
202
+ adminUserPurgeStep: "auth/admin_user_purge_step",
203
+ /**
204
+ * A purge gave up at the step `metadata.step` names, until the next daily pass starts it again (#823). The
205
+ * erasure attestation cites it, and names every failed purge in a period.
206
+ */
207
+ adminUserPurgeFailed: "auth/admin_user_purge_failed",
170
208
  /** The account's own holder deleted their account. Always a soft deletion, on the configured window. */
171
- userSelfDeleted: "auth/user_self_deleted"
209
+ userSelfDeleted: "auth/user_self_deleted",
210
+ /**
211
+ * Everything the kit holds about one account was exported from the management surface — an access request
212
+ * answered (#622). A **disclosure**, and the largest one on this surface: it carries every composed
213
+ * capability's rows about the person. Recorded with the caller, the reason they gave, and which capabilities
214
+ * answered; never with any of the data.
215
+ */
216
+ adminUserExported: "auth/admin_user_exported",
217
+ /**
218
+ * A user let an MCP client act as them in this application. The one decision the consent screen asks,
219
+ * recorded with the client's id and the redirect it will send tokens to — the thing that identifies it, since
220
+ * its name is whatever it said. Asking again is a new consent and a new row.
221
+ */
222
+ mcpGrantApproved: "auth/mcp_grant_approved",
223
+ /** A user refused an MCP client on the consent screen. */
224
+ mcpGrantDenied: "auth/mcp_grant_denied",
225
+ /**
226
+ * A user revoked an MCP client from their connected applications. Its consent and refresh tokens are gone
227
+ * and its next call is refused. Revocation is the only narrowing the user has, so it is recorded like a grant.
228
+ */
229
+ mcpGrantRevoked: "auth/mcp_grant_revoked"
172
230
  };
173
231
  //#endregion
174
232
  export { AuthAuditActions };
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  import type { AuditEmit } from "@pithy-sh/core/src/audit/recorder";
4
4
  import { z } from "zod";
5
+ import type { HandoffRefusal } from "../token/handoff";
5
6
  import { type AuthAuditAction } from "./actions";
6
7
  import type { AuthEmailDelivery, EndedSession } from "./evidence";
7
8
  /**
@@ -231,6 +232,8 @@ export declare function emitControlPlaneAction(emit: AuditEmit, event: {
231
232
  userAgent?: string;
232
233
  requestId?: string;
233
234
  metadata?: Record<string, unknown>;
235
+ /** `success` unless the call was refused (`denied`) or broke (`failure`) — #621 records both. */
236
+ outcome?: "success" | "denied" | "failure";
234
237
  }): Promise<void>;
235
238
  /**
236
239
  * Emit a `provider_unavailable` event — somebody asked for a sign-in method this deployment enables and
@@ -331,6 +334,39 @@ export declare function emitProviderChangeNotFresh(emit: AuditEmit, context: {
331
334
  sessionId: string;
332
335
  headers: Headers | undefined;
333
336
  }): Promise<void>;
337
+ /**
338
+ * Emit a `handoff_issued` event: a redirect sign-in's session left on a deep link as a one-time code, or, denied,
339
+ * a sign-in whose deep link carried no challenge, or a magic link to a custom scheme, so no code was issued.
340
+ */
341
+ export declare function emitHandoffIssued(emit: AuditEmit, context: ({
342
+ outcome: "success";
343
+ }
344
+ /** `unbound`: the link carried no challenge to bind a code to. `scheme`: a magic link to a custom scheme. */
345
+ | {
346
+ outcome: "denied";
347
+ reason: "unbound" | "scheme";
348
+ }) & {
349
+ userId: string;
350
+ sessionId: string;
351
+ ip?: string;
352
+ userAgent?: string;
353
+ }): Promise<void>;
354
+ /**
355
+ * Emit a `handoff_exchanged` event. A traded code is attributed to the account it signed in; a refused one is
356
+ * anonymous, because the code named nobody anybody can trust.
357
+ */
358
+ export declare function emitHandoffExchanged(emit: AuditEmit, context: {
359
+ outcome: "success";
360
+ userId: string;
361
+ sessionId: string;
362
+ ip?: string;
363
+ userAgent?: string;
364
+ } | {
365
+ outcome: "denied";
366
+ reason: HandoffRefusal;
367
+ ip?: string;
368
+ userAgent?: string;
369
+ }): Promise<void>;
334
370
  /** A blocked/failed auth attempt — recorded as `denied` (first-class). */
335
371
  export declare function emitDenied(emit: AuditEmit, context: {
336
372
  ip?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/audit/emit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,WAAW,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAElE;;;;;;;GAOG;AAEH,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,OAA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iBAAiB,CACrC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,CACL;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE;AACxB,6GAA6G;GAC3G;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAA;CAAE,CACtD,GAAG;IACF,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,OAAO,CAAC,IAAI,CAAC,CAWf;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,SAAS,EACf,OAAO,EACH;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1F;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACjF,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED,0EAA0E;AAC1E,wBAAsB,UAAU,CAC9B,IAAI,EAAE,SAAS,EACf,OAAO,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5D,OAAO,CAAC,IAAI,CAAC,CASf"}
@@ -257,7 +257,7 @@ async function emitDeviceRevoked(emit, context) {
257
257
  async function emitControlPlaneAction(emit, event) {
258
258
  await safeEmit(emit, {
259
259
  action: event.action,
260
- outcome: "success",
260
+ outcome: event.outcome ?? "success",
261
261
  actorType: "control-plane",
262
262
  actorId: event.subject,
263
263
  resourceType: event.resourceType,
@@ -408,6 +408,52 @@ async function emitProviderChangeNotFresh(emit, context) {
408
408
  ...correlation(context.headers)
409
409
  });
410
410
  }
411
+ /**
412
+ * Emit a `handoff_issued` event: a redirect sign-in's session left on a deep link as a one-time code, or, denied,
413
+ * a sign-in whose deep link carried no challenge, or a magic link to a custom scheme, so no code was issued.
414
+ */
415
+ async function emitHandoffIssued(emit, context) {
416
+ await safeEmit(emit, {
417
+ action: AuthAuditActions.handoffIssued,
418
+ outcome: context.outcome,
419
+ ...context.outcome === "denied" ? {
420
+ severity: "warning",
421
+ metadata: { reason: context.reason }
422
+ } : {},
423
+ actorType: "user",
424
+ actorId: context.userId,
425
+ sessionId: context.sessionId,
426
+ ip: context.ip,
427
+ userAgent: context.userAgent
428
+ });
429
+ }
430
+ /**
431
+ * Emit a `handoff_exchanged` event. A traded code is attributed to the account it signed in; a refused one is
432
+ * anonymous, because the code named nobody anybody can trust.
433
+ */
434
+ async function emitHandoffExchanged(emit, context) {
435
+ if (context.outcome === "success") {
436
+ await safeEmit(emit, {
437
+ action: AuthAuditActions.handoffExchanged,
438
+ outcome: "success",
439
+ actorType: "user",
440
+ actorId: context.userId,
441
+ sessionId: context.sessionId,
442
+ ip: context.ip,
443
+ userAgent: context.userAgent
444
+ });
445
+ return;
446
+ }
447
+ await safeEmit(emit, {
448
+ action: AuthAuditActions.handoffExchanged,
449
+ outcome: "denied",
450
+ severity: "warning",
451
+ actorType: "anonymous",
452
+ ip: context.ip,
453
+ userAgent: context.userAgent,
454
+ metadata: { reason: context.reason }
455
+ });
456
+ }
411
457
  /** A blocked/failed auth attempt — recorded as `denied` (first-class). */
412
458
  async function emitDenied(emit, context) {
413
459
  await safeEmit(emit, {
@@ -420,4 +466,4 @@ async function emitDenied(emit, context) {
420
466
  });
421
467
  }
422
468
  //#endregion
423
- export { EVIDENCE_OBSERVERS, PATH_EVENTS, ProviderAccount, correlation, emitAfterRequest, emitControlPlaneAction, emitDenied, emitDeviceRevoked, emitProviderAccountChanged, emitProviderChangeNotFresh, emitProviderUnavailable, emitTokenRefresh, emitTokenReuseDetected, wasRefused };
469
+ export { EVIDENCE_OBSERVERS, PATH_EVENTS, ProviderAccount, correlation, emitAfterRequest, emitControlPlaneAction, emitDenied, emitDeviceRevoked, emitHandoffExchanged, emitHandoffIssued, emitProviderAccountChanged, emitProviderChangeNotFresh, emitProviderUnavailable, emitTokenRefresh, emitTokenReuseDetected, wasRefused };
@@ -56,14 +56,20 @@ export declare function sessionEndedDuring(requestContext: unknown): EndedSessio
56
56
  * error's text is the one thing in reach that nobody has vetted for what it might carry.
57
57
  */
58
58
  export type AuthEmailDelivery =
59
- /** Handed to the email seam, which wrote a job row for it. A send is what the trail may claim. */
59
+ /**
60
+ * Handed to the email seam, which wrote a job row for it. A send is what the trail may claim. `jobId` is that
61
+ * row's, for the verification ledger to join on (#829); optional, because a seam a test stands in for may not
62
+ * say.
63
+ */
60
64
  {
61
65
  readonly delivery: "queued";
66
+ readonly jobId?: string;
62
67
  }
63
- /** The capability withheld it, correctly, and named why. Not a fault, and not a send. */
68
+ /** The capability withheld it, correctly, and named why. Not a fault, and not a send. Its row is `jobId`. */
64
69
  | {
65
70
  readonly delivery: "withheld";
66
71
  readonly reason: string;
72
+ readonly jobId?: string;
67
73
  }
68
74
  /** The seam itself failed. Nothing was queued and something is wrong with this deployment. */
69
75
  | {
@@ -1 +1 @@
1
- {"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../src/audit/evidence.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,0GAA0G;AAC1G,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAK/E;AAED,8FAA8F;AAC9F,w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OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAa1B;AAED,2GAA2G;AAC3G,MAAM,WAAW,gBAAgB;IAC/B,qGAAqG;IACrG,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6GAA6G;IAC7G,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,OAAO,GAAG,gBAAgB,CAgB1E"}
@@ -1,13 +1,17 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
3
  import type { D1Database } from "@cloudflare/workers-types";
4
+ import type { AuditEmit } from "@pithy-sh/core/src/audit/recorder";
4
5
  import type { Capability, PithyHonoEnv } from "@pithy-sh/core/src/capability/capability";
6
+ import { type PurgeStep } from "@pithy-sh/core/src/capability/purge";
5
7
  import type { EmailCapability } from "@pithy-sh/email/src/capability";
6
- import { type TurnstileMode } from "@pithy-sh/turnstile/src/config/config";
8
+ import { type TurnstileCapability } from "@pithy-sh/turnstile/src/capability";
9
+ import { type TurnstileMode, type TurnstileTokenSource } from "@pithy-sh/turnstile/src/config/config";
7
10
  import type { Context } from "hono";
8
11
  import { z } from "zod";
9
12
  import type { GithubUserInfoResolver } from "./instance/githubUserInfo";
10
13
  import type { UserLifecycleHooks } from "./lifecycle/hooks";
14
+ import type { McpHost, McpWiring } from "./mcp/host";
11
15
  import { type AuthPeer } from "./peer";
12
16
  /** The auth capability's configuration — the thin surface an adopter owns in `pithy.config.ts`. */
13
17
  export declare const AuthConfig: z.ZodObject<{
@@ -44,6 +48,7 @@ export declare const AuthConfig: z.ZodObject<{
44
48
  disableSignUp: z.ZodDefault<z.ZodBoolean>;
45
49
  retention: z.ZodPrefault<z.ZodObject<{
46
50
  purgeAfterDays: z.ZodDefault<z.ZodNumber>;
51
+ restoreUrl: z.ZodOptional<z.ZodURL>;
47
52
  }, z.core.$strip>>;
48
53
  lifecycleEmails: z.ZodPrefault<z.ZodObject<{
49
54
  accountSuspended: z.ZodDefault<z.ZodBoolean>;
@@ -55,6 +60,14 @@ export declare const AuthConfig: z.ZodObject<{
55
60
  }, z.core.$strip>;
56
61
  export type AuthConfig = z.output<typeof AuthConfig>;
57
62
  export type AuthConfigInput = z.input<typeof AuthConfig>;
63
+ /** The widget the sign-in routes are gated with, and where the gate reads its token. */
64
+ export interface TurnstileLoginGate {
65
+ mode: TurnstileMode;
66
+ /** The `token` source turnstile's config names, which its client projection hands a screen. */
67
+ token: TurnstileTokenSource;
68
+ }
69
+ /** The sign-in gate a composed turnstile asks for, or `undefined` when none is composed or sign-in is unprotected. */
70
+ export declare function turnstileLoginGate(capability: TurnstileCapability | undefined): TurnstileLoginGate | undefined;
58
71
  /**
59
72
  * The runtime wiring the middleware and routes close over. `config` is known at `auth()` call time;
60
73
  * `emailConfig` and `turnstile` are filled by `compose` from the composed peer capabilities, before
@@ -67,9 +80,7 @@ export interface AuthWiring {
67
80
  /** The email capability's bound enqueue seam — how magic-link/OTP are delivered. Set by `compose`. */
68
81
  enqueueEmail: EmailCapability["enqueue"] | undefined;
69
82
  /** The turnstile login gate, when the turnstile capability is composed. Set by `compose`. */
70
- turnstile: {
71
- mode: TurnstileMode;
72
- } | undefined;
83
+ turnstile: TurnstileLoginGate | undefined;
73
84
  /**
74
85
  * The adopter's session-revoked listener, or absent. See {@link AuthOptions.onSessionRevoked}.
75
86
  *
@@ -89,6 +100,22 @@ export interface AuthWiring {
89
100
  * Optional on the wiring for the reason `onSessionRevoked` is: no hook is the ordinary composition.
90
101
  */
91
102
  lifecycleHooks?: UserLifecycleHooks | undefined;
103
+ /**
104
+ * Every composed capability's purge step for a user, auth's own among them, in composition order. Filled
105
+ * by `compose`; the export route reads every capability's contribution from it, and the purge runs it.
106
+ * Optional on the wiring for the reason `onSessionRevoked` is: a harness that builds this by hand composes none.
107
+ */
108
+ purgeSteps?: readonly PurgeStep[] | undefined;
109
+ /**
110
+ * The MCP capability's endpoint and consent screen, when one is composed beside this one. Set by
111
+ * `compose`; the instance then carries the OAuth provider that mints its tokens.
112
+ */
113
+ mcp?: McpWiring | undefined;
114
+ /**
115
+ * Every capability composed beside this one, auth among them. Set by `compose`; a rotation announces itself to
116
+ * each one's `sessionRotated` through core. Optional on the wiring for the reason `onSessionRevoked` is.
117
+ */
118
+ composed?: readonly Capability[] | undefined;
92
119
  }
93
120
  /** The session a {@link ScopeResolver} is asked about — the one Better Auth just resolved for this request. */
94
121
  export interface ScopeResolverSession {
@@ -98,7 +125,7 @@ export interface ScopeResolverSession {
98
125
  sessionId: string;
99
126
  }
100
127
  /**
101
- * Decide what this request's caller is, and answer the scopes that attests to (#560).
128
+ * Decide what this request's caller is, and answer the scopes that attests to.
102
129
  *
103
130
  * Called by the session middleware on every authenticated request, after Better Auth has resolved the
104
131
  * session and before any route runs. What it returns becomes `AuthContext.scopes`. It reads the **request**,
@@ -159,7 +186,7 @@ export type AuthOptions = AuthConfigInput & UserLifecycleHooks & {
159
186
  */
160
187
  onSessionRevoked?: SessionRevokedListener;
161
188
  /**
162
- * Decide, per request, what this request's caller is — and so which scope gates it opens (#560).
189
+ * Decide, per request, what this request's caller is — and so which scope gates it opens.
163
190
  *
164
191
  * `leaderboard:submit`, `rating:record`, `leaderboard:admin` and `ledger:admin` are **attestations about
165
192
  * the caller, not permissions granted to the user**: each says *this write came from the adopter's own
@@ -183,15 +210,27 @@ export interface AuthCapability extends Capability {
183
210
  authConfig: AuthConfig;
184
211
  /**
185
212
  * The adopter's account-lifecycle hooks, as `auth()` was handed them. Read by whatever runs a transition
186
- * outside a request this capability serves — the purge Workflow (#622) fires `onUserPurged` through it.
213
+ * outside a request this capability serves — the purge Workflow fires `onUserPurged` through it.
187
214
  */
188
215
  lifecycleHooks: UserLifecycleHooks;
216
+ /**
217
+ * Every composed capability's purge step for a user, auth's own among them, in composition order. Empty
218
+ * until `compose` has run. Read by the purge Workflow, which runs in the Worker that composed it.
219
+ */
220
+ purgeSteps: readonly PurgeStep[];
221
+ /**
222
+ * The audit recorder for code with no request, over one run's env — the composed audit capability's, or the
223
+ * no-op. Read by the purge Workflow, which owes the trail its `auth/admin_user_purged`.
224
+ */
225
+ auditFor: (env: Record<string, unknown>) => AuditEmit;
189
226
  /**
190
227
  * What a capability composed beside this one reads an account through — `matchmaking`, `support`,
191
228
  * `testers`. Found in their `compose` hooks, so none of them imports this package and a project without
192
- * auth bundles them (#645). See `peer.ts`.
229
+ * auth bundles them. See `peer.ts`.
193
230
  */
194
231
  authPeer: AuthPeer;
232
+ /** What the MCP capability composed beside this one reads. See `mcp/host.ts`. */
233
+ mcpHost: McpHost;
195
234
  }
196
235
  /**
197
236
  * The auth capability. Passwordless sign-in (magic link, OTP, Google, Apple), the hybrid bearer +
@@ -1 +1 @@
1
- {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAmB,MAAM,0CAA0C,CAAC;AAG1G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAI5D,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,QAAQ,CAAC;AA8BjD,mGAAmG;AACnG,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoH8B,CAAC;AACtD,MAAM,M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