@pithy-sh/auth 0.14.1 → 0.15.1

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 (42) hide show
  1. package/README.md +4 -0
  2. package/dist/audit/actions.d.ts +32 -28
  3. package/dist/audit/actions.d.ts.map +1 -1
  4. package/dist/audit/actions.js +32 -28
  5. package/dist/audit/emit.d.ts +40 -34
  6. package/dist/audit/emit.d.ts.map +1 -1
  7. package/dist/audit/emit.js +45 -32
  8. package/dist/capability.js +1 -1
  9. package/dist/http/middleware.js +1 -1
  10. package/dist/http/providerFreshness.d.ts +30 -31
  11. package/dist/http/providerFreshness.d.ts.map +1 -1
  12. package/dist/http/providerFreshness.js +26 -31
  13. package/dist/http/recentSignIn.d.ts +57 -0
  14. package/dist/http/recentSignIn.d.ts.map +1 -0
  15. package/dist/http/recentSignIn.js +88 -0
  16. package/dist/http/routes.js +2 -2
  17. package/dist/index.d.ts +4 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +2 -1
  20. package/dist/instance/auth.js +2 -2
  21. package/dist/mcp/http/routes.js +2 -2
  22. package/dist/test-utils/dropOrder.d.ts +26 -0
  23. package/dist/test-utils/dropOrder.d.ts.map +1 -0
  24. package/dist/test-utils/dropOrder.js +120 -0
  25. package/dist/test-utils/scopedBackend.d.ts +10 -6
  26. package/dist/test-utils/scopedBackend.d.ts.map +1 -1
  27. package/dist/test-utils/scopedBackend.js +40 -12
  28. package/dist/version.generated.d.ts +1 -1
  29. package/dist/version.generated.js +1 -1
  30. package/docs/account-lifecycle.md +1 -1
  31. package/docs/recent-sign-in.md +90 -0
  32. package/package.json +5 -5
  33. package/pithy.manifest.json +4 -0
  34. package/pithy.mcp.manifest.json +1 -0
  35. package/src/audit/actions.ts +32 -28
  36. package/src/audit/emit.ts +50 -34
  37. package/src/http/providerFreshness.ts +40 -42
  38. package/src/http/recentSignIn.ts +114 -0
  39. package/src/index.ts +4 -2
  40. package/src/test-utils/dropOrder.ts +139 -0
  41. package/src/test-utils/scopedBackend.ts +51 -13
  42. package/src/version.generated.ts +1 -1
package/README.md CHANGED
@@ -60,6 +60,10 @@ So: **do not "improve" this by matching more addresses, and do not make the refu
60
60
 
61
61
  **Microsoft reaches row 3 more than any other provider, on purpose.** Entra ID cannot vouch for an email it did not verify: its `email` is a directory attribute a tenant admin sets to anything. So a Microsoft address is verified only by the `xms_edov` claim, the personal-accounts tenant, or — connecting from inside the account — matching the address the account already holds. `src/instance/microsoftEmail.ts` is the rule and `docs/microsoft-oauth.md` is the setup.
62
62
 
63
+ ## A recent sign-in for an app route
64
+
65
+ `requireRecentSignIn({ maxAgeSeconds, purpose })` gates one app route on a sign-in within the window it names: revealing a stored secret, changing who can see something. It stacks after the route's own gates. A session signed in longer ago is refused with 403 `auth/recent_sign_in_required`, the same code on every gated route, and the refusal is recorded as `auth/recent_sign_in_refused` with your `purpose`. A bearer session and a cookie session are judged alike, and the remedy is the same for both: sign in again, then retry. Rotating a token never passes, because a rotation keeps the original sign-in time. [`docs/recent-sign-in.md`](docs/recent-sign-in.md) says when to use the gate and how a web and a phone client handle the refusal.
66
+
63
67
  ## Account lifecycle
64
68
 
65
69
  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 `POST …/export` with the reason in the body, 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.
@@ -15,8 +15,8 @@ export declare const AuthAuditActions: {
15
15
  * A sign-out / session revocation completed — and **completed** is the load-bearing word.
16
16
  *
17
17
  * `/sign-out` answers `200 {"success":true}` whether or not it found a session to delete: an expired
18
- * cookie, a bearer token (which it does not read) or a bare `curl` all get the same body. Recorded off
19
- * the path, every one of them wrote a sign-out that signed nobody out. The evidence is a session row
18
+ * cookie, a bearer token (which it does not read) or a bare `curl` all get the same body, so the path is
19
+ * no evidence that anybody was signed out. The evidence is a session row
20
20
  * disappearing, which `../instance/auth.ts`'s `session.delete.after` observes and `../audit/evidence.ts`
21
21
  * carries to the emitter; with no session gone there is no event, because nothing happened.
22
22
  */
@@ -37,14 +37,13 @@ export declare const AuthAuditActions: {
37
37
  */
38
38
  readonly magicLinkSent: "auth/magic_link_sent";
39
39
  /**
40
- * An email OTP was requested and enqueued for delivery. Same claim, same evidence — and this is the
41
- * endpoint that made the point (#627).
40
+ * An email OTP was requested and enqueued for delivery. Same claim, same evidence.
42
41
  *
43
42
  * It declines twice over and answers `200 {"success":true}` both times. Better Auth drops the
44
43
  * verification row and returns success rather than confirm that an address is registered, which is the
45
44
  * whole reason the response is shaped that way; and the kit's own `sendVerificationOTP` returns without
46
- * queuing for any `type` but `sign-in`, because an OTP is a sign-in credential here. Read off the
47
- * status, every one of those wrote a send that never happened.
45
+ * queuing for any `type` but `sign-in`, because an OTP is a sign-in credential here. The status says
46
+ * nothing about whether a message was made.
48
47
  *
49
48
  * **Two more declines sit under the send callback rather than over it, and they are not the same
50
49
  * thing as each other.** `@pithy-sh/email` withholds a message to a suppressed address — a hard bounce,
@@ -63,17 +62,13 @@ export declare const AuthAuditActions: {
63
62
  /**
64
63
  * A social account row was created — from here on that provider can sign in as this user.
65
64
  *
66
- * **Emitted from the row, not from `/link-social`, and that is the whole of #627.** Minting the
67
- * provider redirect is a request; the account row is created later at `/callback/:id` and may never be
68
- * created at all — the person abandons the consent screen, the provider refuses, the linking gate
69
- * rejects it. Recorded at the request, every one of those wrote a success row for a link that never
70
- * happened, which makes "which providers can sign in as this account today" unanswerable from the
71
- * trail that exists to answer it.
65
+ * **Emitted from the row, not from `/link-social`.** Minting the provider redirect is a request; the
66
+ * account row is created later at `/callback/:id` and may never be created at all — the person abandons
67
+ * the consent screen, the provider refuses, the linking gate rejects it. Only the row answers "which
68
+ * providers can sign in as this account today".
72
69
  *
73
- * **A first social sign-up writes this too, deliberately.** The endpoint wiring this replaced refused
74
- * to map `/callback/:id` because doing so "would mislabel every first sign-up as a link" — true of a
75
- * *path*, which cannot tell a sign-up from a link. From the row it stops mattering: this event claims a
76
- * provider can now sign in as this user, and a first social sign-up is exactly when that becomes true.
70
+ * **A first social sign-up writes this too, deliberately.** This event claims a provider can now sign in
71
+ * as this user, and a first social sign-up is exactly when that becomes true.
77
72
  * Pinned by `emit.workers.test.ts`, so the decision is asserted rather than inferred from the absence
78
73
  * of a branch.
79
74
  */
@@ -81,8 +76,7 @@ export declare const AuthAuditActions: {
81
76
  /**
82
77
  * A social account row was removed — that provider can no longer sign in as this user.
83
78
  *
84
- * The other half of the same question, and it emitted nothing at all until #627: a provider was
85
- * detached and the trail was silent. Emitted from the row for the same reason its twin is, which also
79
+ * The other half of the same question. Emitted from the row for the same reason its twin is, which also
86
80
  * means it covers every way a link ends — `/unlink-account`, and the cascade when a user is deleted —
87
81
  * rather than the one endpoint somebody remembered to wire. Both are driven in `emit.workers.test.ts`:
88
82
  * a sentence claiming a class is covered is not the same as a test that reddens when it stops being.
@@ -115,7 +109,7 @@ export declare const AuthAuditActions: {
115
109
  readonly deviceRevoked: "auth/device_revoked";
116
110
  /**
117
111
  * Somebody tried to sign in with a provider this deployment enables and cannot serve — its credential
118
- * would not resolve, so the instance was built without it (#381). Outcome `denied`, severity
112
+ * would not resolve, so the instance was built without it. Outcome `denied`, severity
119
113
  * `warning`.
120
114
  *
121
115
  * **This is the operator's channel, and it is why degrading is not the same as degrading silently.**
@@ -134,9 +128,19 @@ export declare const AuthAuditActions: {
134
128
  * account-takeover step". One is a person who left a tab open; a run of them against one user id is the
135
129
  * incident, and without the row there is nothing to count.
136
130
  *
137
- * Mirrors the error code, which is this file's one precedent for doing so.
131
+ * Mirrors the error code.
138
132
  */
139
133
  readonly sessionNotFresh: "auth/session_not_fresh";
134
+ /**
135
+ * Somebody signed in reached an app route gated by `requireRecentSignIn` without having signed in within
136
+ * that route's window. Outcome `denied`, severity `warning`, with the route's `purpose` in
137
+ * `metadata.purpose`.
138
+ *
139
+ * One action for every gated route, so one filter finds every refusal and the purpose says which route.
140
+ * A run of them against one user id is a stolen credential being walked toward something the app
141
+ * protects.
142
+ */
143
+ readonly recentSignInRefused: "auth/recent_sign_in_refused";
140
144
  /**
141
145
  * The admin actions, emitted only from the control-plane surface (`http/adminRoutes.ts`) and always
142
146
  * with `actorType: "control-plane"` — a management client is not a user of the adopter's app, so its
@@ -154,7 +158,7 @@ export declare const AuthAuditActions: {
154
158
  readonly adminUserRead: "auth/admin_user_read";
155
159
  /** The device registry was walked from the management surface. */
156
160
  readonly adminDevicesListed: "auth/admin_devices_listed";
157
- /** The verification ledger was read from the management surface (#829): counts and rows over a window. */
161
+ /** The verification ledger was read from the management surface: counts and rows over a window. */
158
162
  readonly adminVerificationsListed: "auth/admin_verifications_listed";
159
163
  /** One named session was revoked from the management surface. */
160
164
  readonly adminSessionRevoked: "auth/admin_session_revoked";
@@ -163,7 +167,7 @@ export declare const AuthAuditActions: {
163
167
  /** One of a user's devices was signed out and its registration dropped, from the management surface. */
164
168
  readonly adminDeviceRevoked: "auth/admin_device_revoked";
165
169
  /**
166
- * The account lifecycle (#620). Each is written by the transition in `../lifecycle/transitions.ts`, beside
170
+ * The account lifecycle. Each is written by the transition in `../lifecycle/transitions.ts`, beside
167
171
  * the `pithy_auth_user_lifecycle` row that records the same fact — the trail answers "who, from where", the
168
172
  * table answers "what happened to this account". The admin ones carry `actorType: "control-plane"`; the
169
173
  * self-service deletion carries the account's own holder, and the purge `system`.
@@ -171,7 +175,7 @@ export declare const AuthAuditActions: {
171
175
  * The dashboard's own `customer/user_suspended` and `customer/user_restored` are the client side of the
172
176
  * same events, recorded where the operator pressed the button.
173
177
  *
174
- * **The suspend and reinstate routes record every call under the same action (#621)**, the ones the
178
+ * **The suspend and reinstate routes record every call under the same action**, the ones the
175
179
  * transition did not write included: a refusal as `denied` with its code in `metadata.code`, and a
176
180
  * reinstatement that found nothing to lift as a `success` with `metadata.changed: false`. A restated
177
181
  * suspension is the transition's own event, with `metadata.updated: true`. So one filter on the action
@@ -184,7 +188,7 @@ export declare const AuthAuditActions: {
184
188
  /** An account was deleted from the management surface, with its purge window starting now. */
185
189
  readonly adminUserSoftDeleted: "auth/admin_user_soft_deleted";
186
190
  /**
187
- * An account was deleted from the management surface with no window — its purge starts now (#622). Also
191
+ * An account was deleted from the management surface with no window — its purge starts now. Also
188
192
  * written when a hard deletion brings an already-deleted account's purge forward, with
189
193
  * `metadata.broughtForward: true`. Never written by omission: the route reaches it only for `mode: "hard"`.
190
194
  */
@@ -194,13 +198,13 @@ export declare const AuthAuditActions: {
194
198
  /** A deleted account's data was erased. Recorded once, when the last purge step has run. */
195
199
  readonly adminUserPurged: "auth/admin_user_purged";
196
200
  /**
197
- * One purge step answered for a capability's rows: erased them, or kept them under a stated basis (#814).
201
+ * One purge step answered for a capability's rows: erased them, or kept them under a stated basis.
198
202
  * `metadata.step` names the capability and `metadata.disposition` says which. The erasure attestation cites it
199
- * by event id and chain position (#823).
203
+ * by event id and chain position.
200
204
  */
201
205
  readonly adminUserPurgeStep: "auth/admin_user_purge_step";
202
206
  /**
203
- * A purge gave up at the step `metadata.step` names, until the next daily pass starts it again (#823). The
207
+ * A purge gave up at the step `metadata.step` names, until the next daily pass starts it again. The
204
208
  * erasure attestation cites it, and names every failed purge in a period.
205
209
  */
206
210
  readonly adminUserPurgeFailed: "auth/admin_user_purge_failed";
@@ -208,7 +212,7 @@ export declare const AuthAuditActions: {
208
212
  readonly userSelfDeleted: "auth/user_self_deleted";
209
213
  /**
210
214
  * 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
215
+ * answered. A **disclosure**, and the largest one on this surface: it carries every composed
212
216
  * capability's rows about the person. Recorded with the caller, the reason they gave, and which capabilities
213
217
  * answered; never with any of the data.
214
218
  */
@@ -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;IACrC;;;;;;;;;;;;;;;;;;;;;;OAsBG;aACH,OAAO,EAAE,eAAe;IACxB;;;;;;;;;;;;;;;;OAgBG;aACH,WAAW,EAAE,mBAAmB;IAChC;;;;;;;;;;;;;;;;OAgBG;aACH,aAAa,EAAE,qBAAqB;IACpC;;;;;OAKG;aACH,aAAa,EAAE,qBAAqB;IACpC;;;;OAIG;aACH,gBAAgB,EAAE,wBAAwB;IAC1C,gEAAgE;aAChE,gBAAgB,EAAE,wBAAwB;IAC1C,wDAAwD;aACxD,aAAa,EAAE,qBAAqB;IACpC;;;;;;;;;;OAUG;aACH,mBAAmB,EAAE,2BAA2B;IAChD;;;;;;;;;;OAUG;aACH,eAAe,EAAE,wBAAwB;IAEzC;;;;;;;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;IACzC;;;;OAIG;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"}
@@ -16,8 +16,8 @@ const AuthAuditActions = {
16
16
  * A sign-out / session revocation completed — and **completed** is the load-bearing word.
17
17
  *
18
18
  * `/sign-out` answers `200 {"success":true}` whether or not it found a session to delete: an expired
19
- * cookie, a bearer token (which it does not read) or a bare `curl` all get the same body. Recorded off
20
- * the path, every one of them wrote a sign-out that signed nobody out. The evidence is a session row
19
+ * cookie, a bearer token (which it does not read) or a bare `curl` all get the same body, so the path is
20
+ * no evidence that anybody was signed out. The evidence is a session row
21
21
  * disappearing, which `../instance/auth.ts`'s `session.delete.after` observes and `../audit/evidence.ts`
22
22
  * carries to the emitter; with no session gone there is no event, because nothing happened.
23
23
  */
@@ -38,14 +38,13 @@ const AuthAuditActions = {
38
38
  */
39
39
  magicLinkSent: "auth/magic_link_sent",
40
40
  /**
41
- * An email OTP was requested and enqueued for delivery. Same claim, same evidence — and this is the
42
- * endpoint that made the point (#627).
41
+ * An email OTP was requested and enqueued for delivery. Same claim, same evidence.
43
42
  *
44
43
  * It declines twice over and answers `200 {"success":true}` both times. Better Auth drops the
45
44
  * verification row and returns success rather than confirm that an address is registered, which is the
46
45
  * whole reason the response is shaped that way; and the kit's own `sendVerificationOTP` returns without
47
- * queuing for any `type` but `sign-in`, because an OTP is a sign-in credential here. Read off the
48
- * status, every one of those wrote a send that never happened.
46
+ * queuing for any `type` but `sign-in`, because an OTP is a sign-in credential here. The status says
47
+ * nothing about whether a message was made.
49
48
  *
50
49
  * **Two more declines sit under the send callback rather than over it, and they are not the same
51
50
  * thing as each other.** `@pithy-sh/email` withholds a message to a suppressed address — a hard bounce,
@@ -64,17 +63,13 @@ const AuthAuditActions = {
64
63
  /**
65
64
  * A social account row was created — from here on that provider can sign in as this user.
66
65
  *
67
- * **Emitted from the row, not from `/link-social`, and that is the whole of #627.** Minting the
68
- * provider redirect is a request; the account row is created later at `/callback/:id` and may never be
69
- * created at all — the person abandons the consent screen, the provider refuses, the linking gate
70
- * rejects it. Recorded at the request, every one of those wrote a success row for a link that never
71
- * happened, which makes "which providers can sign in as this account today" unanswerable from the
72
- * trail that exists to answer it.
66
+ * **Emitted from the row, not from `/link-social`.** Minting the provider redirect is a request; the
67
+ * account row is created later at `/callback/:id` and may never be created at all — the person abandons
68
+ * the consent screen, the provider refuses, the linking gate rejects it. Only the row answers "which
69
+ * providers can sign in as this account today".
73
70
  *
74
- * **A first social sign-up writes this too, deliberately.** The endpoint wiring this replaced refused
75
- * to map `/callback/:id` because doing so "would mislabel every first sign-up as a link" — true of a
76
- * *path*, which cannot tell a sign-up from a link. From the row it stops mattering: this event claims a
77
- * provider can now sign in as this user, and a first social sign-up is exactly when that becomes true.
71
+ * **A first social sign-up writes this too, deliberately.** This event claims a provider can now sign in
72
+ * as this user, and a first social sign-up is exactly when that becomes true.
78
73
  * Pinned by `emit.workers.test.ts`, so the decision is asserted rather than inferred from the absence
79
74
  * of a branch.
80
75
  */
@@ -82,8 +77,7 @@ const AuthAuditActions = {
82
77
  /**
83
78
  * A social account row was removed — that provider can no longer sign in as this user.
84
79
  *
85
- * The other half of the same question, and it emitted nothing at all until #627: a provider was
86
- * detached and the trail was silent. Emitted from the row for the same reason its twin is, which also
80
+ * The other half of the same question. Emitted from the row for the same reason its twin is, which also
87
81
  * means it covers every way a link ends — `/unlink-account`, and the cascade when a user is deleted —
88
82
  * rather than the one endpoint somebody remembered to wire. Both are driven in `emit.workers.test.ts`:
89
83
  * a sentence claiming a class is covered is not the same as a test that reddens when it stops being.
@@ -116,7 +110,7 @@ const AuthAuditActions = {
116
110
  deviceRevoked: "auth/device_revoked",
117
111
  /**
118
112
  * Somebody tried to sign in with a provider this deployment enables and cannot serve — its credential
119
- * would not resolve, so the instance was built without it (#381). Outcome `denied`, severity
113
+ * would not resolve, so the instance was built without it. Outcome `denied`, severity
120
114
  * `warning`.
121
115
  *
122
116
  * **This is the operator's channel, and it is why degrading is not the same as degrading silently.**
@@ -135,10 +129,20 @@ const AuthAuditActions = {
135
129
  * account-takeover step". One is a person who left a tab open; a run of them against one user id is the
136
130
  * incident, and without the row there is nothing to count.
137
131
  *
138
- * Mirrors the error code, which is this file's one precedent for doing so.
132
+ * Mirrors the error code.
139
133
  */
140
134
  sessionNotFresh: "auth/session_not_fresh",
141
135
  /**
136
+ * Somebody signed in reached an app route gated by `requireRecentSignIn` without having signed in within
137
+ * that route's window. Outcome `denied`, severity `warning`, with the route's `purpose` in
138
+ * `metadata.purpose`.
139
+ *
140
+ * One action for every gated route, so one filter finds every refusal and the purpose says which route.
141
+ * A run of them against one user id is a stolen credential being walked toward something the app
142
+ * protects.
143
+ */
144
+ recentSignInRefused: "auth/recent_sign_in_refused",
145
+ /**
142
146
  * The admin actions, emitted only from the control-plane surface (`http/adminRoutes.ts`) and always
143
147
  * with `actorType: "control-plane"` — a management client is not a user of the adopter's app, so its
144
148
  * actions must be answerable separately from their users'.
@@ -155,7 +159,7 @@ const AuthAuditActions = {
155
159
  adminUserRead: "auth/admin_user_read",
156
160
  /** The device registry was walked from the management surface. */
157
161
  adminDevicesListed: "auth/admin_devices_listed",
158
- /** The verification ledger was read from the management surface (#829): counts and rows over a window. */
162
+ /** The verification ledger was read from the management surface: counts and rows over a window. */
159
163
  adminVerificationsListed: "auth/admin_verifications_listed",
160
164
  /** One named session was revoked from the management surface. */
161
165
  adminSessionRevoked: "auth/admin_session_revoked",
@@ -164,7 +168,7 @@ const AuthAuditActions = {
164
168
  /** One of a user's devices was signed out and its registration dropped, from the management surface. */
165
169
  adminDeviceRevoked: "auth/admin_device_revoked",
166
170
  /**
167
- * The account lifecycle (#620). Each is written by the transition in `../lifecycle/transitions.ts`, beside
171
+ * The account lifecycle. Each is written by the transition in `../lifecycle/transitions.ts`, beside
168
172
  * the `pithy_auth_user_lifecycle` row that records the same fact — the trail answers "who, from where", the
169
173
  * table answers "what happened to this account". The admin ones carry `actorType: "control-plane"`; the
170
174
  * self-service deletion carries the account's own holder, and the purge `system`.
@@ -172,7 +176,7 @@ const AuthAuditActions = {
172
176
  * The dashboard's own `customer/user_suspended` and `customer/user_restored` are the client side of the
173
177
  * same events, recorded where the operator pressed the button.
174
178
  *
175
- * **The suspend and reinstate routes record every call under the same action (#621)**, the ones the
179
+ * **The suspend and reinstate routes record every call under the same action**, the ones the
176
180
  * transition did not write included: a refusal as `denied` with its code in `metadata.code`, and a
177
181
  * reinstatement that found nothing to lift as a `success` with `metadata.changed: false`. A restated
178
182
  * suspension is the transition's own event, with `metadata.updated: true`. So one filter on the action
@@ -185,7 +189,7 @@ const AuthAuditActions = {
185
189
  /** An account was deleted from the management surface, with its purge window starting now. */
186
190
  adminUserSoftDeleted: "auth/admin_user_soft_deleted",
187
191
  /**
188
- * An account was deleted from the management surface with no window — its purge starts now (#622). Also
192
+ * An account was deleted from the management surface with no window — its purge starts now. Also
189
193
  * written when a hard deletion brings an already-deleted account's purge forward, with
190
194
  * `metadata.broughtForward: true`. Never written by omission: the route reaches it only for `mode: "hard"`.
191
195
  */
@@ -195,13 +199,13 @@ const AuthAuditActions = {
195
199
  /** A deleted account's data was erased. Recorded once, when the last purge step has run. */
196
200
  adminUserPurged: "auth/admin_user_purged",
197
201
  /**
198
- * One purge step answered for a capability's rows: erased them, or kept them under a stated basis (#814).
202
+ * One purge step answered for a capability's rows: erased them, or kept them under a stated basis.
199
203
  * `metadata.step` names the capability and `metadata.disposition` says which. The erasure attestation cites it
200
- * by event id and chain position (#823).
204
+ * by event id and chain position.
201
205
  */
202
206
  adminUserPurgeStep: "auth/admin_user_purge_step",
203
207
  /**
204
- * A purge gave up at the step `metadata.step` names, until the next daily pass starts it again (#823). The
208
+ * A purge gave up at the step `metadata.step` names, until the next daily pass starts it again. The
205
209
  * erasure attestation cites it, and names every failed purge in a period.
206
210
  */
207
211
  adminUserPurgeFailed: "auth/admin_user_purge_failed",
@@ -209,7 +213,7 @@ const AuthAuditActions = {
209
213
  userSelfDeleted: "auth/user_self_deleted",
210
214
  /**
211
215
  * 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
216
+ * answered. A **disclosure**, and the largest one on this surface: it carries every composed
213
217
  * capability's rows about the person. Recorded with the caller, the reason they gave, and which capabilities
214
218
  * answered; never with any of the data.
215
219
  */
@@ -21,8 +21,7 @@ export declare function correlation(headers: Headers | undefined): {
21
21
  /**
22
22
  * What an endpoint must have *done* for its path event to be a success.
23
23
  *
24
- * **There is no "the response is its own evidence" member, and its removal is #627's last half.** A
25
- * non-2xx is sufficient evidence of a refusal and is nowhere near necessary: `/sign-out` answers
24
+ * **There is no "the response is its own evidence" member.** A non-2xx is sufficient evidence of a refusal and is nowhere near necessary: `/sign-out` answers
26
25
  * `200 {"success":true}` having deleted nothing, and `/email-otp/send-verification-otp` answers
27
26
  * `200 {"success":true}` having declined to send — Better Auth drops the verification row and returns
28
27
  * success rather than confirm that an address is registered (`plugins/email-otp/routes.mjs`), and the
@@ -67,21 +66,16 @@ export interface PathEvent {
67
66
  * The endpoints whose *path* names an audit action, what "success" means for each, and what a completed
68
67
  * response without it means instead.
69
68
  *
70
- * **A table rather than a chain of `if`s so the rule can be asserted over all of it.** #627's second
71
- * half was that every entry here wrote `outcome: "success"` for a request the endpoint had refused:
72
- * Better Auth catches an endpoint's `APIError` into a result and runs the `after` hooks over it anyway
73
- * (`better-auth/dist/api/dispatch.mjs`), so a 401 `/token` and a 400 `/email-otp/send-verification-otp`
74
- * both looked, from here, exactly like a request that worked. Naming the two paths somebody happened to
75
- * probe would have fixed those two; the exposure was every entry, including ones added later. So the
76
- * rule is `emitAfterRequest` reading the outcome, and the gate walks this table.
69
+ * **A table rather than a chain of `if`s so the rule can be asserted over all of it.** Better Auth
70
+ * catches an endpoint's `APIError` into a result and runs the `after` hooks over it anyway
71
+ * (`better-auth/dist/api/dispatch.mjs`), so a refused `/token` reaches the hook looking like one that
72
+ * worked. `emitAfterRequest` reads the outcome for every entry, and the gate walks this table.
77
73
  *
78
- * **Its third half was that a refusal can answer 200**, which the first fix could not see, and the
79
- * correction is the same shape: not a fifth branch for the endpoint somebody probed, but a column every
80
- * entry must fill. `evidence` has no "the response says so" member, so an entry that claims an outcome
81
- * it cannot evidence does not compile, and `emit.test.ts` walks the table asserting that an entry whose
82
- * evidence is absent never writes `success`.
74
+ * **A refusal can also answer 200**, so every entry fills `evidence`, which has no "the response says so"
75
+ * member: an entry that claims an outcome it cannot evidence does not compile, and `emit.test.ts` walks
76
+ * the table asserting that an entry whose evidence is absent never writes `success`.
83
77
  *
84
- * **No path maps to `oauth_linked`, and that is the correction #627 made first.** `/link-social` mints
78
+ * **No path maps to `oauth_linked`.** `/link-social` mints
85
79
  * a redirect, which is a request rather than an outcome; `/callback/:id` completes a sign-in *or* a link
86
80
  * and cannot be told apart by its path. The event that means "this provider can sign in as this user" is
87
81
  * the account row, so it is emitted from the row — see `emitProviderAccountChanged`.
@@ -232,7 +226,7 @@ export declare function emitControlPlaneAction(emit: AuditEmit, event: {
232
226
  userAgent?: string;
233
227
  requestId?: string;
234
228
  metadata?: Record<string, unknown>;
235
- /** `success` unless the call was refused (`denied`) or broke (`failure`) — #621 records both. */
229
+ /** `success` unless the call was refused (`denied`) or broke (`failure`). */
236
230
  outcome?: "success" | "denied" | "failure";
237
231
  }): Promise<void>;
238
232
  /**
@@ -241,8 +235,8 @@ export declare function emitControlPlaneAction(emit: AuditEmit, event: {
241
235
  *
242
236
  * `anonymous`, because the caller has no session yet by definition. `denied` rather than `failure`: the
243
237
  * request was refused deliberately by a rule this Worker holds, not lost to a fault. `warning` rather
244
- * than `critical` — the other sign-in methods are working, which is the entire point of #381, so this is
245
- * notable rather than alert-worthy.
238
+ * than `critical` — the other sign-in methods are still working, so this is notable rather than
239
+ * alert-worthy.
246
240
  *
247
241
  * `metadata.provider` is the provider id and nothing else. The secret name is derivable from it and is
248
242
  * still not written: an audit row is long-lived and queryable, and naming a store entry in one is a map
@@ -262,7 +256,7 @@ export type ProviderChange = "link" | "unlink";
262
256
  * three. Parsing it into a named shape means the emitter below is holding a value that never contained
263
257
  * a provider token, so no later edit spreading "the account" into `metadata` can leak one — the guard
264
258
  * is structural instead of a rule somebody has to remember. The provider-asserted email is not here
265
- * either, and is not stored on this row to begin with: #627 does not widen what is retained.
259
+ * either, and is not stored on this row to begin with.
266
260
  */
267
261
  export declare const ProviderAccount: z.ZodObject<{
268
262
  id: z.ZodString;
@@ -275,9 +269,8 @@ export type ProviderAccount = z.output<typeof ProviderAccount>;
275
269
  *
276
270
  * **Called from the `account` database hooks, and the row is the point.** An operator's question is
277
271
  * "which providers can sign in as this account today, and when did that change"; the account table is
278
- * the answer to the first half, so the second half has to be recorded where that table changes. Wiring
279
- * this to an endpoint instead is what #627 was: `/link-social` recorded an intention as an outcome, and
280
- * `/unlink-account` recorded nothing. From the row, an abandoned consent screen emits nothing because
272
+ * the answer to the first half, so the second half has to be recorded where that table changes. An
273
+ * endpoint records an intention, not an outcome. From the row, an abandoned consent screen emits nothing because
281
274
  * nothing happened, and every path that ends a link — the unlink endpoint, and the cascade when a user
282
275
  * is deleted — is covered without naming any of them.
283
276
  *
@@ -286,11 +279,11 @@ export type ProviderAccount = z.output<typeof ProviderAccount>;
286
279
  * filter on.
287
280
  *
288
281
  * **The actor is whoever caused the change, never the account it concerns.** The row's `userId` says
289
- * *whose* link it was, which is not the same question and is carried in `metadata.userId` instead. The
290
- * first cut of #627 conflated them: `delete.after` fires on every removal, the user-deletion cascade
291
- * included, so an operator deleting somebody's account wrote rows saying that person had detached their
292
- * own providers — from the operator's IP. A trail that misattributes an actor is worse than one that is
293
- * silent, because it reads as evidence. Three cases, and only three:
282
+ * *whose* link it was, which is not the same question and is carried in `metadata.userId` instead.
283
+ * `delete.after` fires on every removal, the user-deletion cascade included, so an operator deleting
284
+ * somebody's account must not write rows saying that person detached their own providers. A trail that
285
+ * misattributes an actor is worse than one that is silent, because it reads as evidence. Three cases,
286
+ * and only three:
294
287
  *
295
288
  * - An authenticated caller — `/unlink-account`, a link from a signed-in session, an operator's console
296
289
  * endpoint — is `user`, named.
@@ -299,13 +292,12 @@ export type ProviderAccount = z.output<typeof ProviderAccount>;
299
292
  * - No request at all is `system`, with no actor id and no ip: there is no caller to name and nothing to
300
293
  * borrow one from.
301
294
  *
302
- * **A cascade is not a fourth case, and an earlier revision of this list said it was.** `deleteWithHooks`
303
- * resolves its context from `getCurrentAuthContext()`, which is async-scoped to the dispatch, so the
304
- * cascade `internalAdapter.deleteUser` runs carries whatever context reached it: an operator deleting
305
- * somebody through an endpoint is named as the actor of every row it writes, with their address, because
306
- * they caused every one of them. `system` is what *no request* looks like — a queue consumer, a script,
307
- * a migration — not what a cascade looks like, and the two were written down here as the same thing. The
308
- * rule that does hold everywhere is the one above it: the account's owner is never the actor merely for
295
+ * **A cascade is not a fourth case.** `deleteWithHooks` resolves its context from
296
+ * `getCurrentAuthContext()`, which is async-scoped to the dispatch, so the cascade
297
+ * `internalAdapter.deleteUser` runs carries whatever context reached it: an operator deleting somebody
298
+ * through an endpoint is named as the actor of every row it writes, with their address, because they
299
+ * caused every one of them. `system` is what *no request* looks like — a queue consumer, a script, a
300
+ * migration — not what a cascade looks like. The rule that does hold everywhere is the one above it: the account's owner is never the actor merely for
309
301
  * owning the row. Both shapes are driven in `emit.workers.test.ts` rather than asserted here.
310
302
  *
311
303
  * Unparseable input is dropped rather than thrown. The write it describes has already happened, and an
@@ -334,6 +326,20 @@ export declare function emitProviderChangeNotFresh(emit: AuditEmit, context: {
334
326
  sessionId: string;
335
327
  headers: Headers | undefined;
336
328
  }): Promise<void>;
329
+ /**
330
+ * Emit a `recent_sign_in_refused` event — a signed-in caller reached an app route gated by
331
+ * `requireRecentSignIn` without a sign-in inside that route's window.
332
+ *
333
+ * `actorType: "user"`, for the same reason as {@link emitProviderChangeNotFresh}: the caller is
334
+ * authenticated and the user id is the whole value of the row. `metadata.purpose` is the app's own
335
+ * `domain/reason` for the route, which says what was being reached for.
336
+ */
337
+ export declare function emitRecentSignInRefused(emit: AuditEmit, context: {
338
+ purpose: string;
339
+ userId: string;
340
+ sessionId: string;
341
+ headers: Headers | undefined;
342
+ }): Promise<void>;
337
343
  /**
338
344
  * Emit a `handoff_issued` event: a redirect sign-in's session left on a deep link as a one-time code, or, denied,
339
345
  * a sign-in whose deep link carried no challenge, or a magic link to a custom scheme, so no code was issued.
@@ -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,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,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,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAK7F;AAUD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAE/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