@fuzdev/fuz_app 0.183.0 → 0.184.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 (179) hide show
  1. package/dist/actions/CLAUDE.md +535 -1223
  2. package/dist/actions/action_codegen.d.ts +1 -1
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +3 -2
  5. package/dist/actions/connection_closer.d.ts +11 -9
  6. package/dist/actions/connection_closer.d.ts.map +1 -1
  7. package/dist/actions/connection_closer.js +11 -9
  8. package/dist/actions/frontend_rpc_client.d.ts +1 -1
  9. package/dist/actions/register_action_ws.d.ts +14 -1
  10. package/dist/actions/register_action_ws.d.ts.map +1 -1
  11. package/dist/actions/register_action_ws.js +2 -1
  12. package/dist/actions/ws_socket_session.d.ts +9 -1
  13. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  14. package/dist/actions/ws_socket_session.js +43 -19
  15. package/dist/auth/CLAUDE.md +430 -1048
  16. package/dist/auth/account_queries.d.ts +1 -1
  17. package/dist/auth/account_queries.js +1 -1
  18. package/dist/auth/account_routes.d.ts +4 -5
  19. package/dist/auth/account_routes.d.ts.map +1 -1
  20. package/dist/auth/account_routes.js +8 -10
  21. package/dist/auth/admin_actions.d.ts.map +1 -1
  22. package/dist/auth/admin_actions.js +10 -11
  23. package/dist/auth/api_token.d.ts +20 -3
  24. package/dist/auth/api_token.d.ts.map +1 -1
  25. package/dist/auth/api_token.js +28 -9
  26. package/dist/auth/api_token_queries.d.ts +2 -2
  27. package/dist/auth/api_token_queries.js +2 -2
  28. package/dist/auth/audit_log_schema.d.ts +15 -9
  29. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  30. package/dist/auth/audit_log_schema.js +1 -2
  31. package/dist/auth/auth_guard_resolver.d.ts +1 -1
  32. package/dist/auth/auth_guard_resolver.js +1 -1
  33. package/dist/auth/bearer_auth.d.ts +2 -5
  34. package/dist/auth/bearer_auth.d.ts.map +1 -1
  35. package/dist/auth/bearer_auth.js +4 -13
  36. package/dist/auth/bootstrap_account.d.ts +13 -15
  37. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  38. package/dist/auth/bootstrap_account.js +9 -11
  39. package/dist/auth/bootstrap_routes.d.ts +20 -21
  40. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  41. package/dist/auth/bootstrap_routes.js +21 -19
  42. package/dist/auth/bootstrap_token_store.d.ts +3 -4
  43. package/dist/auth/bootstrap_token_store.d.ts.map +1 -1
  44. package/dist/auth/bootstrap_token_store.js +1 -1
  45. package/dist/auth/daemon_token.d.ts +5 -1
  46. package/dist/auth/daemon_token.d.ts.map +1 -1
  47. package/dist/auth/daemon_token_middleware.d.ts +12 -8
  48. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  49. package/dist/auth/daemon_token_middleware.js +15 -21
  50. package/dist/auth/deps.d.ts +11 -0
  51. package/dist/auth/deps.d.ts.map +1 -1
  52. package/dist/auth/invite_queries.d.ts +51 -3
  53. package/dist/auth/invite_queries.d.ts.map +1 -1
  54. package/dist/auth/invite_queries.js +81 -6
  55. package/dist/auth/invite_schema.d.ts +2 -1
  56. package/dist/auth/invite_schema.d.ts.map +1 -1
  57. package/dist/auth/middleware.d.ts +2 -3
  58. package/dist/auth/middleware.d.ts.map +1 -1
  59. package/dist/auth/middleware.js +3 -3
  60. package/dist/auth/request_context.d.ts +3 -3
  61. package/dist/auth/request_context.js +3 -3
  62. package/dist/auth/role_grant_offer_actions.d.ts +2 -2
  63. package/dist/auth/role_grant_offer_actions.js +2 -2
  64. package/dist/auth/session_cookie.d.ts +82 -174
  65. package/dist/auth/session_cookie.d.ts.map +1 -1
  66. package/dist/auth/session_cookie.js +80 -130
  67. package/dist/auth/session_middleware.d.ts +8 -17
  68. package/dist/auth/session_middleware.d.ts.map +1 -1
  69. package/dist/auth/session_middleware.js +14 -23
  70. package/dist/auth/session_queries.d.ts +9 -14
  71. package/dist/auth/session_queries.d.ts.map +1 -1
  72. package/dist/auth/session_queries.js +8 -9
  73. package/dist/auth/signup_routes.d.ts.map +1 -1
  74. package/dist/auth/signup_routes.js +4 -6
  75. package/dist/db/CLAUDE.md +5 -3
  76. package/dist/dev/setup.d.ts +3 -1
  77. package/dist/dev/setup.d.ts.map +1 -1
  78. package/dist/dev/setup.js +3 -1
  79. package/dist/http/CLAUDE.md +315 -768
  80. package/dist/http/db_routes.d.ts +1 -1
  81. package/dist/http/db_routes.js +1 -1
  82. package/dist/http/origin.d.ts +7 -8
  83. package/dist/http/origin.d.ts.map +1 -1
  84. package/dist/http/origin.js +7 -8
  85. package/dist/http/pending_effects.d.ts +78 -4
  86. package/dist/http/pending_effects.d.ts.map +1 -1
  87. package/dist/http/pending_effects.js +82 -4
  88. package/dist/http/route_result.d.ts +1 -1
  89. package/dist/http/route_spec.d.ts +14 -11
  90. package/dist/http/route_spec.d.ts.map +1 -1
  91. package/dist/realtime/sse.d.ts +4 -23
  92. package/dist/realtime/sse.d.ts.map +1 -1
  93. package/dist/realtime/sse.js +4 -25
  94. package/dist/server/app_backend.d.ts +4 -5
  95. package/dist/server/app_backend.d.ts.map +1 -1
  96. package/dist/server/app_backend.js +3 -1
  97. package/dist/server/app_server.d.ts +53 -30
  98. package/dist/server/app_server.d.ts.map +1 -1
  99. package/dist/server/app_server.js +81 -53
  100. package/dist/server/app_server_context.d.ts +1 -2
  101. package/dist/server/app_server_context.d.ts.map +1 -1
  102. package/dist/server/env.js +2 -2
  103. package/dist/testing/CLAUDE.md +17 -17
  104. package/dist/testing/admin_integration.d.ts +2 -3
  105. package/dist/testing/admin_integration.d.ts.map +1 -1
  106. package/dist/testing/admin_integration.js +3 -3
  107. package/dist/testing/app_server.d.ts +3 -8
  108. package/dist/testing/app_server.d.ts.map +1 -1
  109. package/dist/testing/app_server.js +10 -9
  110. package/dist/testing/attack_surface.d.ts +1 -1
  111. package/dist/testing/attack_surface.d.ts.map +1 -1
  112. package/dist/testing/audit_completeness.d.ts +2 -3
  113. package/dist/testing/audit_completeness.d.ts.map +1 -1
  114. package/dist/testing/audit_completeness.js +1 -1
  115. package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -1
  116. package/dist/testing/cross_backend/capability_mounts.js +16 -11
  117. package/dist/testing/cross_backend/conformance_table.d.ts +5 -6
  118. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  119. package/dist/testing/cross_backend/conformance_table.js +4 -4
  120. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  121. package/dist/testing/cross_backend/default_backend_configs.d.ts +3 -3
  122. package/dist/testing/cross_backend/default_spine_surface.d.ts +0 -6
  123. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  124. package/dist/testing/cross_backend/default_spine_surface.js +4 -9
  125. package/dist/testing/cross_backend/differential.d.ts +2 -3
  126. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  127. package/dist/testing/cross_backend/differential.js +1 -1
  128. package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -42
  129. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  130. package/dist/testing/cross_backend/full_spine_mount.js +45 -4
  131. package/dist/testing/cross_backend/in_process_setup.d.ts +6 -7
  132. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  133. package/dist/testing/cross_backend/in_process_setup.js +9 -12
  134. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -4
  135. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  136. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +2 -2
  137. package/dist/testing/cross_backend/setup.d.ts +1 -1
  138. package/dist/testing/cross_backend/spine_suites.d.ts +2 -3
  139. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  140. package/dist/testing/cross_backend/spine_suites.js +5 -5
  141. package/dist/testing/cross_backend/standard.d.ts +2 -3
  142. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  143. package/dist/testing/cross_backend/standard.js +3 -3
  144. package/dist/testing/cross_backend/testing_credential_read.d.ts +10 -11
  145. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -1
  146. package/dist/testing/cross_backend/testing_credential_read.js +12 -12
  147. package/dist/testing/cross_backend/testing_reset_actions.d.ts +35 -30
  148. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  149. package/dist/testing/cross_backend/testing_reset_actions.js +39 -31
  150. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  151. package/dist/testing/cross_backend/testing_server_core.js +2 -3
  152. package/dist/testing/daemon_token_rotation.d.ts.map +1 -1
  153. package/dist/testing/daemon_token_rotation.js +2 -3
  154. package/dist/testing/integration.d.ts +2 -3
  155. package/dist/testing/integration.d.ts.map +1 -1
  156. package/dist/testing/integration.js +4 -4
  157. package/dist/testing/rate_limiting.d.ts +2 -3
  158. package/dist/testing/rate_limiting.d.ts.map +1 -1
  159. package/dist/testing/rate_limiting.js +3 -3
  160. package/dist/testing/rpc_helpers.d.ts +1 -2
  161. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  162. package/dist/testing/rpc_helpers.js +3 -3
  163. package/dist/testing/rpc_round_trip.d.ts +2 -3
  164. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  165. package/dist/testing/rpc_round_trip.js +1 -1
  166. package/dist/testing/sse_round_trip.d.ts +2 -3
  167. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  168. package/dist/testing/sse_round_trip.js +2 -2
  169. package/dist/testing/stubs.d.ts +5 -6
  170. package/dist/testing/stubs.d.ts.map +1 -1
  171. package/dist/testing/stubs.js +10 -8
  172. package/dist/testing/test_app.d.ts +5 -3
  173. package/dist/testing/test_app.d.ts.map +1 -1
  174. package/dist/testing/test_app.js +2 -3
  175. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  176. package/dist/testing/ws_round_trip.js +3 -0
  177. package/dist/ui/ui_format.d.ts.map +1 -1
  178. package/dist/ui/ui_format.js +1 -2
  179. package/package.json +1 -1
@@ -238,7 +238,7 @@ export declare const query_account_lock_for_purge: (deps: QueryDeps, id: string)
238
238
  * be ordered against a delete of any of them.
239
239
  *
240
240
  * An offer locks its two parties (`query_role_grant_offer_create`), an invite
241
- * its issuer (`invite_create`, one id).
241
+ * its issuer (`query_create_invite`, one id).
242
242
  *
243
243
  * `FOR SHARE`: the weakest lock that conflicts with a delete's `UPDATE` of the
244
244
  * row, so these writes don't wait on one another. It also waits on a
@@ -325,7 +325,7 @@ export const query_account_lock_for_purge = async (deps, id) => {
325
325
  * be ordered against a delete of any of them.
326
326
  *
327
327
  * An offer locks its two parties (`query_role_grant_offer_create`), an invite
328
- * its issuer (`invite_create`, one id).
328
+ * its issuer (`query_create_invite`, one id).
329
329
  *
330
330
  * `FOR SHARE`: the weakest lock that conflicts with a delete's `UPDATE` of the
331
331
  * row, so these writes don't wait on one another. It also waits on a
@@ -19,7 +19,6 @@
19
19
  *
20
20
  * @module
21
21
  */
22
- import { type SessionOptions } from './session_cookie.js';
23
22
  import { type RouteSpec } from '../http/route_spec.js';
24
23
  import { type RateLimiter } from '../rate_limiter.js';
25
24
  import type { RouteFactoryDeps } from './deps.js';
@@ -87,7 +86,7 @@ export declare const DEFAULT_LOGIN_FAIL_JITTER_MS = 25;
87
86
  * budget that bounds guessing on every other one.
88
87
  */
89
88
  export interface AuthSessionRouteOptions {
90
- session_options: SessionOptions<string>;
89
+ session_cookie_name: string;
91
90
  }
92
91
  /**
93
92
  * Per-factory configuration for account route specs.
@@ -133,7 +132,7 @@ export interface AccountRouteOptions extends AuthSessionRouteOptions {
133
132
  /**
134
133
  * Create account route specs for session-based auth.
135
134
  *
136
- * The returned specs cover the REST flows that stay after the RPC migration:
135
+ * The returned specs cover the account surface's REST flows:
137
136
  * `/status` (account info + bootstrap availability), `/login`, `/logout`,
138
137
  * `/password`. `/status` is bundled
139
138
  * here (relative path, prefixed to `/api/account/status` by the caller) so
@@ -151,8 +150,8 @@ export interface AccountRouteOptions extends AuthSessionRouteOptions {
151
150
  * audit row is written last in the transaction of the change it reports, so
152
151
  * a refused row rolls the change back and closes nothing.
153
152
  *
154
- * @param deps - stateless capabilities (keyring, password, log, audit, connection_closer)
155
- * @param options - per-factory configuration (session_options, login_ip_rate_limiter, login_account_rate_limiter, bootstrap_status)
153
+ * @param deps - capabilities (keyring, password, log, audit, connection_closer)
154
+ * @param options - per-factory configuration (session_cookie_name, login_ip_rate_limiter, login_account_rate_limiter, bootstrap_status)
156
155
  * @returns route specs (not yet applied to Hono)
157
156
  */
158
157
  export declare const create_account_route_specs: (deps: RouteFactoryDeps, options: AccountRouteOptions) => Array<RouteSpec>;
@@ -1 +1 @@
1
- {"version":3,"file":"account_routes.d.ts","sourceRoot":"","sources":["../../src/lib/auth/account_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAyB7B,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAK7E,OAAO,EAAoB,KAAK,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AACnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAclD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gCAAgC,GAAI,UAAU,oBAAoB,KAAG,SAiFjF,CAAC;AAEF,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACpC,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;CAC1C;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,uBAAuB;IACvC,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC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,CAAC;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,uBAAuB;IACvC,mBAAmB,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IACnE;;;;;;;OAOG;IACH,qBAAqB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1C,4FAA4F;IAC5F,0BAA0B,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/C,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;CAC1C;AAID;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,0BAA0B,GACtC,MAAM,gBAAgB,EACtB,SAAS,mBAAmB,KAC1B,KAAK,CAAC,SAAS,CAoXjB,CAAC"}
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * @module
21
21
  */
22
- import { clear_session_cookie_header, session_cookie_header } from './session_cookie.js';
22
+ import { format_session_clear_cookie, sign_session_cookie } from './session_cookie.js';
23
23
  import { RoleGrantSummaryJson, to_session_account } from './account_schema.js';
24
24
  import { account_status_route_shape, create_account_route_shapes, DEFAULT_MAX_SESSIONS } from './account_route_schema.js';
25
25
  import { create_capped_session, query_session_revoke_all_for_account, query_session_revoke_by_hash_unscoped } from './session_queries.js';
@@ -162,7 +162,7 @@ export const DEFAULT_LOGIN_FAIL_JITTER_MS = 25;
162
162
  /**
163
163
  * Create account route specs for session-based auth.
164
164
  *
165
- * The returned specs cover the REST flows that stay after the RPC migration:
165
+ * The returned specs cover the account surface's REST flows:
166
166
  * `/status` (account info + bootstrap availability), `/login`, `/logout`,
167
167
  * `/password`. `/status` is bundled
168
168
  * here (relative path, prefixed to `/api/account/status` by the caller) so
@@ -180,13 +180,13 @@ export const DEFAULT_LOGIN_FAIL_JITTER_MS = 25;
180
180
  * audit row is written last in the transaction of the change it reports, so
181
181
  * a refused row rolls the change back and closes nothing.
182
182
  *
183
- * @param deps - stateless capabilities (keyring, password, log, audit, connection_closer)
184
- * @param options - per-factory configuration (session_options, login_ip_rate_limiter, login_account_rate_limiter, bootstrap_status)
183
+ * @param deps - capabilities (keyring, password, log, audit, connection_closer)
184
+ * @param options - per-factory configuration (session_cookie_name, login_ip_rate_limiter, login_account_rate_limiter, bootstrap_status)
185
185
  * @returns route specs (not yet applied to Hono)
186
186
  */
187
187
  export const create_account_route_specs = (deps, options) => {
188
188
  const { keyring, password, connection_closer } = deps;
189
- const { session_options, login_ip_rate_limiter, login_account_rate_limiter, max_sessions = DEFAULT_MAX_SESSIONS, login_fail_floor_ms = DEFAULT_LOGIN_FAIL_FLOOR_MS, login_fail_jitter_ms = DEFAULT_LOGIN_FAIL_JITTER_MS, bootstrap_status } = options;
189
+ const { session_cookie_name, login_ip_rate_limiter, login_account_rate_limiter, max_sessions = DEFAULT_MAX_SESSIONS, login_fail_floor_ms = DEFAULT_LOGIN_FAIL_FLOOR_MS, login_fail_jitter_ms = DEFAULT_LOGIN_FAIL_JITTER_MS, bootstrap_status } = options;
190
190
  warn_if_fail_floor_disabled('login', login_fail_floor_ms, deps.log);
191
191
  const [login_shape, logout_shape, password_shape] = create_account_route_shapes({
192
192
  login_account_rate_limited: login_account_rate_limiter !== null
@@ -277,13 +277,11 @@ export const create_account_route_specs = (deps, options) => {
277
277
  return null;
278
278
  }
279
279
  const session = await create_capped_session({
280
- keyring,
281
280
  deps: tx_ctx,
282
281
  account_id: account.id,
283
- session_options,
284
282
  max_sessions
285
283
  });
286
- const set_cookie = session_cookie_header(session.cookie_value, session_options);
284
+ const set_cookie = await sign_session_cookie(keyring, session.token, session_cookie_name);
287
285
  await deps.audit.emit(tx_ctx, {
288
286
  event_type: 'login',
289
287
  account_id: account.id,
@@ -370,7 +368,7 @@ export const create_account_route_specs = (deps, options) => {
370
368
  });
371
369
  // the clear rides the success, answered once the revoke and this
372
370
  // row have committed — a rollback clears nothing
373
- return route_ok({ ok: true, username: ctx.account.username }, { set_cookie: [clear_session_cookie_header(session_options)] });
371
+ return route_ok({ ok: true, username: ctx.account.username }, { set_cookie: [format_session_clear_cookie(session_cookie_name)] });
374
372
  }),
375
373
  attach_route_handler(password_shape, async (route) => {
376
374
  // Per-IP rate limit (before argon2 work). Reserved, not checked:
@@ -492,7 +490,7 @@ export const create_account_route_specs = (deps, options) => {
492
490
  // stands. The audit listeners repeat it on the announced
493
491
  // `password_change` row.
494
492
  close_connections_after_commit(connection_closer, { kind: 'account', account_id: ctx.account.id }, deps.log);
495
- return route_ok({ ok: true, sessions_revoked, tokens_revoked }, { set_cookie: [clear_session_cookie_header(session_options)] });
493
+ return route_ok({ ok: true, sessions_revoked, tokens_revoked }, { set_cookie: [format_session_clear_cookie(session_cookie_name)] });
496
494
  }
497
495
  finally {
498
496
  ip_reserved.reservation.release();
@@ -1 +1 @@
1
- {"version":3,"file":"admin_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/admin_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIjG,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;AAyD1B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AA2D3D,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,yBAAyB,EAC/B,UAAS,kBAAuB,KAC9B,KAAK,CAAC,SAAS,CAupBjB,CAAC"}
1
+ {"version":3,"file":"admin_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/admin_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIjG,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;AA0D1B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AA0D3D,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,yBAAyB,EAC/B,UAAS,kBAAuB,KAC9B,KAAK,CAAC,SAAS,CAupBjB,CAAC"}
@@ -39,14 +39,13 @@ import { GRANT_PATH_ADMIN } from './grant_path_schema.js';
39
39
  import { query_role_grant_offer_lock_for_account_removal, query_role_grant_offer_supersede_incoming, query_role_grant_offer_supersede_outgoing } from './role_grant_offer_queries.js';
40
40
  import { emit_supersede_audits } from './role_grant_offer_actions.js';
41
41
  import { queue_supersede_notifications } from './role_grant_offer_notifications.js';
42
- import { query_account_by_email, query_account_by_id, query_account_by_username, query_account_lock_admins_for_purge, query_account_lock_for_purge, query_account_lock_live_many, query_account_soft_delete, query_account_undelete, query_actor_soft_delete, query_actor_undelete, query_actors_by_account, query_admin_account_list, query_purge_account } from './account_queries.js';
42
+ import { query_account_by_email, query_account_by_id, query_account_by_username, query_account_lock_admins_for_purge, query_account_lock_for_purge, query_account_soft_delete, query_account_undelete, query_actor_soft_delete, query_actor_undelete, query_actors_by_account, query_admin_account_list, query_purge_account } from './account_queries.js';
43
43
  import { query_session_list_all_active, query_session_revoke_all_for_account } from './session_queries.js';
44
44
  import { query_revoke_all_api_tokens_for_account } from './api_token_queries.js';
45
45
  import { query_audit_log_list_role_grant_history, query_audit_log_list_with_usernames } from './audit_log_queries.js';
46
46
  import { AUDIT_LOG_DEFAULT_LIMIT } from './audit_log_schema.js';
47
- import { query_create_invite, query_invite_delete_unclaimed, query_invite_delete_unclaimed_by_creators, query_invite_list_all_with_usernames } from './invite_queries.js';
47
+ import { InviteDuplicateError, InviteIssuerNotActiveError, query_create_invite, query_invite_delete_unclaimed, query_invite_delete_unclaimed_by_creators, query_invite_list_all_with_usernames } from './invite_queries.js';
48
48
  import { query_app_settings_load, query_app_settings_load_with_username, query_app_settings_update } from './app_settings_queries.js';
49
- import { is_pg_unique_violation } from '../db/pg_error.js';
50
49
  import { ERROR_ACCOUNT_NOT_FOUND, ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_INVITE_ACCOUNT_EXISTS_EMAIL, ERROR_INVITE_ACCOUNT_EXISTS_USERNAME, ERROR_INVITE_DUPLICATE, ERROR_INVITE_NOT_FOUND } from '../http/error_schemas.js';
51
50
  import { admin_account_list_action_spec, admin_session_list_action_spec, admin_session_revoke_all_action_spec, admin_token_revoke_all_action_spec, audit_log_list_action_spec, audit_log_role_grant_history_action_spec, invite_create_action_spec, invite_list_action_spec, invite_delete_action_spec, account_delete_action_spec, account_purge_action_spec, account_undelete_action_spec, app_settings_get_action_spec, app_settings_update_action_spec, ERROR_PURGE_NOT_CONFIRMED, ERROR_CANNOT_DELETE_KEEPER, ERROR_CANNOT_DELETE_LAST_ADMIN } from './admin_action_specs.js';
52
51
  /**
@@ -171,13 +170,8 @@ export const create_admin_actions = (deps, options = {}) => {
171
170
  // The issuer's account was read before this transaction. A delete
172
171
  // committed since creates nothing — refused as the dead credential it now
173
172
  // is, as `account_token_create` refuses it — and one still to commit
174
- // waits on this lock, then deletes the invite with the account's other
175
- // unclaimed ones: a delete writes its tombstone first.
176
- if (!(await query_account_lock_live_many(ctx, [auth.account.id])).has(auth.account.id)) {
177
- throw jsonrpc_errors.unauthenticated('unauthenticated', {
178
- reason: ERROR_AUTHENTICATION_REQUIRED
179
- });
180
- }
173
+ // waits on the query's issuer lock, then deletes the invite with the
174
+ // account's other unclaimed ones. Twin of the Rust handler's.
181
175
  let invite;
182
176
  try {
183
177
  invite = await query_create_invite(ctx, {
@@ -187,7 +181,12 @@ export const create_admin_actions = (deps, options = {}) => {
187
181
  });
188
182
  }
189
183
  catch (err) {
190
- if (is_pg_unique_violation(err)) {
184
+ if (err instanceof InviteIssuerNotActiveError) {
185
+ throw jsonrpc_errors.unauthenticated('unauthenticated', {
186
+ reason: ERROR_AUTHENTICATION_REQUIRED
187
+ });
188
+ }
189
+ if (err instanceof InviteDuplicateError) {
191
190
  throw jsonrpc_errors.conflict('an unclaimed invite already exists', {
192
191
  reason: ERROR_INVITE_DUPLICATE
193
192
  });
@@ -31,10 +31,14 @@ export declare const API_TOKEN_REGEX: RegExp;
31
31
  * @returns `true` when `raw` matches `API_TOKEN_REGEX`
32
32
  */
33
33
  export declare const is_api_token_shaped: (raw: string) => boolean;
34
+ /** Prefix on the public API token id (e.g. `tok_abC0_d-3xyzA`). */
35
+ export declare const API_TOKEN_ID_PREFIX = "tok_";
36
+ /** Length of the public id's body — the raw token body's first characters. */
37
+ export declare const API_TOKEN_ID_BODY_LENGTH = 12;
34
38
  /**
35
- * Regex for the public API token id (e.g. `tok_abC0_d-3xyzA`). Twelve
36
- * base64url characters after the `tok_` prefix. Matches the format produced
37
- * by `generate_api_token`.
39
+ * Regex for the public API token id (e.g. `tok_abC0_d-3xyzA`):
40
+ * `API_TOKEN_ID_PREFIX` plus `API_TOKEN_ID_BODY_LENGTH` base64url characters.
41
+ * Matches the format `to_api_token_id` derives.
38
42
  */
39
43
  export declare const API_TOKEN_ID_REGEX: RegExp;
40
44
  /** The public API token id, `API_TOKEN_ID_REGEX`, a `@fuzdev/fuz_schema` schema. */
@@ -47,6 +51,19 @@ export type ApiTokenId = Infer<typeof ApiTokenId>;
47
51
  * @returns hex-encoded blake3 hash
48
52
  */
49
53
  export declare const hash_api_token: (token: string) => string;
54
+ /**
55
+ * The public id of a raw API token: `API_TOKEN_ID_PREFIX` and the first
56
+ * `API_TOKEN_ID_BODY_LENGTH` characters of the body after `API_TOKEN_PREFIX`.
57
+ * Both spines derive it the same way, so a token minted by either names the
58
+ * same id on both. Twin of the Rust spine's `fuz_auth::api_token::to_api_token_id`,
59
+ * which answers `None` where this throws.
60
+ *
61
+ * @param token - the whole raw token, `API_TOKEN_PREFIX` included
62
+ * @returns the token's public id
63
+ * @throws Error when `token` is not `is_api_token_shaped` — a caller holds a
64
+ * minted or prechecked token, so anything else is a bug
65
+ */
66
+ export declare const to_api_token_id: (token: string) => ApiTokenId;
50
67
  /**
51
68
  * Generate a new API token with its hash and public id.
52
69
  *
@@ -1 +1 @@
1
- {"version":3,"file":"api_token.d.ts","sourceRoot":"","sources":["../../src/lib/auth/api_token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAuB,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAK/E,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD,+DAA+D;AAC/D,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,QAA+C,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAE3B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,KAAG,OAAoC,CAAC;AAEvF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAA4B,CAAC;AAE5D,oFAAoF;AACpF,eAAO,MAAM,UAAU,gHAA0C,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MAA4B,CAAC;AAE5E;;;;;;;GAO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_REGEX = new RegExp(`^${API_TOKEN_PREFIX}[A-Za-z0-9_-]{${A
33
33
  * @returns `true` when `raw` matches `API_TOKEN_REGEX`
34
34
  */
35
35
  export const is_api_token_shaped = (raw) => API_TOKEN_REGEX.test(raw);
36
+ /** Prefix on the public API token id (e.g. `tok_abC0_d-3xyzA`). */
37
+ export const API_TOKEN_ID_PREFIX = 'tok_';
38
+ /** Length of the public id's body — the raw token body's first characters. */
39
+ export const API_TOKEN_ID_BODY_LENGTH = 12;
36
40
  /**
37
- * Regex for the public API token id (e.g. `tok_abC0_d-3xyzA`). Twelve
38
- * base64url characters after the `tok_` prefix. Matches the format produced
39
- * by `generate_api_token`.
41
+ * Regex for the public API token id (e.g. `tok_abC0_d-3xyzA`):
42
+ * `API_TOKEN_ID_PREFIX` plus `API_TOKEN_ID_BODY_LENGTH` base64url characters.
43
+ * Matches the format `to_api_token_id` derives.
40
44
  */
41
- export const API_TOKEN_ID_REGEX = /^tok_[A-Za-z0-9_-]{12}$/;
45
+ export const API_TOKEN_ID_REGEX = new RegExp(`^${API_TOKEN_ID_PREFIX}[A-Za-z0-9_-]{${API_TOKEN_ID_BODY_LENGTH}}$`);
42
46
  /** The public API token id, `API_TOKEN_ID_REGEX`, a `@fuzdev/fuz_schema` schema. */
43
47
  export const ApiTokenId = pipe(string, regex(API_TOKEN_ID_REGEX));
44
48
  /**
@@ -48,6 +52,24 @@ export const ApiTokenId = pipe(string, regex(API_TOKEN_ID_REGEX));
48
52
  * @returns hex-encoded blake3 hash
49
53
  */
50
54
  export const hash_api_token = (token) => hash_blake3(token);
55
+ /**
56
+ * The public id of a raw API token: `API_TOKEN_ID_PREFIX` and the first
57
+ * `API_TOKEN_ID_BODY_LENGTH` characters of the body after `API_TOKEN_PREFIX`.
58
+ * Both spines derive it the same way, so a token minted by either names the
59
+ * same id on both. Twin of the Rust spine's `fuz_auth::api_token::to_api_token_id`,
60
+ * which answers `None` where this throws.
61
+ *
62
+ * @param token - the whole raw token, `API_TOKEN_PREFIX` included
63
+ * @returns the token's public id
64
+ * @throws Error when `token` is not `is_api_token_shaped` — a caller holds a
65
+ * minted or prechecked token, so anything else is a bug
66
+ */
67
+ export const to_api_token_id = (token) => {
68
+ if (!is_api_token_shaped(token))
69
+ throw new Error('to_api_token_id: not an API token');
70
+ return (API_TOKEN_ID_PREFIX +
71
+ token.slice(API_TOKEN_PREFIX.length, API_TOKEN_PREFIX.length + API_TOKEN_ID_BODY_LENGTH));
72
+ };
51
73
  /**
52
74
  * Generate a new API token with its hash and public id.
53
75
  *
@@ -57,9 +79,6 @@ export const hash_api_token = (token) => hash_blake3(token);
57
79
  * @returns the raw token, a public id, and the blake3 hash for storage
58
80
  */
59
81
  export const generate_api_token = () => {
60
- const raw = generate_random_base64url(API_TOKEN_ENTROPY_BYTES);
61
- const token = `${API_TOKEN_PREFIX}${raw}`;
62
- const token_hash = hash_api_token(token);
63
- const id = `tok_${raw.slice(0, 12)}`;
64
- return { token, id, token_hash };
82
+ const token = `${API_TOKEN_PREFIX}${generate_random_base64url(API_TOKEN_ENTROPY_BYTES)}`;
83
+ return { token, id: to_api_token_id(token), token_hash: hash_api_token(token) };
65
84
  };
@@ -38,7 +38,7 @@ export declare const API_TOKEN_COLUMNS: readonly ["id", "account_id", "name", "t
38
38
  * Store a new API token (the hash, not the raw token).
39
39
  *
40
40
  * @param deps - query dependencies
41
- * @param id - the public token id (e.g. `tok_abc123`)
41
+ * @param id - the public token id (e.g. `tok_abC0_d-3xyzA`)
42
42
  * @param account_id - the owning account
43
43
  * @param name - human-readable name
44
44
  * @param token_hash - blake3 hash of the raw token
@@ -87,7 +87,7 @@ export declare const query_api_token_touch: (deps: QueryDeps, id: string, ip: st
87
87
  * admitted with, and nothing rewrites the column after the mint.
88
88
  *
89
89
  * @param deps - query dependencies
90
- * @param id - the public token id (e.g. `tok_abc123`)
90
+ * @param id - the public token id (e.g. `tok_abC0_d-3xyzA`)
91
91
  * @returns the owning account id, or `undefined` when the token is gone or expired
92
92
  */
93
93
  export declare const query_api_token_live_account: (deps: QueryDeps, id: string) => Promise<string | undefined>;
@@ -53,7 +53,7 @@ const API_TOKEN_IS_LIVE = '(expires_at IS NULL OR expires_at > NOW())';
53
53
  * Store a new API token (the hash, not the raw token).
54
54
  *
55
55
  * @param deps - query dependencies
56
- * @param id - the public token id (e.g. `tok_abc123`)
56
+ * @param id - the public token id (e.g. `tok_abC0_d-3xyzA`)
57
57
  * @param account_id - the owning account
58
58
  * @param name - human-readable name
59
59
  * @param token_hash - blake3 hash of the raw token
@@ -134,7 +134,7 @@ export const query_api_token_touch = async (deps, id, ip) => {
134
134
  * admitted with, and nothing rewrites the column after the mint.
135
135
  *
136
136
  * @param deps - query dependencies
137
- * @param id - the public token id (e.g. `tok_abc123`)
137
+ * @param id - the public token id (e.g. `tok_abC0_d-3xyzA`)
138
138
  * @returns the owning account id, or `undefined` when the token is gone or expired
139
139
  */
140
140
  export const query_api_token_live_account = async (deps, id) => {
@@ -291,10 +291,11 @@ export interface AuditLogEvent {
291
291
  * declares `acting?: ActingActor` or its auth requires role_grants
292
292
  * (`role` / `keeper`). Account-grain operations declare neither,
293
293
  * so no actor is resolved and `actor_id` is null: login (also
294
- * pre-credential), logout, signup, bootstrap, password_change,
295
- * session/token revoke, app_settings_update, invite events.
296
- * Role grant events, admin actions, and actor-targeted offers
297
- * populate this with the initiator's actor.
294
+ * pre-credential), logout, password_change, session/token revoke,
295
+ * app_settings_update. Signup and bootstrap name the actor they
296
+ * create. Role grant events, offer events a request initiates, and
297
+ * the other admin actions (the invite events included) populate this
298
+ * with the initiator's actor.
298
299
  */
299
300
  actor_id: Uuid | null;
300
301
  account_id: Uuid | null;
@@ -316,8 +317,11 @@ export interface AuditLogEvent {
316
317
  * carry the actor when the offer was actor-targeted at create time
317
318
  * (`role_grant_offer.to_actor_id` set), null when the offer was
318
319
  * account-grain (any actor on `to_account_id` may accept).
319
- * - Not populated: admin actions, account-shape events (login,
320
- * logout, signup, bootstrap, password_change, session/token
320
+ * - Populated with the removed actor: the per-actor `actor_delete` /
321
+ * `actor_purge` / `actor_undelete` rows an account removal or
322
+ * reactivation writes.
323
+ * - Not populated: other admin actions and account-shape events
324
+ * (login, logout, signup, bootstrap, password_change, session/token
321
325
  * revoke, app_settings_update, invite events) — subject is the
322
326
  * account or no specific resource, not an actor-bound role_grant.
323
327
  * - Not populated: events whose principal isn't an actor-bound
@@ -330,9 +334,11 @@ export interface AuditLogEvent {
330
334
  * holds uniformly across every populated event including decline
331
335
  * (the grantor's account is joined into the decline RETURNING) and
332
336
  * the supersede cascade (the recipient account is known on
333
- * `role_grant_offer.to_account_id`). `target_account_id` stays the
334
- * SSE/WS socket-close key because sessions remain account-grain
335
- * after multi-actor lands.
337
+ * `role_grant_offer.to_account_id`). An `account`- or
338
+ * `role`-scoped connection close keys on `target_account_id ??
339
+ * account_id`, since sessions are account-grain; a `session` or `token`
340
+ * close keys on the row's metadata (`to_connection_close_target` in
341
+ * `actions/connection_closer.ts`).
336
342
  */
337
343
  target_actor_id: Uuid | null;
338
344
  ip: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"audit_log_schema.d.ts","sourceRoot":"","sources":["../../src/lib/auth/audit_log_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAkBN,KAAK,SAAS,EACd,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAoC,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAmBjF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,6iBA6BnB,CAAC;AAEZ,8DAA8D;AAC9D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhF;;;;;;;;;;;;;;;;GAgBG;AACH,eAA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AmB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAY5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEhE,+EAA+E;AAC/E,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;EAIzC,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAE1F,wFAAwF;AACxF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;EAIpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAIhF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;EAG3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -398,8 +398,7 @@ export const audit_metadata_schemas = Object.freeze({
398
398
  // tombstone), `purge` = hard (irreversible cascading removal). Known
399
399
  // fields are optional so the same schema validates the success
400
400
  // snapshot and the not-found failure shape (`reason` /
401
- // `attempted_account_id`). See `auth/CLAUDE.md` §Account/actor deletion
402
- // (delete = soft, purge = hard).
401
+ // `attempted_account_id`). See `auth/CLAUDE.md` §Admin actions.
403
402
  account_delete: loose_object({
404
403
  username: meta(optional(string), { description: 'Username at soft-delete time.' }),
405
404
  email: meta(optional(nullable(string)), {
@@ -9,7 +9,7 @@
9
9
  * gate that reads only what the auth middleware already set: `require_auth`
10
10
  * whenever `auth.account === 'required'` or `auth.actor === 'required'`
11
11
  * (per registry-time invariant 3, `actor: 'required'` today implies a
12
- * credential — accountless actors are out of scope for v1),
12
+ * credential — accountless actors are out of scope),
13
13
  * `require_credential_types(types)` whenever `auth.credential_types?.length`,
14
14
  * and the token-scope guard whenever `auth.required_scope` names a capability.
15
15
  * All three fire before any body parsing, so a caller they refuse never sees
@@ -9,7 +9,7 @@
9
9
  * gate that reads only what the auth middleware already set: `require_auth`
10
10
  * whenever `auth.account === 'required'` or `auth.actor === 'required'`
11
11
  * (per registry-time invariant 3, `actor: 'required'` today implies a
12
- * credential — accountless actors are out of scope for v1),
12
+ * credential — accountless actors are out of scope),
13
13
  * `require_credential_types(types)` whenever `auth.credential_types?.length`,
14
14
  * and the token-scope guard whenever `auth.required_scope` names a capability.
15
15
  * All three fire before any body parsing, so a caller they refuse never sees
@@ -4,11 +4,8 @@
4
4
  * Bearer tokens are rejected when `Origin` or `Referer` headers are present —
5
5
  * browsers must use cookie auth. This reduces attack surface: a stolen token
6
6
  * cannot be replayed from a browser context (the browser adds `Origin`
7
- * automatically). The discard is silent on the wire (anti-enumeration); in
8
- * `DEV` only, the middleware adds an `X-Fuz-Auth-Debug:
9
- * bearer_discarded_browser_context` response header so tests/tooling can tell
10
- * "token discarded for browser context" apart from "no credential supplied"
11
- * without weakening production.
7
+ * automatically). The discard is silent on the wire (anti-enumeration) and
8
+ * logged at debug, the line the Rust spine logs.
12
9
  *
13
10
  * Token generation and hashing utilities live in `auth/api_token.ts`.
14
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"bearer_auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth/bearer_auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAQtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,6BAA6B,GAAI,MAAM,SAAS,EAAE,KAAK,MAAM,KAAG,iBA0E5E,CAAC"}
1
+ {"version":3,"file":"bearer_auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth/bearer_auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAQtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,6BAA6B,GAAI,MAAM,SAAS,EAAE,KAAK,MAAM,KAAG,iBAsE5E,CAAC"}
@@ -4,17 +4,13 @@
4
4
  * Bearer tokens are rejected when `Origin` or `Referer` headers are present —
5
5
  * browsers must use cookie auth. This reduces attack surface: a stolen token
6
6
  * cannot be replayed from a browser context (the browser adds `Origin`
7
- * automatically). The discard is silent on the wire (anti-enumeration); in
8
- * `DEV` only, the middleware adds an `X-Fuz-Auth-Debug:
9
- * bearer_discarded_browser_context` response header so tests/tooling can tell
10
- * "token discarded for browser context" apart from "no credential supplied"
11
- * without weakening production.
7
+ * automatically). The discard is silent on the wire (anti-enumeration) and
8
+ * logged at debug, the line the Rust spine logs.
12
9
  *
13
10
  * Token generation and hashing utilities live in `auth/api_token.ts`.
14
11
  *
15
12
  * @module
16
13
  */
17
- import { DEV } from 'esm-env';
18
14
  import { RESOLVED_AUTH_KEY } from '../hono_context.js';
19
15
  import { credential_deadline_after } from './credential_deadline.js';
20
16
  import { get_resolved_auth } from './resolved_auth.js';
@@ -87,14 +83,9 @@ export const create_bearer_auth_middleware = (deps, log) => {
87
83
  // the RPC dispatcher can still handle public actions or fall through to
88
84
  // cookie auth.
89
85
  if (is_browser_context(get_header_lines(c, 'origin'), get_header_lines(c, 'referer'))) {
86
+ // silent on the wire by design: a stolen-token probe gets an
87
+ // indistinguishable 401, not a "your token was dropped" signal
90
88
  log.debug('bearer auth rejected: browser context (Origin/Referer present)');
91
- // The discard is silent on the wire by design (a stolen-token probe
92
- // gets an indistinguishable 401, not a "your token was dropped"
93
- // signal — anti-enumeration). That same silence makes the contract
94
- // easy to trip over in tests/tooling, so surface the reason in DEV
95
- // only: production never emits it, so it leaks nothing to an attacker.
96
- if (DEV)
97
- c.header('X-Fuz-Auth-Debug', 'bearer_discarded_browser_context');
98
89
  await next();
99
90
  return;
100
91
  }
@@ -12,29 +12,27 @@
12
12
  import type { Logger } from '@fuzdev/fuz_util/log.ts';
13
13
  import type { PasswordHashDeps } from './password.js';
14
14
  import { ERROR_INVALID_TOKEN, ERROR_ALREADY_BOOTSTRAPPED, ERROR_TOKEN_FILE_MISSING, ERROR_TOKEN_FILE_UNDELETABLE } from '../http/error_schemas.js';
15
- import type { Account, Actor, RoleGrant } from './account_schema.js';
15
+ import type { Account, Actor } from './account_schema.js';
16
16
  import { type RequestEffectsContext } from '../http/pending_effects.js';
17
17
  import type { AuditEmitter } from './audit_emitter.js';
18
18
  import type { BootstrapTokenStore } from './bootstrap_token_store.js';
19
19
  import type { Keyring } from './keyring.js';
20
- import { type SessionOptions } from './session_cookie.js';
21
20
  /** Input for the bootstrap account creation. */
22
21
  export interface BootstrapAccountInput {
23
22
  username: string;
24
23
  password: string;
25
24
  }
26
- /** What a successful bootstrap created. */
27
- export interface BootstrapAccountCreated {
25
+ /**
26
+ * Successful bootstrap result: the new session and the created entities. Twin
27
+ * of the Rust `BootstrapSuccess`; internal — the route answers
28
+ * `BootstrapOutput` from it.
29
+ */
30
+ export interface BootstrapAccountSuccess {
31
+ ok: true;
32
+ /** The raw session token (its hash is the `auth_session` row id) — a live credential. */
33
+ session_token: string;
28
34
  account: Account;
29
35
  actor: Actor;
30
- role_grants: {
31
- keeper: RoleGrant;
32
- admin: RoleGrant;
33
- };
34
- }
35
- /** Successful bootstrap result with the created entities and the new session. */
36
- export interface BootstrapAccountSuccess extends BootstrapAccountCreated {
37
- ok: true;
38
36
  /**
39
37
  * The `Set-Cookie` line of the session minted in the bootstrap
40
38
  * transaction, formatted inside it, for the caller to set on its
@@ -94,8 +92,8 @@ export interface BootstrapAccountContext extends RequestEffectsContext {
94
92
  }
95
93
  /** Static options for `bootstrap_account`. */
96
94
  export interface BootstrapAccountOptions {
97
- /** Session cookie configuration for the session the bootstrap mints. */
98
- session_options: SessionOptions<string>;
95
+ /** The session cookie's name for the session the bootstrap mints. */
96
+ session_cookie_name: string;
99
97
  }
100
98
  /**
101
99
  * The fewest bytes a bootstrap token holds, counted after its one optional
@@ -153,7 +151,7 @@ export declare const read_bootstrap_token: (deps: Pick<BootstrapAccountDeps, "to
153
151
  * @param provided_token - the bootstrap token from the user
154
152
  * @param input - username and password
155
153
  * @param options - the session cookie configuration
156
- * @returns the created account, actor, role_grants, and the session's `Set-Cookie` line — or a bootstrap failure
154
+ * @returns the created account and actor, and the session's `Set-Cookie` line — or a bootstrap failure
157
155
  * @mutates `bootstrap_lock` row - flips `bootstrapped` to `true` atomically
158
156
  * @mutates `account` / `actor` / `role_grant` / `auth_session` / `audit_log` tables - inserts the bootstrap account, actor, keeper + admin role_grants, session, and success row
159
157
  * @mutates `ctx.post_commit_effects` - appends the success row's listener fan-out, discarded on rollback
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap_account.d.ts","sourceRoot":"","sources":["../../src/lib/auth/bootstrap_account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B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