@fuzdev/fuz_app 0.180.0 → 0.182.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 (389) hide show
  1. package/dist/actions/CLAUDE.md +38 -20
  2. package/dist/actions/action_rpc.d.ts +25 -6
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +56 -48
  5. package/dist/actions/action_types.d.ts +31 -13
  6. package/dist/actions/action_types.d.ts.map +1 -1
  7. package/dist/actions/action_types.js +1 -1
  8. package/dist/actions/notification_sender.d.ts +83 -0
  9. package/dist/actions/notification_sender.d.ts.map +1 -0
  10. package/dist/actions/notification_sender.js +85 -0
  11. package/dist/actions/perform_action.d.ts +13 -4
  12. package/dist/actions/perform_action.d.ts.map +1 -1
  13. package/dist/actions/perform_action.js +27 -18
  14. package/dist/actions/register_action_ws.d.ts +20 -2
  15. package/dist/actions/register_action_ws.d.ts.map +1 -1
  16. package/dist/actions/register_action_ws.js +17 -5
  17. package/dist/actions/ws_socket_session.d.ts +3 -0
  18. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  19. package/dist/actions/ws_socket_session.js +3 -2
  20. package/dist/auth/CLAUDE.md +84 -59
  21. package/dist/auth/account_actions.d.ts.map +1 -1
  22. package/dist/auth/account_actions.js +30 -3
  23. package/dist/auth/account_queries.d.ts +213 -2
  24. package/dist/auth/account_queries.d.ts.map +1 -1
  25. package/dist/auth/account_queries.js +255 -2
  26. package/dist/auth/account_route_schema.d.ts +26 -16
  27. package/dist/auth/account_route_schema.d.ts.map +1 -1
  28. package/dist/auth/account_route_schema.js +10 -24
  29. package/dist/auth/account_routes.d.ts +5 -7
  30. package/dist/auth/account_routes.d.ts.map +1 -1
  31. package/dist/auth/account_routes.js +110 -89
  32. package/dist/auth/admin_actions.d.ts.map +1 -1
  33. package/dist/auth/admin_actions.js +117 -25
  34. package/dist/auth/api_token_queries.d.ts +29 -12
  35. package/dist/auth/api_token_queries.d.ts.map +1 -1
  36. package/dist/auth/api_token_queries.js +42 -27
  37. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  38. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  39. package/dist/auth/audit_log_routes.d.ts +1 -1
  40. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  41. package/dist/auth/audit_log_routes.js +10 -12
  42. package/dist/auth/audit_log_schema.js +4 -4
  43. package/dist/auth/bearer_auth.d.ts +4 -3
  44. package/dist/auth/bearer_auth.d.ts.map +1 -1
  45. package/dist/auth/bearer_auth.js +37 -32
  46. package/dist/auth/bootstrap_account.d.ts +65 -37
  47. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_account.js +115 -66
  49. package/dist/auth/bootstrap_route_schema.d.ts +6 -2
  50. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  51. package/dist/auth/bootstrap_route_schema.js +7 -2
  52. package/dist/auth/bootstrap_routes.d.ts +50 -33
  53. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  54. package/dist/auth/bootstrap_routes.js +109 -87
  55. package/dist/auth/bootstrap_token_store.d.ts +60 -0
  56. package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
  57. package/dist/auth/bootstrap_token_store.js +39 -0
  58. package/dist/auth/credential_headers.d.ts +71 -0
  59. package/dist/auth/credential_headers.d.ts.map +1 -0
  60. package/dist/auth/credential_headers.js +100 -0
  61. package/dist/auth/daemon_token.d.ts +13 -1
  62. package/dist/auth/daemon_token.d.ts.map +1 -1
  63. package/dist/auth/daemon_token.js +14 -2
  64. package/dist/auth/daemon_token_middleware.d.ts +10 -11
  65. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  66. package/dist/auth/daemon_token_middleware.js +39 -30
  67. package/dist/auth/deps.d.ts +10 -11
  68. package/dist/auth/deps.d.ts.map +1 -1
  69. package/dist/auth/invite_queries.d.ts +18 -0
  70. package/dist/auth/invite_queries.d.ts.map +1 -1
  71. package/dist/auth/invite_queries.js +24 -0
  72. package/dist/auth/request_context.d.ts +97 -76
  73. package/dist/auth/request_context.d.ts.map +1 -1
  74. package/dist/auth/request_context.js +93 -104
  75. package/dist/auth/resolved_auth.d.ts +10 -5
  76. package/dist/auth/resolved_auth.d.ts.map +1 -1
  77. package/dist/auth/resolved_auth.js +2 -2
  78. package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
  79. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  80. package/dist/auth/role_grant_offer_action_specs.js +5 -3
  81. package/dist/auth/role_grant_offer_actions.d.ts +7 -11
  82. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  83. package/dist/auth/role_grant_offer_actions.js +97 -106
  84. package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
  85. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  86. package/dist/auth/role_grant_offer_ddl.js +9 -2
  87. package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
  88. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  89. package/dist/auth/role_grant_offer_notifications.js +75 -22
  90. package/dist/auth/role_grant_offer_queries.d.ts +143 -9
  91. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  92. package/dist/auth/role_grant_offer_queries.js +266 -66
  93. package/dist/auth/role_grant_offer_schema.js +1 -1
  94. package/dist/auth/role_grant_queries.d.ts +57 -10
  95. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  96. package/dist/auth/role_grant_queries.js +81 -22
  97. package/dist/auth/role_grant_sql.d.ts +21 -0
  98. package/dist/auth/role_grant_sql.d.ts.map +1 -1
  99. package/dist/auth/role_grant_sql.js +21 -0
  100. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  101. package/dist/auth/self_service_role_actions.js +9 -2
  102. package/dist/auth/session_cookie.d.ts +105 -25
  103. package/dist/auth/session_cookie.d.ts.map +1 -1
  104. package/dist/auth/session_cookie.js +124 -15
  105. package/dist/auth/session_middleware.d.ts +83 -54
  106. package/dist/auth/session_middleware.d.ts.map +1 -1
  107. package/dist/auth/session_middleware.js +92 -66
  108. package/dist/auth/session_queries.d.ts +95 -14
  109. package/dist/auth/session_queries.d.ts.map +1 -1
  110. package/dist/auth/session_queries.js +98 -19
  111. package/dist/auth/signup_route_schema.d.ts +5 -5
  112. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  113. package/dist/auth/signup_route_schema.js +4 -4
  114. package/dist/auth/signup_routes.d.ts.map +1 -1
  115. package/dist/auth/signup_routes.js +17 -14
  116. package/dist/auth/standard_rpc_actions.d.ts +6 -19
  117. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  118. package/dist/auth/standard_rpc_actions.js +5 -6
  119. package/dist/auth/token_scope.d.ts +6 -8
  120. package/dist/auth/token_scope.d.ts.map +1 -1
  121. package/dist/auth/token_scope.js +6 -9
  122. package/dist/dev/setup.d.ts +6 -1
  123. package/dist/dev/setup.d.ts.map +1 -1
  124. package/dist/dev/setup.js +42 -34
  125. package/dist/hono_context.d.ts +21 -0
  126. package/dist/hono_context.d.ts.map +1 -1
  127. package/dist/hono_context.js +17 -0
  128. package/dist/http/CLAUDE.md +156 -48
  129. package/dist/http/auth_shape.d.ts +4 -4
  130. package/dist/http/common_routes.js +1 -1
  131. package/dist/http/db_routes.d.ts +4 -3
  132. package/dist/http/db_routes.d.ts.map +1 -1
  133. package/dist/http/db_routes.js +14 -14
  134. package/dist/http/dev_route_error_check.d.ts +6 -3
  135. package/dist/http/dev_route_error_check.d.ts.map +1 -1
  136. package/dist/http/dev_route_error_check.js +6 -3
  137. package/dist/http/dev_set_cookie_check.d.ts +53 -0
  138. package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
  139. package/dist/http/dev_set_cookie_check.js +80 -0
  140. package/dist/http/error_schemas.d.ts +45 -22
  141. package/dist/http/error_schemas.d.ts.map +1 -1
  142. package/dist/http/error_schemas.js +53 -26
  143. package/dist/http/header_lines.d.ts +42 -0
  144. package/dist/http/header_lines.d.ts.map +1 -0
  145. package/dist/http/header_lines.js +80 -0
  146. package/dist/http/host.d.ts +12 -9
  147. package/dist/http/host.d.ts.map +1 -1
  148. package/dist/http/host.js +25 -20
  149. package/dist/http/origin.d.ts +7 -22
  150. package/dist/http/origin.d.ts.map +1 -1
  151. package/dist/http/origin.js +11 -25
  152. package/dist/http/proxy.d.ts +1 -0
  153. package/dist/http/proxy.d.ts.map +1 -1
  154. package/dist/http/proxy.js +3 -0
  155. package/dist/http/request_headers.d.ts +95 -0
  156. package/dist/http/request_headers.d.ts.map +1 -0
  157. package/dist/http/request_headers.js +110 -0
  158. package/dist/http/request_target.d.ts +134 -0
  159. package/dist/http/request_target.d.ts.map +1 -0
  160. package/dist/http/request_target.js +193 -0
  161. package/dist/http/route_error_check.d.ts +4 -11
  162. package/dist/http/route_error_check.d.ts.map +1 -1
  163. package/dist/http/route_error_check.js +4 -21
  164. package/dist/http/route_result.d.ts +127 -23
  165. package/dist/http/route_result.d.ts.map +1 -1
  166. package/dist/http/route_result.js +97 -19
  167. package/dist/http/route_spec.d.ts +299 -83
  168. package/dist/http/route_spec.d.ts.map +1 -1
  169. package/dist/http/route_spec.js +548 -71
  170. package/dist/http/simple_request.d.ts +19 -14
  171. package/dist/http/simple_request.d.ts.map +1 -1
  172. package/dist/http/simple_request.js +17 -29
  173. package/dist/http/surface.d.ts +2 -0
  174. package/dist/http/surface.d.ts.map +1 -1
  175. package/dist/http/surface.js +4 -1
  176. package/dist/realtime/outbound_budget.d.ts +1 -2
  177. package/dist/realtime/outbound_budget.d.ts.map +1 -1
  178. package/dist/realtime/outbound_budget.js +1 -2
  179. package/dist/realtime/sse.d.ts +47 -17
  180. package/dist/realtime/sse.d.ts.map +1 -1
  181. package/dist/realtime/sse.js +115 -93
  182. package/dist/realtime/sse_constants.d.ts +7 -1
  183. package/dist/realtime/sse_constants.d.ts.map +1 -1
  184. package/dist/realtime/sse_constants.js +12 -1
  185. package/dist/realtime/sse_registry.d.ts +3 -3
  186. package/dist/realtime/sse_registry.js +3 -3
  187. package/dist/runtime/deps.d.ts +20 -4
  188. package/dist/runtime/deps.d.ts.map +1 -1
  189. package/dist/runtime/mock.d.ts +7 -1
  190. package/dist/runtime/mock.d.ts.map +1 -1
  191. package/dist/runtime/mock.js +33 -3
  192. package/dist/runtime/node.d.ts.map +1 -1
  193. package/dist/runtime/node.js +2 -1
  194. package/dist/runtime/secure_file.d.ts +71 -10
  195. package/dist/runtime/secure_file.d.ts.map +1 -1
  196. package/dist/runtime/secure_file.js +91 -11
  197. package/dist/server/app_backend.d.ts +0 -8
  198. package/dist/server/app_backend.d.ts.map +1 -1
  199. package/dist/server/app_backend.js +4 -4
  200. package/dist/server/app_server.d.ts +54 -33
  201. package/dist/server/app_server.d.ts.map +1 -1
  202. package/dist/server/app_server.js +69 -41
  203. package/dist/server/serve_fact_route.d.ts +3 -3
  204. package/dist/server/serve_fact_route.d.ts.map +1 -1
  205. package/dist/server/serve_fact_route.js +59 -55
  206. package/dist/server/static.d.ts +20 -0
  207. package/dist/server/static.d.ts.map +1 -1
  208. package/dist/server/static.js +56 -8
  209. package/dist/server/unmatched_route.d.ts +42 -0
  210. package/dist/server/unmatched_route.d.ts.map +1 -0
  211. package/dist/server/unmatched_route.js +64 -0
  212. package/dist/testing/CLAUDE.md +406 -1202
  213. package/dist/testing/app_server.d.ts +3 -1
  214. package/dist/testing/app_server.d.ts.map +1 -1
  215. package/dist/testing/app_server.js +5 -9
  216. package/dist/testing/auth_apps.d.ts.map +1 -1
  217. package/dist/testing/auth_apps.js +3 -2
  218. package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
  219. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  220. package/dist/testing/cross_backend/account_lifecycle.js +320 -6
  221. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
  222. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  223. package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
  224. package/dist/testing/cross_backend/capabilities.d.ts +68 -5
  225. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  226. package/dist/testing/cross_backend/capabilities.js +20 -4
  227. package/dist/testing/cross_backend/cell_gated_create.js +1 -1
  228. package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
  229. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  230. package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
  231. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  232. package/dist/testing/cross_backend/conformance_table.js +179 -23
  233. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  234. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
  235. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  236. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
  237. package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
  238. package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
  239. package/dist/testing/cross_backend/credential_conformance.js +296 -0
  240. package/dist/testing/cross_backend/credential_conformance.json +1284 -0
  241. package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
  242. package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
  243. package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
  244. package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
  245. package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
  246. package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
  247. package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
  248. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
  249. package/dist/testing/cross_backend/credential_wire.js +188 -0
  250. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  251. package/dist/testing/cross_backend/default_backend_configs.js +22 -2
  252. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
  253. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  254. package/dist/testing/cross_backend/default_spine_surface.js +3 -7
  255. package/dist/testing/cross_backend/differential.d.ts +1 -1
  256. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  257. package/dist/testing/cross_backend/differential.js +3 -2
  258. package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
  259. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  260. package/dist/testing/cross_backend/differential_normalize.js +11 -5
  261. package/dist/testing/cross_backend/full_spine_mount.d.ts +4 -10
  262. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  263. package/dist/testing/cross_backend/full_spine_mount.js +11 -4
  264. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  265. package/dist/testing/cross_backend/identity_parity.js +4 -0
  266. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  267. package/dist/testing/cross_backend/in_process_setup.js +78 -4
  268. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  269. package/dist/testing/cross_backend/login_security.js +13 -10
  270. package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
  271. package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
  272. package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
  273. package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
  274. package/dist/testing/cross_backend/request_header_conformance.js +196 -0
  275. package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
  276. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
  277. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
  278. package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
  279. package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
  280. package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
  281. package/dist/testing/cross_backend/request_target_conformance.js +186 -0
  282. package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
  283. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
  284. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
  285. package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
  286. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  287. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
  288. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
  289. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  290. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +185 -31
  291. package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
  292. package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
  293. package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
  294. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
  295. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  296. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
  297. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  298. package/dist/testing/cross_backend/session_cap.js +82 -34
  299. package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
  300. package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
  301. package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
  302. package/dist/testing/cross_backend/session_login.d.ts +24 -0
  303. package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
  304. package/dist/testing/cross_backend/session_login.js +31 -0
  305. package/dist/testing/cross_backend/setup.d.ts +117 -0
  306. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  307. package/dist/testing/cross_backend/setup.js +193 -9
  308. package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
  309. package/dist/testing/cross_backend/simple_request.js +5 -0
  310. package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
  311. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  312. package/dist/testing/cross_backend/spine_suites.js +88 -5
  313. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  314. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  315. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  316. package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
  317. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  318. package/dist/testing/cross_backend/sse_round_trip.js +205 -64
  319. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  320. package/dist/testing/cross_backend/testing_backdoor.js +5 -2
  321. package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
  322. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
  323. package/dist/testing/cross_backend/testing_credential_read.js +175 -0
  324. package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
  325. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  326. package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
  327. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  328. package/dist/testing/cross_backend/token_lifetime.js +58 -2
  329. package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
  330. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  331. package/dist/testing/cross_backend/transport_composition.js +13 -10
  332. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  333. package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
  334. package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
  335. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  336. package/dist/testing/cross_backend/ws_endpoint.js +19 -2
  337. package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
  338. package/dist/testing/cross_backend/ws_role_gated.js +2 -3
  339. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  340. package/dist/testing/cross_backend/ws_round_trip.js +28 -12
  341. package/dist/testing/cross_backend/xfail.d.ts +44 -11
  342. package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
  343. package/dist/testing/cross_backend/xfail.js +68 -23
  344. package/dist/testing/data_exposure.d.ts.map +1 -1
  345. package/dist/testing/data_exposure.js +4 -3
  346. package/dist/testing/integration.d.ts +1 -2
  347. package/dist/testing/integration.d.ts.map +1 -1
  348. package/dist/testing/integration.js +14 -8
  349. package/dist/testing/integration_helpers.d.ts +50 -3
  350. package/dist/testing/integration_helpers.d.ts.map +1 -1
  351. package/dist/testing/integration_helpers.js +87 -9
  352. package/dist/testing/middleware.d.ts +3 -1
  353. package/dist/testing/middleware.d.ts.map +1 -1
  354. package/dist/testing/middleware.js +14 -7
  355. package/dist/testing/resolved_auth.d.ts +3 -1
  356. package/dist/testing/resolved_auth.d.ts.map +1 -1
  357. package/dist/testing/resolved_auth.js +4 -4
  358. package/dist/testing/round_trip.d.ts +6 -2
  359. package/dist/testing/round_trip.d.ts.map +1 -1
  360. package/dist/testing/round_trip.js +17 -6
  361. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  362. package/dist/testing/rpc_envelope_cases.js +7 -0
  363. package/dist/testing/rpc_helpers.d.ts +4 -2
  364. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  365. package/dist/testing/rpc_helpers.js +6 -1
  366. package/dist/testing/rpc_round_trip.d.ts +13 -2
  367. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  368. package/dist/testing/rpc_round_trip.js +25 -6
  369. package/dist/testing/schema_generators.d.ts +2 -2
  370. package/dist/testing/schema_generators.d.ts.map +1 -1
  371. package/dist/testing/schema_generators.js +4 -4
  372. package/dist/testing/stubs.d.ts +2 -2
  373. package/dist/testing/stubs.d.ts.map +1 -1
  374. package/dist/testing/stubs.js +13 -10
  375. package/dist/testing/transports/fetch_transport.d.ts +6 -3
  376. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  377. package/dist/testing/transports/fetch_transport.js +31 -19
  378. package/dist/testing/transports/raw_http.d.ts +61 -1
  379. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  380. package/dist/testing/transports/raw_http.js +61 -1
  381. package/dist/testing/transports/ws_raw_client.d.ts +20 -0
  382. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  383. package/dist/testing/transports/ws_raw_client.js +10 -4
  384. package/dist/testing/transports/ws_transport.d.ts +21 -1
  385. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  386. package/dist/testing/transports/ws_transport.js +58 -20
  387. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  388. package/dist/testing/ws_round_trip.js +8 -4
  389. package/package.json +1 -1
@@ -159,9 +159,9 @@ export interface PendingSubscription {
159
159
  * const pending = registry.subscribe_pending({scope: session_hash, groups: [account_id]});
160
160
  * if (!(await credential_is_still_live())) {
161
161
  * pending.unsubscribe();
162
- * return unauthorized();
162
+ * return route_fail(REST_AUTHENTICATION_REQUIRED);
163
163
  * }
164
- * const {response, stream} = create_sse_response(c, log);
164
+ * const stream = route.open_sse();
165
165
  * // first: a client that already left closes the stream, its listener runs at
166
166
  * // once, and `admit` then refuses the removed registration
167
167
  * stream.on_close(pending.unsubscribe);
@@ -175,7 +175,7 @@ export interface PendingSubscription {
175
175
  * )
176
176
  * );
177
177
  * }
178
- * return response;
178
+ * return route_sse(stream);
179
179
  * ```
180
180
  */
181
181
  export declare class SseRegistry<T> {
@@ -99,9 +99,9 @@ import { Logger } from '@fuzdev/fuz_util/log.ts';
99
99
  * const pending = registry.subscribe_pending({scope: session_hash, groups: [account_id]});
100
100
  * if (!(await credential_is_still_live())) {
101
101
  * pending.unsubscribe();
102
- * return unauthorized();
102
+ * return route_fail(REST_AUTHENTICATION_REQUIRED);
103
103
  * }
104
- * const {response, stream} = create_sse_response(c, log);
104
+ * const stream = route.open_sse();
105
105
  * // first: a client that already left closes the stream, its listener runs at
106
106
  * // once, and `admit` then refuses the removed registration
107
107
  * stream.on_close(pending.unsubscribe);
@@ -115,7 +115,7 @@ import { Logger } from '@fuzdev/fuz_util/log.ts';
115
115
  * )
116
116
  * );
117
117
  * }
118
- * return response;
118
+ * return route_sse(stream);
119
119
  * ```
120
120
  */
121
121
  export class SseRegistry {
@@ -12,6 +12,7 @@
12
12
  *
13
13
  * @module
14
14
  */
15
+ import type { BurnOutcome, SecureReadOptions } from './secure_file.js';
15
16
  /**
16
17
  * Result of a stat operation.
17
18
  */
@@ -88,10 +89,25 @@ export interface FsSecureReadDeps {
88
89
  * has no file types), any group/other-accessible mode (must be `0600`/`0400`; skipped where POSIX
89
90
  * modes don't apply), and files over a 4 KiB cap. Permission checks run on
90
91
  * the open descriptor where the platform allows, so the file can't be
91
- * swapped between check and read. Throws on any refusal — a refused secret
92
- * must never degrade to an empty read.
92
+ * swapped between check and read. `options` adds strictness one reader
93
+ * asks for (`require_single_link`, the bootstrap token's). Throws on any
94
+ * refusal — a refused secret must never degrade to an empty read.
93
95
  */
94
- read_secure_file: (path: string) => Promise<Uint8Array>;
96
+ read_secure_file: (path: string, options?: SecureReadOptions) => Promise<Uint8Array>;
97
+ }
98
+ /**
99
+ * Durable removal of a one-shot secret file — the TS twin of the Rust
100
+ * spine's `fuz_sys::secure_file::burn_secure_file`.
101
+ */
102
+ export interface FsSecureBurnDeps {
103
+ /**
104
+ * Unlink the entry at `path` (a symlink itself, never its target; a
105
+ * directory is refused, never recursed into), then fsync its parent
106
+ * directory so the removal survives a host crash. A missing entry resolves
107
+ * `'already_gone'`; any other failure, the fsync's included, throws — a
108
+ * burn that can't be confirmed is a failed burn.
109
+ */
110
+ burn_secure_file: (path: string) => Promise<BurnOutcome>;
95
111
  }
96
112
  /**
97
113
  * File system read operations.
@@ -286,7 +302,7 @@ export interface ProcessProbeDeps {
286
302
  * Functions should accept narrow `*Deps` interfaces, not this full type —
287
303
  * this type is for the wiring layer that creates and passes the runtime.
288
304
  */
289
- export interface RuntimeDeps extends EnvDeps, FsReadDeps, FsSecureReadDeps, FsWriteDeps, FsStreamDeps, FsRemoveDeps, FetchDeps, TerminalDeps, ProcessDeps, ProcessProbeDeps, LogDeps {
305
+ export interface RuntimeDeps extends EnvDeps, FsReadDeps, FsSecureReadDeps, FsSecureBurnDeps, FsWriteDeps, FsStreamDeps, FsRemoveDeps, FetchDeps, TerminalDeps, ProcessDeps, ProcessProbeDeps, LogDeps {
290
306
  /** Get all environment variables. */
291
307
  env_all: () => Record<string, string>;
292
308
  /** CLI arguments passed to the program. */
@@ -1 +1 @@
1
- {"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,yCAAyC;IACzC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC9C,mCAAmC;IACnC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;;;OAQG;IACH,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,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AK,YAAY,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAChB,SACC,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,OAAO;IACR,qCAAqC;IACrC,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,qCAAqC;IACrC,GAAG,EAAE,MAAM,MAAM,CAAC;CAClB"}
@@ -25,6 +25,12 @@ export interface MockRuntime extends RuntimeDeps {
25
25
  * writer asked for `0o600` explicitly, mirroring the real runtimes.
26
26
  */
27
27
  mock_fs_modes: Map<string, number>;
28
+ /**
29
+ * Recorded link counts (path -> count) for a file with other hard links;
30
+ * a file with no entry has one, as a file the mock writes does. What
31
+ * `read_secure_file`'s `require_single_link` reads.
32
+ */
33
+ mock_fs_links: Map<string, number>;
28
34
  /** Mock directories that exist. */
29
35
  mock_dirs: Set<string>;
30
36
  /** Exit calls recorded (exit codes). */
@@ -70,7 +76,7 @@ export declare const create_mock_runtime: (args?: Array<string>) => MockRuntime;
70
76
  /**
71
77
  * Reset a mock runtime to initial state.
72
78
  *
73
- * @mutates runtime - clears all mock state (env, fs, modes, dirs, processes, exit/stdout/fetch call records, fetch responses, stdin buffer)
79
+ * @mutates runtime - clears all mock state (env, fs, modes, link counts, dirs, processes, exit/stdout/fetch call records, fetch responses, stdin buffer)
74
80
  */
75
81
  export declare const reset_mock_runtime: (runtime: MockRuntime) => void;
76
82
  /** A `Program` fake with its calls recorded for assertions. */
@@ -1 +1 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/mock.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACX,YAAY,EAC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AA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,UAAS,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAC1D,KACnB,WASF,CAAC;AAEF,iGAAiG;AACjG,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACzD,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACvD,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B,GACvC,UAAS,WAAW,GAAG,IAA4B,KACjD,kBAOF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,eAAW,EAAE,eAAW,KAAG,aAKzE,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,WAAW,EAAE,OAAO,MAAM,KAAG,IAEpE,CAAC;AAEF;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM;CAKxB"}
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @module
9
9
  */
10
- import { assert_secure_mode, assert_secure_size } from './secure_file.js';
10
+ import { assert_secure_link_count, assert_secure_mode, assert_secure_size } from './secure_file.js';
11
11
  import { assert_process_id } from './process_id.js';
12
12
  /**
13
13
  * Create a mock `RuntimeDeps` for testing.
@@ -34,6 +34,7 @@ export const create_mock_runtime = (args = []) => {
34
34
  const mock_fs = new Map();
35
35
  const mock_fs_bytes = new Map();
36
36
  const mock_fs_modes = new Map();
37
+ const mock_fs_links = new Map();
37
38
  const mock_dirs = new Set();
38
39
  const exit_calls = [];
39
40
  const mock_processes = new Map();
@@ -47,6 +48,7 @@ export const create_mock_runtime = (args = []) => {
47
48
  mock_fs,
48
49
  mock_fs_bytes,
49
50
  mock_fs_modes,
51
+ mock_fs_links,
50
52
  mock_dirs,
51
53
  exit_calls,
52
54
  mock_processes,
@@ -125,7 +127,7 @@ export const create_mock_runtime = (args = []) => {
125
127
  error.code = 'ENOENT';
126
128
  throw error;
127
129
  },
128
- read_secure_file: async (path) => {
130
+ read_secure_file: async (path, options) => {
129
131
  let bytes = mock_fs_bytes.get(path);
130
132
  if (bytes === undefined) {
131
133
  const content = mock_fs.get(path);
@@ -142,9 +144,26 @@ export const create_mock_runtime = (args = []) => {
142
144
  // writer asked for 0600, mirroring the real runtimes (simulated
143
145
  // modes, so no platform gate).
144
146
  assert_secure_mode(path, mock_fs_modes.get(path) ?? 0o644);
147
+ if (options?.require_single_link) {
148
+ assert_secure_link_count(path, mock_fs_links.get(path) ?? 1);
149
+ }
145
150
  assert_secure_size(path, bytes.length);
146
151
  return bytes;
147
152
  },
153
+ burn_secure_file: async (path) => {
154
+ // a directory is refused, never recursed into, as `unlink` refuses it
155
+ if (mock_dirs.has(path)) {
156
+ const error = new Error(`EISDIR: illegal operation on a directory: ${path}`);
157
+ error.code = 'EISDIR';
158
+ throw error;
159
+ }
160
+ const present = mock_fs.has(path) || mock_fs_bytes.has(path);
161
+ mock_fs.delete(path);
162
+ mock_fs_bytes.delete(path);
163
+ mock_fs_modes.delete(path);
164
+ mock_fs_links.delete(path);
165
+ return present ? 'burned' : 'already_gone';
166
+ },
148
167
  read_file_stream: async (path) => {
149
168
  let bytes = mock_fs_bytes.get(path);
150
169
  if (bytes === undefined) {
@@ -275,11 +294,21 @@ export const create_mock_runtime = (args = []) => {
275
294
  else {
276
295
  mock_fs_modes.delete(new_path);
277
296
  }
297
+ // so does its link count
298
+ const links = mock_fs_links.get(old_path);
299
+ if (links !== undefined) {
300
+ mock_fs_links.set(new_path, links);
301
+ mock_fs_links.delete(old_path);
302
+ }
303
+ else {
304
+ mock_fs_links.delete(new_path);
305
+ }
278
306
  },
279
307
  remove: async (path, options) => {
280
308
  mock_fs.delete(path);
281
309
  mock_fs_bytes.delete(path);
282
310
  mock_fs_modes.delete(path);
311
+ mock_fs_links.delete(path);
283
312
  mock_dirs.delete(path);
284
313
  if (options?.recursive) {
285
314
  const prefix = path.endsWith('/') ? path : path + '/';
@@ -328,7 +357,7 @@ export const create_mock_runtime = (args = []) => {
328
357
  /**
329
358
  * Reset a mock runtime to initial state.
330
359
  *
331
- * @mutates runtime - clears all mock state (env, fs, modes, dirs, processes, exit/stdout/fetch call records, fetch responses, stdin buffer)
360
+ * @mutates runtime - clears all mock state (env, fs, modes, link counts, dirs, processes, exit/stdout/fetch call records, fetch responses, stdin buffer)
332
361
  */
333
362
  export const reset_mock_runtime = (runtime) => {
334
363
  runtime.mock_env.clear();
@@ -337,6 +366,7 @@ export const reset_mock_runtime = (runtime) => {
337
366
  runtime.mock_dirs.clear();
338
367
  runtime.exit_calls.length = 0;
339
368
  runtime.mock_fs_modes.clear();
369
+ runtime.mock_fs_links.clear();
340
370
  runtime.mock_processes.clear();
341
371
  runtime.stdout_writes.length = 0;
342
372
  runtime.fetch_calls.length = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,WAAW,CAAC;AAIzD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC/B,OAAM,aAAa,CAAC,MAAM,CAAyB,KACjD,WA0ID,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,WAAW,CAAC;AAIzD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC/B,OAAM,aAAa,CAAC,MAAM,CAAyB,KACjD,WA2ID,CAAC"}
@@ -13,7 +13,7 @@ import { stat, mkdir, readFile, readdir, writeFile, rename, rm, open } from 'nod
13
13
  import process from 'node:process';
14
14
  import { Readable } from 'node:stream';
15
15
  import { pipeline } from 'node:stream/promises';
16
- import { load_secure_file_node } from './secure_file.js';
16
+ import { burn_secure_file_node, load_secure_file_node } from './secure_file.js';
17
17
  import { assert_process_id } from './process_id.js';
18
18
  /**
19
19
  * Create a `RuntimeDeps` backed by Node.js APIs.
@@ -68,6 +68,7 @@ export const create_node_runtime = (args = process.argv.slice(2)) => ({
68
68
  read_text_file: (path) => readFile(path, 'utf-8'),
69
69
  read_file: (path) => readFile(path).then((buf) => new Uint8Array(buf)),
70
70
  read_secure_file: load_secure_file_node,
71
+ burn_secure_file: burn_secure_file_node,
71
72
  // `Readable.toWeb` / `fromWeb` bridge Node streams to the web stream shape
72
73
  // the interface speaks. The casts cross Node's `stream/web` ReadableStream
73
74
  // and the global DOM `ReadableStream` (structurally identical here).
@@ -1,20 +1,23 @@
1
1
  /**
2
- * Hardened secret-file read — the TS twin of the Rust spine's
3
- * `fuz_sys::secure_file::load_secure_file`.
2
+ * Hardened secret-file read and burn — the TS twins of the Rust spine's
3
+ * `fuz_sys::secure_file::load_secure_file` and `burn_secure_file`.
4
4
  *
5
5
  * The file this guards is typically the highest-value credential on the host
6
6
  * (the bootstrap token mints the keeper account), so the read fails loud
7
7
  * rather than degrading: a symlink, a non-regular file (FIFO, device node,
8
8
  * directory), a group/other-accessible mode, or an oversized file is refused,
9
- * never returned. The deploy recipe places the token at `0600`, so the check
9
+ * never returned — and, for a reader that asks (`SecureReadOptions`), a file
10
+ * with a link count other than 1. The deploy recipe places the token at `0600`, so the check
10
11
  * ratifies the shape zap produces; a hand-placed `0644` file fails at boot
11
12
  * instead of being read.
12
13
  *
13
- * The real implementation lives here (`load_secure_file_node`, wired as
14
- * `create_node_runtime().read_secure_file`), and the mock honors the mode/size
15
- * checks over its in-memory map (it has no file types). Both refuse through
16
- * the shared `assert_secure_mode` / `assert_secure_size` helpers, so the
17
- * checks — and their operator-facing messages — can't drift between them.
14
+ * The real implementations live here (`load_secure_file_node` and
15
+ * `burn_secure_file_node`, wired as `create_node_runtime().read_secure_file`
16
+ * and `.burn_secure_file`), and the mock honors the mode/size
17
+ * and link-count checks over its in-memory map (it has no file types). Both
18
+ * refuse through the shared `assert_secure_mode` / `assert_secure_size` /
19
+ * `assert_secure_link_count` helpers, so the checks — and their
20
+ * operator-facing messages — can't drift between them.
18
21
  *
19
22
  * @module
20
23
  */
@@ -40,6 +43,27 @@ export declare const assert_secure_mode: (path: string, mode: number) => void;
40
43
  * @throws Error naming the path, the size, and the cap
41
44
  */
42
45
  export declare const assert_secure_size: (path: string, size: number) => void;
46
+ /**
47
+ * The strictness a secure read adds to its default checks. Default: none.
48
+ * Twin of the Rust `fuz_sys::secure_file::SecureReadOptions`.
49
+ */
50
+ export interface SecureReadOptions {
51
+ /**
52
+ * Refuse a file whose link count is not 1, read from the same descriptor
53
+ * `fstat` as the other checks. For a one-shot secret its reader burns by
54
+ * unlinking it (the bootstrap token): with a second hard link the unlink
55
+ * leaves the inode, and the secret, readable under the other name. Off by
56
+ * default because a long-lived secret has no such burn, and a snapshot
57
+ * tool that hard-links a key file must not stop the reader.
58
+ */
59
+ readonly require_single_link?: boolean;
60
+ }
61
+ /**
62
+ * Refuse a link count other than 1 — the `require_single_link` check.
63
+ *
64
+ * @throws Error naming the path and the link count
65
+ */
66
+ export declare const assert_secure_link_count: (path: string, links: number) => void;
43
67
  /**
44
68
  * Read a secret file with fail-loud checks (Node implementation).
45
69
  *
@@ -52,12 +76,49 @@ export declare const assert_secure_size: (path: string, size: number) => void;
52
76
  * - the permission check runs on the open descriptor, not the path, so the
53
77
  * file can't be swapped between check and read — any group/other access
54
78
  * (not `0600`/`0400`) is refused
79
+ * - with `require_single_link`, a link count other than 1 is refused, read
80
+ * from the same descriptor `stat`
55
81
  * - a size cap bounds the read; the read itself is limited to cap + 1 so a
56
82
  * file growing between stat and read is still caught
57
83
  *
58
84
  * @param path - path to the secret file
85
+ * @param options - added strictness, none by default
59
86
  * @returns the file's bytes
60
- * @throws Error on a missing file, symlink, non-regular file, permissive mode, oversized file, or I/O failure
87
+ * @throws Error on a missing file, symlink, non-regular file, permissive mode, a link count other than 1 when `require_single_link` asks, oversized file, or I/O failure
88
+ */
89
+ export declare const load_secure_file_node: (path: string, options?: SecureReadOptions) => Promise<Uint8Array>;
90
+ /**
91
+ * What a burn found at the path. Both mean the postcondition holds — no
92
+ * entry at the path, durably — so a caller that only needs the secret gone
93
+ * treats them alike and logs the second. Twin of the Rust
94
+ * `fuz_sys::secure_file::BurnOutcome`.
95
+ *
96
+ * - `'burned'` — the entry was there and is now unlinked
97
+ * - `'already_gone'` — nothing was at the path (`ENOENT`)
98
+ */
99
+ export type BurnOutcome = 'burned' | 'already_gone';
100
+ /**
101
+ * Remove a one-shot secret's directory entry, durably (Node implementation)
102
+ * — the burn a consumed credential file (the bootstrap token) gets before the
103
+ * transaction it authorized commits, so the secret can never be presented
104
+ * again.
105
+ *
106
+ * - `unlink` of the entry at `path`: a symlink there is removed itself, never
107
+ * followed (following would delete a file the operator never named), and a
108
+ * directory is refused, never recursed into — unlike `rm`, which takes
109
+ * `recursive`
110
+ * - a missing entry (`ENOENT`) is `'already_gone'`, not an error: the
111
+ * postcondition the caller needs — no entry at `path` — holds
112
+ * - then the parent directory is fsynced, on both outcomes, so the removal
113
+ * survives a host crash; without it a crash after the caller's commit can
114
+ * bring the entry back. A failed fsync is a failed burn. Skipped on Windows,
115
+ * which can't open a directory
116
+ *
117
+ * Twin of the Rust `fuz_sys::secure_file::burn_secure_file`.
118
+ *
119
+ * @param path - path to the secret file
120
+ * @returns whether the entry was unlinked or already gone
121
+ * @throws Error naming the path when the unlink fails for any reason but `ENOENT` (`EACCES` from a directory the process can't write, `EISDIR`/`EPERM` for a directory at the path), or naming the parent when its fsync fails
61
122
  */
62
- export declare const load_secure_file_node: (path: string) => Promise<Uint8Array>;
123
+ export declare const burn_secure_file_node: (path: string) => Promise<BurnOutcome>;
63
124
  //# sourceMappingURL=secure_file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"secure_file.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/secure_file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAUzC;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,IAM/D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,IAI/D,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,UAAU,CAkC5E,CAAC"}
1
+ {"version":3,"file":"secure_file.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/secure_file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAUzC;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,IAM/D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,IAI/D,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,IAItE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,qBAAqB,GACjC,MAAM,MAAM,EACZ,UAAU,iBAAiB,KACzB,OAAO,CAAC,UAAU,CAmCpB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,cAAc,CAAC;AAWpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,WAAW,CA0B7E,CAAC"}
@@ -1,25 +1,29 @@
1
1
  /**
2
- * Hardened secret-file read — the TS twin of the Rust spine's
3
- * `fuz_sys::secure_file::load_secure_file`.
2
+ * Hardened secret-file read and burn — the TS twins of the Rust spine's
3
+ * `fuz_sys::secure_file::load_secure_file` and `burn_secure_file`.
4
4
  *
5
5
  * The file this guards is typically the highest-value credential on the host
6
6
  * (the bootstrap token mints the keeper account), so the read fails loud
7
7
  * rather than degrading: a symlink, a non-regular file (FIFO, device node,
8
8
  * directory), a group/other-accessible mode, or an oversized file is refused,
9
- * never returned. The deploy recipe places the token at `0600`, so the check
9
+ * never returned — and, for a reader that asks (`SecureReadOptions`), a file
10
+ * with a link count other than 1. The deploy recipe places the token at `0600`, so the check
10
11
  * ratifies the shape zap produces; a hand-placed `0644` file fails at boot
11
12
  * instead of being read.
12
13
  *
13
- * The real implementation lives here (`load_secure_file_node`, wired as
14
- * `create_node_runtime().read_secure_file`), and the mock honors the mode/size
15
- * checks over its in-memory map (it has no file types). Both refuse through
16
- * the shared `assert_secure_mode` / `assert_secure_size` helpers, so the
17
- * checks — and their operator-facing messages — can't drift between them.
14
+ * The real implementations live here (`load_secure_file_node` and
15
+ * `burn_secure_file_node`, wired as `create_node_runtime().read_secure_file`
16
+ * and `.burn_secure_file`), and the mock honors the mode/size
17
+ * and link-count checks over its in-memory map (it has no file types). Both
18
+ * refuse through the shared `assert_secure_mode` / `assert_secure_size` /
19
+ * `assert_secure_link_count` helpers, so the checks — and their
20
+ * operator-facing messages — can't drift between them.
18
21
  *
19
22
  * @module
20
23
  */
21
24
  import { constants } from 'node:fs';
22
- import { open } from 'node:fs/promises';
25
+ import { open, unlink } from 'node:fs/promises';
26
+ import { dirname } from 'node:path';
23
27
  import process from 'node:process';
24
28
  /**
25
29
  * Maximum size for secure files. Prevents DoS from unexpectedly large files;
@@ -58,6 +62,16 @@ export const assert_secure_size = (path, size) => {
58
62
  throw new Error(`secure file too large: ${path} (${size} bytes, max ${MAX_SECURE_FILE_SIZE})`);
59
63
  }
60
64
  };
65
+ /**
66
+ * Refuse a link count other than 1 — the `require_single_link` check.
67
+ *
68
+ * @throws Error naming the path and the link count
69
+ */
70
+ export const assert_secure_link_count = (path, links) => {
71
+ if (links !== 1) {
72
+ throw new Error(`secure file has ${links} hard links: ${path} (expected 1)`);
73
+ }
74
+ };
61
75
  /**
62
76
  * Read a secret file with fail-loud checks (Node implementation).
63
77
  *
@@ -70,14 +84,17 @@ export const assert_secure_size = (path, size) => {
70
84
  * - the permission check runs on the open descriptor, not the path, so the
71
85
  * file can't be swapped between check and read — any group/other access
72
86
  * (not `0600`/`0400`) is refused
87
+ * - with `require_single_link`, a link count other than 1 is refused, read
88
+ * from the same descriptor `stat`
73
89
  * - a size cap bounds the read; the read itself is limited to cap + 1 so a
74
90
  * file growing between stat and read is still caught
75
91
  *
76
92
  * @param path - path to the secret file
93
+ * @param options - added strictness, none by default
77
94
  * @returns the file's bytes
78
- * @throws Error on a missing file, symlink, non-regular file, permissive mode, oversized file, or I/O failure
95
+ * @throws Error on a missing file, symlink, non-regular file, permissive mode, a link count other than 1 when `require_single_link` asks, oversized file, or I/O failure
79
96
  */
80
- export const load_secure_file_node = async (path) => {
97
+ export const load_secure_file_node = async (path, options) => {
81
98
  let handle;
82
99
  try {
83
100
  handle = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK | constants.O_NOCTTY);
@@ -95,6 +112,8 @@ export const load_secure_file_node = async (path) => {
95
112
  throw new Error(`not a regular file: ${path}`);
96
113
  if (modes_apply)
97
114
  assert_secure_mode(path, s.mode);
115
+ if (options?.require_single_link)
116
+ assert_secure_link_count(path, s.nlink);
98
117
  assert_secure_size(path, s.size);
99
118
  // read up to cap + 1 bytes so a file growing between stat and read is
100
119
  // still caught (the stat-time size check alone races); `position: null`
@@ -114,3 +133,64 @@ export const load_secure_file_node = async (path) => {
114
133
  await handle.close();
115
134
  }
116
135
  };
136
+ /**
137
+ * Whether a directory can be opened to fsync it. Windows can't open a
138
+ * directory, so the parent fsync is skipped there and a burn's durability
139
+ * across a host crash rests on the filesystem; refusing the burn instead
140
+ * would make bootstrap impossible on that platform. The Rust twin is
141
+ * Unix-only and never faces this.
142
+ */
143
+ const directory_fsync_applies = process.platform !== 'win32';
144
+ /**
145
+ * Remove a one-shot secret's directory entry, durably (Node implementation)
146
+ * — the burn a consumed credential file (the bootstrap token) gets before the
147
+ * transaction it authorized commits, so the secret can never be presented
148
+ * again.
149
+ *
150
+ * - `unlink` of the entry at `path`: a symlink there is removed itself, never
151
+ * followed (following would delete a file the operator never named), and a
152
+ * directory is refused, never recursed into — unlike `rm`, which takes
153
+ * `recursive`
154
+ * - a missing entry (`ENOENT`) is `'already_gone'`, not an error: the
155
+ * postcondition the caller needs — no entry at `path` — holds
156
+ * - then the parent directory is fsynced, on both outcomes, so the removal
157
+ * survives a host crash; without it a crash after the caller's commit can
158
+ * bring the entry back. A failed fsync is a failed burn. Skipped on Windows,
159
+ * which can't open a directory
160
+ *
161
+ * Twin of the Rust `fuz_sys::secure_file::burn_secure_file`.
162
+ *
163
+ * @param path - path to the secret file
164
+ * @returns whether the entry was unlinked or already gone
165
+ * @throws Error naming the path when the unlink fails for any reason but `ENOENT` (`EACCES` from a directory the process can't write, `EISDIR`/`EPERM` for a directory at the path), or naming the parent when its fsync fails
166
+ */
167
+ export const burn_secure_file_node = async (path) => {
168
+ let outcome = 'burned';
169
+ try {
170
+ await unlink(path);
171
+ }
172
+ catch (err) {
173
+ if (err.code !== 'ENOENT') {
174
+ throw new Error(`could not delete ${path}: ${err.message}`, { cause: err });
175
+ }
176
+ outcome = 'already_gone';
177
+ }
178
+ if (directory_fsync_applies) {
179
+ const parent = dirname(path);
180
+ try {
181
+ // a read handle is enough: fsync flushes the directory's entries
182
+ // whatever the descriptor's mode
183
+ const handle = await open(parent, 'r');
184
+ try {
185
+ await handle.sync();
186
+ }
187
+ finally {
188
+ await handle.close();
189
+ }
190
+ }
191
+ catch (err) {
192
+ throw new Error(`could not fsync ${parent}: ${err.message}`, { cause: err });
193
+ }
194
+ }
195
+ return outcome;
196
+ };
@@ -86,14 +86,6 @@ export declare const default_audit_factory: AuditFactory;
86
86
  * (e.g., tx uses `runtime.exit(1)` on invalid keys).
87
87
  */
88
88
  export interface CreateAppBackendOptions {
89
- /**
90
- * Hardened secret-file read for the bootstrap token — pass the runtime's
91
- * `read_secure_file` (see `FsSecureReadDeps`). Rejects symlinks,
92
- * non-regular files, group/other-accessible modes, and oversized files.
93
- */
94
- read_secure_file: (path: string) => Promise<Uint8Array>;
95
- /** Delete a file. */
96
- delete_file: (path: string) => Promise<void>;
97
89
  /** Database connection URL (`postgres://`, `file://`, or `memory://`). */
98
90
  database_url: string;
99
91
  /** Validated cookie signing keyring. */
@@ -1 +1 @@
1
- {"version":3,"file":"app_backend.d.ts","sourceRoot":"","sources":["../../src/lib/server/app_backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,KAAK,EAAE,MAAM,EAA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AAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,KAAK,YAAY,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,EAAE,YACF,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACvC,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;;;;;;;;OAkBG;IACH,aAAa,EAAE,YAAY,CAAC;IAC5B;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,cAAc,CAAC;IACnC;;;;;;;;;;;;;OAaG;IACH,oBAAoB,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACzD;;;;;;;;;OASG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;;;;;;OAOG;IACH,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACtC;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAAU,SAAS,uBAAuB,KAAG,OAAO,CAAC,UAAU,CAwD7F,CAAC"}
@@ -13,6 +13,7 @@
13
13
  import { Logger } from '@fuzdev/fuz_util/log.ts';
14
14
  import { create_audit_emitter } from '../auth/audit_emitter.js';
15
15
  import { create_realtime_closer } from '../actions/connection_closer.js';
16
+ import { create_realtime_notification_sender } from '../actions/notification_sender.js';
16
17
  import { run_migrations } from '../db/migrate.js';
17
18
  import { AUTH_MIGRATION_NS } from '../auth/migrations.js';
18
19
  import { create_db, is_pg_database_url } from '../db/create_db.js';
@@ -43,7 +44,7 @@ export const default_audit_factory = ({ db, log }) => create_audit_emitter({ db,
43
44
  * @throws MigrationError `namespace-reserved` if a `migration_namespaces` entry bears a `reserved_migration_namespaces` name and is not the spine's own namespace
44
45
  */
45
46
  export const create_app_backend = async (options) => {
46
- const { database_url, keyring, password, read_secure_file, delete_file, audit_factory } = options;
47
+ const { database_url, keyring, password, audit_factory } = options;
47
48
  const log = options.log ?? new Logger('server');
48
49
  const { db, close, db_type, db_name } = await create_db(database_url, {
49
50
  checkout_timeout_ms: options.db_checkout_timeout_ms
@@ -78,11 +79,10 @@ export const create_app_backend = async (options) => {
78
79
  keyring,
79
80
  password,
80
81
  db,
81
- read_secure_file,
82
- delete_file,
83
82
  log,
84
83
  audit,
85
- connection_closer: options.connection_closer ?? create_realtime_closer()
84
+ connection_closer: options.connection_closer ?? create_realtime_closer(),
85
+ notification_sender: create_realtime_notification_sender()
86
86
  }
87
87
  };
88
88
  }