@fuzdev/fuz_app 0.179.0 → 0.181.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.
- package/dist/actions/CLAUDE.md +14 -14
- package/dist/actions/action_rpc.d.ts +14 -5
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +53 -46
- package/dist/actions/action_types.d.ts +15 -12
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/perform_action.d.ts +4 -4
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +6 -6
- package/dist/actions/register_action_ws.d.ts +6 -2
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +14 -3
- package/dist/actions/ws_socket_session.js +1 -1
- package/dist/auth/CLAUDE.md +36 -30
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +18 -1
- package/dist/auth/account_queries.d.ts +69 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +82 -0
- package/dist/auth/account_route_schema.d.ts +26 -16
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +10 -24
- package/dist/auth/account_routes.d.ts +4 -6
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +86 -66
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +63 -14
- package/dist/auth/api_token_queries.d.ts +16 -7
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +18 -18
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +10 -12
- package/dist/auth/audit_log_schema.js +4 -4
- package/dist/auth/bearer_auth.d.ts +4 -3
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +35 -31
- package/dist/auth/bootstrap_account.d.ts +65 -37
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +115 -66
- package/dist/auth/bootstrap_route_schema.d.ts +6 -2
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +7 -2
- package/dist/auth/bootstrap_routes.d.ts +50 -33
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +109 -87
- package/dist/auth/bootstrap_token_store.d.ts +60 -0
- package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
- package/dist/auth/bootstrap_token_store.js +39 -0
- package/dist/auth/credential_headers.d.ts +71 -0
- package/dist/auth/credential_headers.d.ts.map +1 -0
- package/dist/auth/credential_headers.js +100 -0
- package/dist/auth/daemon_token.d.ts +13 -1
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token.js +14 -2
- package/dist/auth/daemon_token_middleware.d.ts +10 -11
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +27 -29
- package/dist/auth/deps.d.ts +0 -11
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/invite_queries.d.ts +18 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +24 -0
- package/dist/auth/request_context.d.ts +26 -5
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +17 -10
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +3 -2
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +37 -14
- package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
- package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_ddl.js +9 -2
- package/dist/auth/role_grant_offer_queries.d.ts +56 -3
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +93 -8
- package/dist/auth/role_grant_queries.d.ts +7 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +8 -0
- package/dist/auth/session_cookie.d.ts +105 -25
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +124 -15
- package/dist/auth/session_middleware.d.ts +83 -54
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +92 -66
- package/dist/auth/session_queries.d.ts +64 -4
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +53 -4
- package/dist/auth/signup_route_schema.d.ts +5 -5
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +4 -4
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +17 -14
- package/dist/auth/token_scope.d.ts +5 -7
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +5 -8
- package/dist/dev/setup.d.ts +6 -1
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -34
- package/dist/hono_context.d.ts +21 -0
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +17 -0
- package/dist/http/CLAUDE.md +150 -43
- package/dist/http/auth_shape.d.ts +3 -3
- package/dist/http/common_routes.js +1 -1
- package/dist/http/db_routes.d.ts +4 -3
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +14 -14
- package/dist/http/dev_route_error_check.d.ts +6 -3
- package/dist/http/dev_route_error_check.d.ts.map +1 -1
- package/dist/http/dev_route_error_check.js +6 -3
- package/dist/http/dev_set_cookie_check.d.ts +53 -0
- package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
- package/dist/http/dev_set_cookie_check.js +80 -0
- package/dist/http/error_schemas.d.ts +36 -1
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +39 -2
- package/dist/http/header_lines.d.ts +42 -0
- package/dist/http/header_lines.d.ts.map +1 -0
- package/dist/http/header_lines.js +80 -0
- package/dist/http/host.d.ts +12 -9
- package/dist/http/host.d.ts.map +1 -1
- package/dist/http/host.js +25 -20
- package/dist/http/origin.d.ts +7 -22
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +11 -25
- package/dist/http/proxy.d.ts +1 -0
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -0
- package/dist/http/request_headers.d.ts +95 -0
- package/dist/http/request_headers.d.ts.map +1 -0
- package/dist/http/request_headers.js +110 -0
- package/dist/http/request_target.d.ts +134 -0
- package/dist/http/request_target.d.ts.map +1 -0
- package/dist/http/request_target.js +193 -0
- package/dist/http/route_error_check.d.ts +4 -11
- package/dist/http/route_error_check.d.ts.map +1 -1
- package/dist/http/route_error_check.js +4 -21
- package/dist/http/route_result.d.ts +127 -23
- package/dist/http/route_result.d.ts.map +1 -1
- package/dist/http/route_result.js +97 -19
- package/dist/http/route_spec.d.ts +298 -82
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +548 -71
- package/dist/http/simple_request.d.ts +19 -14
- package/dist/http/simple_request.d.ts.map +1 -1
- package/dist/http/simple_request.js +17 -29
- package/dist/http/surface.d.ts +2 -0
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +4 -1
- package/dist/realtime/outbound_budget.d.ts +1 -2
- package/dist/realtime/outbound_budget.d.ts.map +1 -1
- package/dist/realtime/outbound_budget.js +1 -2
- package/dist/realtime/sse.d.ts +47 -17
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +115 -93
- package/dist/realtime/sse_constants.d.ts +7 -1
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +12 -1
- package/dist/realtime/sse_registry.d.ts +3 -3
- package/dist/realtime/sse_registry.js +3 -3
- package/dist/runtime/deps.d.ts +20 -4
- package/dist/runtime/deps.d.ts.map +1 -1
- package/dist/runtime/mock.d.ts +7 -1
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +33 -3
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +2 -1
- package/dist/runtime/secure_file.d.ts +71 -10
- package/dist/runtime/secure_file.d.ts.map +1 -1
- package/dist/runtime/secure_file.js +91 -11
- package/dist/server/app_backend.d.ts +0 -8
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +1 -3
- package/dist/server/app_server.d.ts +28 -17
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +52 -34
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +49 -45
- package/dist/server/static.d.ts +20 -0
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +56 -8
- package/dist/server/unmatched_route.d.ts +42 -0
- package/dist/server/unmatched_route.d.ts.map +1 -0
- package/dist/server/unmatched_route.js +64 -0
- package/dist/testing/CLAUDE.md +404 -1200
- package/dist/testing/app_server.d.ts +3 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +4 -10
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +2 -1
- package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +277 -6
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
- package/dist/testing/cross_backend/capabilities.d.ts +68 -5
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +20 -4
- package/dist/testing/cross_backend/cell_gated_create.js +1 -1
- package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +179 -23
- package/dist/testing/cross_backend/cookie_attributes.js +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
- package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
- package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance.js +296 -0
- package/dist/testing/cross_backend/credential_conformance.json +1284 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
- package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
- package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
- package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
- package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
- package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_wire.js +188 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +22 -2
- package/dist/testing/cross_backend/default_spine_surface.js +1 -1
- package/dist/testing/cross_backend/differential.d.ts +1 -1
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +3 -2
- package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
- package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential_normalize.js +11 -5
- package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +7 -0
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +4 -0
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +78 -4
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +13 -10
- package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
- package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
- package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance.js +196 -0
- package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance.js +186 -0
- package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +2 -1
- package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
- package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
- package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +56 -29
- package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
- package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
- package/dist/testing/cross_backend/session_login.d.ts +24 -0
- package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_login.js +31 -0
- package/dist/testing/cross_backend/setup.d.ts +117 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +193 -9
- package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
- package/dist/testing/cross_backend/simple_request.js +5 -0
- package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +88 -5
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +205 -64
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +5 -2
- package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
- package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_credential_read.js +175 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +58 -2
- package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +13 -10
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_endpoint.js +19 -2
- package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_role_gated.js +2 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +28 -12
- package/dist/testing/cross_backend/xfail.d.ts +44 -11
- package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
- package/dist/testing/cross_backend/xfail.js +68 -23
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +4 -3
- package/dist/testing/integration.d.ts +1 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +14 -8
- package/dist/testing/integration_helpers.d.ts +50 -3
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +87 -9
- package/dist/testing/middleware.d.ts +2 -0
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +9 -2
- package/dist/testing/round_trip.d.ts +6 -2
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +17 -6
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +7 -0
- package/dist/testing/rpc_helpers.d.ts +4 -2
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +6 -1
- package/dist/testing/rpc_round_trip.d.ts +13 -2
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +25 -6
- package/dist/testing/schema_generators.d.ts +2 -2
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +4 -4
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +8 -8
- package/dist/testing/transports/fetch_transport.d.ts +6 -3
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
- package/dist/testing/transports/fetch_transport.js +31 -19
- package/dist/testing/transports/raw_http.d.ts +61 -1
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +61 -1
- package/dist/testing/transports/ws_raw_client.d.ts +20 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +10 -4
- package/dist/testing/transports/ws_transport.d.ts +21 -1
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +58 -20
- package/package.json +5 -5
package/dist/auth/CLAUDE.md
CHANGED
|
@@ -16,7 +16,7 @@ documents the cross-cutting invariants that don't fit on any single symbol.
|
|
|
16
16
|
|
|
17
17
|
## AppDeps split
|
|
18
18
|
|
|
19
|
-
- **Capabilities** — `AppDeps` — stateless, injectable per env: `
|
|
19
|
+
- **Capabilities** — `AppDeps` — stateless, injectable per env: `keyring`, `password`, `db`, `log`, `audit`, `connection_closer` (the `RealtimeCloser` every revocation handler closes live connections through — `actions/CLAUDE.md` §Connection closer).
|
|
20
20
|
- **Route caps** — `RouteFactoryDeps` — `Omit<AppDeps, 'db'>`; handlers get `db` via `RouteContext`.
|
|
21
21
|
- **Action caps** — `ActionFactoryDeps` (`auth/deps.ts`) — the `{log, audit}` shape action factories take; `RouteFactoryDeps`/`AppDeps` satisfy it structurally (role-grant-offer adds `notification_sender?`). The factories whose handlers end credentials or revoke roles (`create_account_actions`, `create_admin_actions`, `create_role_grant_offer_actions`, `create_self_service_role_actions`, and the standard bundle) take `RevokingActionFactoryDeps` — `ActionFactoryDeps` plus a required `connection_closer`. The two pure-read actor factories (`actor_lookup`/`actor_search`) take only `{log: Logger}`.
|
|
22
22
|
- **Parameters** — `*Options` — static startup values, per-factory.
|
|
@@ -32,12 +32,14 @@ over the pool so rows persist when request transactions roll back. See root
|
|
|
32
32
|
### Crypto primitives (pure, I/O-free)
|
|
33
33
|
|
|
34
34
|
- `auth/keyring.ts` — `Keyring`, `create_keyring` (validates — the one way to build a `Keyring`), `validate_keyring`.
|
|
35
|
-
- `auth/session_cookie.ts` — `SessionOptions<T>`, `parse_session`, `process_session_cookie` (`'none' | 'clear'` — no refresh action; the 30-day lifetime is an absolute cap signed once at mint), `create_session_config`, `fuz_session_config`, `SESSION_AGE_MAX`.
|
|
35
|
+
- `auth/session_cookie.ts` — `SessionOptions<T>`, `parse_session`, `process_session_cookie` (`'none' | 'clear'` — no refresh action; the 30-day lifetime is an absolute cap signed once at mint; a value that is present and does not verify, the empty string included, is `'clear'`, and only an absent cookie is `'none'`), `create_session_cookie_value`, `create_session_config`, `fuz_session_config`, `SESSION_AGE_MAX`. The cookie's attributes are fixed — `SESSION_COOKIE_ATTRIBUTES` (`Path=/; HttpOnly; Secure; SameSite=Strict`), no option weakens them — and `format_session_set_cookie` / `format_session_clear_cookie` (and `session_cookie_header` / `clear_session_cookie_header`, the same lines from a `SessionOptions`, for a route's success result — the Rust `route_helpers`' names; the TS form takes the signed value, the Rust one signs the token itself) write the exact `Set-Cookie` strings the Rust spine writes, the value raw (never percent-encoded), refusing a name or value outside RFC 6265 (`is_cookie_name`, `is_cookie_value`) by throwing, so a consumer's `encode_identity` must emit cookie-octets.
|
|
36
|
+
- `auth/credential_headers.ts` — the grammar of the three credential headers as pure readers over header lines (`get_header_lines` of `http/header_lines.ts`): `read_session_cookie_value` (several `Cookie` lines read as their `; ` join; split on `;`, SP and HTAB stripped from each pair, the first pair beginning `<name>=` wins, its value verbatim — an invalid first pair is not skipped for a later one), `read_bearer_token` and `read_daemon_token` (exactly one line, exact shape; a header sent twice is discarded). Hono-free. Twin of the Rust `fuz_auth::credential_headers`; `testing/cross_backend/credential_conformance.json` holds both to the same rows.
|
|
36
37
|
- `auth/password.ts` — `Password`, `PasswordProvided` (`@fuzdev/fuz_schema` schemas), `PasswordHashDeps`, `PASSWORD_LENGTH_MIN` (12, OWASP), `PASSWORD_LENGTH_MAX` (300).
|
|
37
38
|
- `auth/password_argon2.ts` — `hash_password`, `verify_password`, `verify_dummy`, `argon2_password_deps`.
|
|
38
39
|
- `auth/api_token.ts` — `API_TOKEN_PREFIX` (`secret_fuz_token_`), `ApiTokenId` (the public id, `pipe(string, regex(API_TOKEN_ID_REGEX))`, a `@fuzdev/fuz_schema` schema), `hash_api_token`, `generate_api_token`, and the shape precheck `is_api_token_shaped` (`API_TOKEN_REGEX`: the prefix plus exactly `API_TOKEN_BODY_LENGTH` = 43 base64url chars).
|
|
39
|
-
- `auth/daemon_token.ts` — `DaemonToken`, `DAEMON_TOKEN_HEADER` (`X-Daemon-Token`), `generate_daemon_token`, `validate_daemon_token`, `DaemonTokenState`.
|
|
40
|
-
- `auth/bootstrap_account.ts` — `bootstrap_account` (one-shot, `bootstrap_lock`-protected) + `read_bootstrap_token`, the read both it and `check_bootstrap_status` use: the secure read less one trailing LF, a token under `BOOTSTRAP_TOKEN_MIN_BYTES` (32) refused as unreadable with an error log.
|
|
40
|
+
- `auth/daemon_token.ts` — `DaemonToken`, `DAEMON_TOKEN_REGEX` + the shape precheck `is_daemon_token_shaped` (43 base64url chars), `DAEMON_TOKEN_HEADER` (`X-Daemon-Token`), `generate_daemon_token`, `validate_daemon_token`, `DaemonTokenState`.
|
|
41
|
+
- `auth/bootstrap_account.ts` — `bootstrap_account` (one-shot, `bootstrap_lock`-protected) + `read_bootstrap_token`, the read both it and `check_bootstrap_status` use: the secure read less one trailing LF, a token under `BOOTSTRAP_TOKEN_MIN_BYTES` (32) refused as unreadable with an error log. One transaction holds the whole bootstrap: the lock, the account and grants, the session (`create_capped_session`), and last the burn of the token (`token_store.burn_token`) — a failed burn throws out of the transaction (`BootstrapTokenBurnError`) and answers `token_file_undeletable` with nothing created; the success carries `session_cookie_value`, the signed cookie the route sets. `BootstrapAccountCreated` is what `on_bootstrap` receives.
|
|
42
|
+
- `auth/bootstrap_token_store.ts` — `BootstrapTokenStore` (`path`, `read_token`, `burn_token`), the one seam to the token file, and `create_file_bootstrap_token_store(deps, path)` over the runtime's secure read and burn. Its read asks the secure read for a single hard link (`require_single_link`): a token file with a second link would outlive its burn under the other name, so it is refused as unreadable, at boot and on a request alike. Twin of the Rust `BootstrapTokenStore` trait, which carries no path (its availability check is handed one).
|
|
41
43
|
|
|
42
44
|
Cross-cutting notes that don't live on any single symbol:
|
|
43
45
|
|
|
@@ -78,13 +80,13 @@ Convention — `*_schema.ts` holds a domain's `@fuzdev/fuz_schema` schemas; `*_d
|
|
|
78
80
|
|
|
79
81
|
All take `deps: QueryDeps = {db}` first; `query_validate_api_token` adds `log` and returns a `ValidatedApiToken` — the row with `scope` parsed, refusing (returning `undefined` for) a row whose stored scope is unreadable.
|
|
80
82
|
|
|
81
|
-
- `auth/account_queries.ts` — account CRUD, actor resolution, password update with verify-write race guard, paged `query_admin_account_list`.
|
|
83
|
+
- `auth/account_queries.ts` — account CRUD, actor resolution, password update with verify-write race guard, paged `query_admin_account_list`. Also the two locked re-checks a credential mint runs first in its transaction: `query_account_lock_verified(id, password_hash)` (login: the account is live and still holds the hash that was verified) and `query_account_lock_live(id)` (token create), each `FOR SHARE` on the account row — the lock a password change's or a delete's write to that row waits on, and waits for, so a mint in flight across either is refused or revoked, never left standing. `query_account_lock_live` is also what `invite_create` takes on its issuer before its insert, and `query_account_lock_live_many(ids)` locks several accounts in one statement in id order — what `query_role_grant_offer_create` takes on its recipient and its grantor. Every multi-account locker takes account rows in id order (the last-admin guard too), so none waits on another in the opposite order.
|
|
82
84
|
- `auth/actor_lookup_queries.ts` — batched `actor` ⨝ `account` for the labels arc; active actors of active accounts only.
|
|
83
85
|
- `auth/actor_search_queries.ts` — case-insensitive prefix search on `actor.name`, scope-filtered when not admin; active actors of active accounts only.
|
|
84
86
|
- `auth/role_grant_queries.ts` — idempotent create, IDOR-guarded revoke (with in-tx supersede), scope-aware lookup, role/account predicates, `query_role_grant_revoke_for_scope` parent-scope cascade.
|
|
85
87
|
- `auth/role_grant_offer_queries.ts` — offer create/decline/retract/list/history/sweep, atomic `query_accept_offer` with sibling supersede; error classes `RoleGrantOfferSelfTargetError` / `_AlreadyTerminalError` / `_ExpiredError` / `_NotFoundError` / `_ActorAccountMismatchError` / `_ActorMismatchError`.
|
|
86
|
-
- `auth/session_queries.ts` — server-side sessions (blake3-hashed), `query_session_revoke_by_hash_unscoped` (logout only), `query_session_enforce_limit` (transaction-required; returns the evicted sessions' ids — their token hashes — so the caller closes their connections after the commit), `query_session_cleanup_expired` (returns the swept sessions' ids for the same close — `cleanup_expired_sessions` is its caller). No touch/renewal query — `expires_at` is an absolute cap set at mint (`AUTH_SESSION_LIFETIME_MS`).
|
|
87
|
-
- `auth/api_token_queries.ts` — token validation
|
|
88
|
+
- `auth/session_queries.ts` — server-side sessions (blake3-hashed), `create_capped_session` (the one session minter: the row, the cap's evictions, and the signed cookie value — Hono-free, so the bootstrap transaction mints through it; twin of the Rust `create_capped_session`), `query_session_revoke_by_hash_unscoped` (logout only), `query_session_enforce_limit` (transaction-required; returns the evicted sessions' ids — their token hashes — so the caller closes their connections after the commit), `query_session_cleanup_expired` (returns the swept sessions' ids for the same close — `cleanup_expired_sessions` is its caller). No touch/renewal query — `expires_at` is an absolute cap set at mint (`AUTH_SESSION_LIFETIME_MS`). `query_session_is_live(id, account_id)` is the re-read `account_token_create` runs after the account lock: the session that authorized the mint must still exist.
|
|
89
|
+
- `auth/api_token_queries.ts` — token validation (`query_validate_api_token`, which records nothing) and the separate fire-and-forget usage record (`query_api_token_touch`, which the bearer leg runs only once the token's account is found live), `query_api_token_live_account` (the by-id, no-touch re-check read; shares the `API_TOKEN_IS_LIVE` predicate with the validate query so the two can't drift), IDOR-guarded revoke, `query_api_token_enforce_limit` (transaction-required; returns the evicted tokens' ids for the same post-commit close).
|
|
88
90
|
- `auth/invite_queries.ts` — invite create/find/claim/list/delete; `query_invite_claim_unscoped` (scoping enforced upstream by `_find_unclaimed_match_for_update`, which runs inside the signup tx with `FOR UPDATE` so find + claim are atomic).
|
|
89
91
|
- `auth/app_settings_queries.ts` — load/update for the single-row settings table.
|
|
90
92
|
- `auth/audit_log_queries.ts` — `query_audit_log` (in-tx insert), `_list` / `_list_with_usernames` / `_list_role_grant_history` / `_cleanup_before`, drift counters (`get_audit_metadata_validation_failures` / `get_audit_unknown_event_type_failures`).
|
|
@@ -195,8 +197,8 @@ counted, the request proceeds — so the count is how a lost row is seen.
|
|
|
195
197
|
|
|
196
198
|
### Routes
|
|
197
199
|
|
|
198
|
-
- `auth/account_routes.ts` — `POST /login` / `/logout` / `/password`, `GET /
|
|
199
|
-
- `auth/bootstrap_routes.ts` — `POST /bootstrap` + `check_bootstrap_status
|
|
200
|
+
- `auth/account_routes.ts` — `POST /login` / `/logout` / `/password`, `GET /api/account/status`. Constants: `DEFAULT_MAX_SESSIONS = 5`, `DEFAULT_MAX_TOKENS = 10`, `DEFAULT_LOGIN_FAIL_FLOOR_MS = 250`, `DEFAULT_LOGIN_FAIL_JITTER_MS = 25`.
|
|
201
|
+
- `auth/bootstrap_routes.ts` — `POST /bootstrap` + `check_bootstrap_status` (the boot report: the lock read first; a token file left on a bootstrapped database and an unreadable one on an open window each warn; a missing lock row reads unavailable); `BootstrapStatus` runtime ref (`{available}`); `OnBootstrap`, the post-commit callback over what was created. A failed burn answers 500 `token_file_undeletable` with the window left open; the lock race loser closes its window with no audit row and no charge.
|
|
200
202
|
- `auth/signup_routes.ts` — `POST /signup` (open or invite-gated).
|
|
201
203
|
- `auth/audit_log_routes.ts` — optional `GET /audit/stream` (SSE); list/history are on the RPC surface. Takes `stream: {registry, log}` (an `AuditLogSse` satisfies it). The handler admits the stream in two phases — register pending on the `SseRegistry`, re-read the credential (`revalidate_resolved_auth`) and the acting actor's role grants, admit — so a revocation racing the request opens no stream: 401 / 403 from the re-reads, or a 200 whose body is the connect comment alone when the pending registration was closed.
|
|
202
204
|
- `auth/auth_guard_resolver.ts` — `fuz_auth_guard_resolver` injected into `apply_route_specs` so the framework stays auth-agnostic. Maps each `RouteAuth` axis to a guard and is the single site every route spec traverses, so it also carries the two invariants the auth shape alone can't (a `required_scope` that isn't a well-formed capability, and one on an unrestricted route).
|
|
@@ -211,8 +213,8 @@ attach the live (hono-coupled) handler; a cross-process surface builder spreads
|
|
|
211
213
|
the same shape with a stub handler (surface generation never runs handlers).
|
|
212
214
|
Single source of truth — the shape can't drift between the live route and the
|
|
213
215
|
attack surface — and a backend-spawning consumer assembling its surface imports
|
|
214
|
-
the shapes without dragging `hono/
|
|
215
|
-
|
|
216
|
+
the shapes without dragging `hono/streaming` (and the optional `hono` peer)
|
|
217
|
+
onto a Rust-only cross-process suite. Shared route-limit constants
|
|
216
218
|
(`DEFAULT_MAX_SESSIONS` / `_TOKENS`) live in `account_route_schema.ts` for the
|
|
217
219
|
same reason (the RPC `account_actions` reads `DEFAULT_MAX_TOKENS`). The
|
|
218
220
|
account, signup and bootstrap shapes' schemas, error bodies included, are
|
|
@@ -246,18 +248,18 @@ for each session its cap evicted (`queue_connection_close` on
|
|
|
246
248
|
committed and is dropped if the handler throws.
|
|
247
249
|
|
|
248
250
|
REST-only post RPC migration: `/login`, `/logout`, `/password`, `/signup`,
|
|
249
|
-
`/bootstrap`,
|
|
251
|
+
`/bootstrap`, optional `/audit/stream`.
|
|
250
252
|
Everything else listed under §RPC action surfaces.
|
|
251
253
|
|
|
252
254
|
### Middleware
|
|
253
255
|
|
|
254
|
-
- `auth/middleware.ts` — `create_auth_middleware_specs(deps, options)` assembles `[origin, daemon_token?, session, request_context, bearer_auth]`, the `daemon_token` layer only when given a `daemon_token_state` — the credential legs in the Rust spine's `resolve_auth_from_headers` order, daemon token → session cookie → bearer, the first that authenticates setting `ResolvedAuth` and the later ones skipping. The chain starts from a clean slate: the first leg composed — the daemon token's, else the session's (`create_request_context_middleware`'s `starts_chain`, which the stack sets `false` behind the daemon leg) — clears `RESOLVED_AUTH_KEY` on entry, so a layer mounted before the stack can't pre-set an identity every leg would skip past, and debug-logs a clear that finds one — the trace of a hand-built chain whose session leg sits behind its own earlier leg without `starts_chain: false` (the content-type refusal isn't a middleware: `apply_route_specs` checks every `POST` route, see `http/simple_request.ts`). The origin check mounts on every path (`ORIGIN_MIDDLEWARE_PATH`, `'*'`), less its `origin_carve_outs` — each a `MiddlewareCarveOut` (`{path, reason}`, copied and frozen at assembly by `freeze_origin_carve_outs`, refused by `assert_origin_carve_outs_valid` without a reason or when it overlaps the auth scope — `middleware_paths_overlap` against `AUTH_MIDDLEWARE_PATH`, which holds every credential-reading and credential-minting route — and recorded on the origin spec so the surface leaves its `403` off the carved routes); `AUTH_MIDDLEWARE_PATH` (`'/api/*'`) is where `create_app_server` mounts the rest of the stack; assembly asserts lean on it: `assert_endpoint_in_auth_scope` (an `rpc_endpoints` / `ws_endpoints` path, or the bootstrap route under `bootstrap.route_prefix`, must sit inside it — so no carve-out can reach one), `assert_credential_routes_in_auth_scope(route_specs)` (every registered route that reads a credential — `auth.account` not `'none'`, or marked `reads_credential`, as account status is — or is marked `mints_credential` — login, signup, bootstrap — must sit inside it too, so a consumer prefixing the relative account or signup specs outside `/api/` is refused), and `assert_middleware_stack_mounted(stack_specs, middleware_specs)`, run on a `transform_middleware` result against the pre-transform stack (`[proxy, ...auth]`) — each stack spec, matched by its `handler` closure (not its spoofable `name`), mounted exactly once at its original path (`'*'` for the trusted proxy and the origin check, `AUTH_MIDDLEWARE_PATH` for the rest of auth), in its original order; other specs may sit anywhere, including before the proxy and between the auth layers. The proxy is in the stack because dropping it turns every `get_client_ip` into `'unknown'`, one shared bucket for every IP-keyed limiter. The transform receives shallow copies in a fresh array, so an in-place mutation can't rewrite the originals the check reads. The check pins where those layers sit, not what added layers do — a layer you add runs with full context access. Both run in `create_test_app_surface_spec` too.
|
|
255
|
-
- `auth/request_context.ts` — `RequestContext`, `resolve_acting_actor`, `build_request_context`, predicates (`has_scoped_role`, `has_any_scoped_role` — the dispatcher's role gate and every builtin-role check read the **global** grant via `has_scoped_role(_, role, null)` / `has_any_scoped_role(_, roles, null)`), guards (`require_auth`, `require_role`, `require_credential_types`, `require_token_scope`), `token_scope_surface_denial` (the direct-call form, for surfaces that aren't route specs), `get_public_account_id` (the account id a `reads_credential` route may read — `null` for a scope-narrowed token, which such a route answers as anonymous; twin of the Rust `AuthGate::public_request_context` downgrade), `refresh_role_grants`.
|
|
256
|
-
- `auth/session_middleware.ts` — `
|
|
256
|
+
- `auth/middleware.ts` — `create_auth_middleware_specs(deps, options)` assembles `[origin, daemon_token?, session, request_context, bearer_auth]`, the `daemon_token` layer only when given a `daemon_token_state` — the credential legs in the Rust spine's `resolve_auth_from_headers` order, daemon token → session cookie → bearer, the first that authenticates setting `ResolvedAuth` and the later ones skipping. The chain starts from a clean slate: the first leg composed — the daemon token's, else the session's (`create_request_context_middleware`'s `starts_chain`, which the stack sets `false` behind the daemon leg) — clears `RESOLVED_AUTH_KEY` on entry, so a layer mounted before the stack can't pre-set an identity every leg would skip past, and debug-logs a clear that finds one — the trace of a hand-built chain whose session leg sits behind its own earlier leg without `starts_chain: false` (the content-type refusal isn't a middleware: `apply_route_specs` checks every `POST` route, see `http/simple_request.ts`). The origin check mounts on every path (`ORIGIN_MIDDLEWARE_PATH`, `'*'`), less its `origin_carve_outs` — each a `MiddlewareCarveOut` (`{path, reason}`, copied and frozen at assembly by `freeze_origin_carve_outs`, refused by `assert_origin_carve_outs_valid` without a reason or when it overlaps the auth scope — `middleware_paths_overlap` against `AUTH_MIDDLEWARE_PATH`, which holds every credential-reading and credential-minting route — and recorded on the origin spec so the surface leaves its `403` off the carved routes); `AUTH_MIDDLEWARE_PATH` (`'/api/*'`) is where `create_app_server` mounts the rest of the stack; assembly asserts lean on it: `assert_endpoint_in_auth_scope` (an `rpc_endpoints` / `ws_endpoints` path, or the bootstrap route under `bootstrap.route_prefix`, must sit inside it — so no carve-out can reach one), `assert_credential_routes_in_auth_scope(route_specs)` (every registered route that reads a credential — `auth.account` not `'none'`, or marked `reads_credential`, as account status is — or is marked `mints_credential` — login, signup, bootstrap — must sit inside it too, so a consumer prefixing the relative account or signup specs outside `/api/` is refused), and `assert_middleware_stack_mounted(stack_specs, middleware_specs)`, run on a `transform_middleware` result against the pre-transform stack (`[host?, proxy, ...auth]`) — each stack spec, matched by its `handler` closure (not its spoofable `name`), mounted exactly once at its original path (`'*'` for the host gate, the trusted proxy and the origin check, `AUTH_MIDDLEWARE_PATH` for the rest of auth), in its original order; other specs may sit anywhere, including before the proxy and between the auth layers. The proxy is in the stack because dropping it turns every `get_client_ip` into `'unknown'`, one shared bucket for every IP-keyed limiter. The transform receives shallow copies in a fresh array, so an in-place mutation can't rewrite the originals the check reads. The check pins where those layers sit, not what added layers do — a layer you add runs with full context access. Both run in `create_test_app_surface_spec` too.
|
|
257
|
+
- `auth/request_context.ts` — `RequestContext`, `resolve_acting_actor`, `build_request_context`, predicates (`has_scoped_role`, `has_any_scoped_role` — the dispatcher's role gate and every builtin-role check read the **global** grant via `has_scoped_role(_, role, null)` / `has_any_scoped_role(_, roles, null)`), guards (`require_auth`, `require_role`, `require_credential_types`, `require_token_scope`), `token_scope_surface_denial` (the direct-call form, for surfaces that aren't route specs), `get_public_account_id(route)` (the account id a `reads_credential` route may read, off the route context's `credential` — `null` for a scope-narrowed token, which such a route answers as anonymous; twin of the Rust `AuthGate::public_request_context` downgrade), `RequestContextForAuth` (the request context a spec's `auth` promises its handler — the one narrowing a route handler's `route.auth` and an action handler's `ctx.auth` share), `refresh_role_grants`.
|
|
258
|
+
- `auth/session_middleware.ts` — `create_session_middleware` (reads the cookie through `read_session_cookie_value`, never a framework cookie parser; puts the clear for a cookie that is present and invalid on the context's prepared headers before the handler runs, so every response built through the context carries it once — every route result, which the spine emits there after the commit, ahead of the success's own cookie lines, and the middleware's and error handlers' answers. It never reads or rewrites a response: doing so changes framing and content type on the runtimes' own `Response` classes. What still carries no clear is what the route system doesn't build — a consumer's own middleware or raw Hono route answering with a `Response` it made or replacing the context's `Set-Cookie`, and an accepted WebSocket upgrade's placeholder — where the Rust stack's cookie-clear layer clears every non-`101`. The middleware records the clear line it wrote (`EXPECTED_FIRST_SET_COOKIE_KEY`), and in DEV an answer that doesn't lead with it is logged (`http/dev_set_cookie_check.ts`), the upgrade excepted), `get_session_cookie`. A route sets or clears the session cookie on its success result (`route_ok(value, {set_cookie})`) with `session_cookie_header` / `clear_session_cookie_header` of `auth/session_cookie.ts`; nothing in fuz_app writes a cookie on the context but the middleware's clear. Login, signup and bootstrap each mint through `create_capped_session` (`auth/session_queries.ts`) inside a transaction of their own.
|
|
257
259
|
- `auth/resolved_auth.ts` — `ResolvedAuth`, the resolved credential as one value — a union on `credential_type`, each arm carrying only its own fields: `session` (`account_id`, `session_hash`, `credential_deadline`), `api_token` (`account_id`, `api_token_id`, `scope`, `credential_deadline`), `daemon_token` (`account_id`, `credential_deadline: null`); `get_resolved_auth(c)` (reads it off `RESOLVED_AUTH_KEY`, the one context key every auth leg writes); the accessors `resolved_auth_scope` (an API token's scope, `full` for a session or daemon token, `null` for anonymous — every token-scope gate reads it), `resolved_auth_session_hash`, and `resolved_auth_api_token_id`; and `revalidate_resolved_auth(deps, resolved)`, the no-touch re-read a long-lived connection runs once it is registered: session row / token row (by id) still live and still on the account, account not soft-deleted; a daemon token re-reads its account only. Reuses the middleware's own queries and predicates. Called by the WS socket session (`actions/ws_socket_session.ts`) and the audit SSE route between registering a connection pending and admitting it. Twin of the Rust `revalidate_resolved_auth`.
|
|
258
260
|
- `auth/credential_deadline.ts` — when a resolved credential stops authenticating, which a WebSocket or audit stream opened on it closes at (expiry writes nothing a revocation listener hears): `credential_deadline_after` (the earliest remaining lifetime, anchored to `performance.now()`), `EXPIRES_IN_MS_SQL` (a row's `expires_at - NOW()`, read on the database clock in the statement that checks it, so the session and token validation queries return `expires_in_ms`), and `schedule_credential_deadline` (a chain of timers of at most `CREDENTIAL_DEADLINE_TIMER_CAP_MS`, an hour — a 30-day session is past `setTimeout`'s ceiling — each wake-up also checking a wall-clock copy of the deadline, so a host suspend, which stops the monotonic clock, delays the close by at most one timer after the resume). The middleware sets it on `ResolvedAuth.credential_deadline`: session — the earlier of the cookie's signed expiry (`SESSION_COOKIE_EXPIRES_AT_KEY`, set by the session middleware) and the row's; bearer — the row's, none for an eternal token; daemon token — none. Twin of the Rust `ResolvedAuth::credential_deadline`.
|
|
259
|
-
- `auth/bearer_auth.ts` — soft-fail bearer middleware;
|
|
260
|
-
- `auth/daemon_token_middleware.ts` — `create_daemon_token_middleware(state, deps, log)` — the credential **consumer** only (soft-fail validation, keeper account resolution). The producer (`write_daemon_token` / `start_daemon_token_rotation`) lives in `testing/daemon_token_rotation.ts` behind the dev-env guard — no production assembly mints daemon tokens, mirroring the Rust spine's `fuz_testing`-confined producer. Soft-fails — discards the credential (pass-through, no own 401/503) on **every** non-success path: browser context (`Origin
|
|
261
|
+
- `auth/bearer_auth.ts` — soft-fail bearer middleware; reads the header through `read_bearer_token` (one line, `Bearer` in any case, one SP, an `is_api_token_shaped` value — anything else, a repeated `Authorization` line included, is no credential and costs no query), and discards the token when the request carries any `Origin` or `Referer` line, an empty one included (browser context, `is_browser_context`). The scope it sets is the one the query parsed — there is no fallback. The last credential leg: it skips before reading the header when the daemon token or a session already resolved the request, so a bearer sent beside one is never looked up and its `last_used_at` / `last_used_ip` never move. A token whose account is tombstoned is no credential either — the anonymous answer, no use recorded.
|
|
262
|
+
- `auth/daemon_token_middleware.ts` — `create_daemon_token_middleware(state, deps, log)` — the credential **consumer** only (soft-fail validation, keeper account resolution). The producer (`write_daemon_token` / `start_daemon_token_rotation`) lives in `testing/daemon_token_rotation.ts` behind the dev-env guard — no production assembly mints daemon tokens, mirroring the Rust spine's `fuz_testing`-confined producer. Soft-fails — discards the credential (pass-through, no own 401/503) on **every** non-success path: browser context (any `Origin` or `Referer` line, an empty one included), malformed/invalid token (anything `read_daemon_token` does not read: off-shape, or the header sent twice), and valid-token-but-no-keeper all `next()` through to the dispatcher's `credential_type_required` (403) gate, mirroring the bearer guard and the Rust spine's `resolve.rs`. Daemon tokens are loopback-only, so browser context never arises in practice — the discard is defense-in-depth. The first credential leg, so it clears `RESOLVED_AUTH_KEY` on entry; a valid daemon token sets the `daemon_token` arm, and the session and bearer legs after it skip, so a cookie or bearer sent beside it is never looked up — as on the Rust spine, whose resolve walk never reads the cookie (its cookie-clear layer still verifies one, to clear it when invalid — as the session middleware here does). A discarded daemon token falls through to them.
|
|
261
263
|
|
|
262
264
|
See root ../../../CLAUDE.md §Middleware Ordering for canonical assembly
|
|
263
265
|
order. The auth-specific invariants are described below in §Cross-cutting
|
|
@@ -457,7 +459,9 @@ its wire shape: REST `c.json(body, status)`; HTTP RPC + WS fold into a
|
|
|
457
459
|
JSON-RPC envelope where `error.message` is the reason string and
|
|
458
460
|
`error.data: {reason, ...rest}` flattens diagnostic fields. The 500 reasons
|
|
459
461
|
stay distinct: `no_actors_on_account` (signup invariant violation),
|
|
460
|
-
`account_vanished` (torn read after resolve
|
|
462
|
+
`account_vanished` (torn read after resolve — the session and bearer legs
|
|
463
|
+
already resolve a tombstoned account as no credential, so this is only an
|
|
464
|
+
account removed between the leg and the authorization phase).
|
|
461
465
|
|
|
462
466
|
**Production-middleware invariant.** No production middleware on the auth
|
|
463
467
|
path populates `REQUEST_CONTEXT_KEY`; it sets only `RESOLVED_AUTH_KEY`. Test
|
|
@@ -597,7 +601,7 @@ account event plus one per-actor event (`delete` = soft, `purge` = hard,
|
|
|
597
601
|
"Account-removal target guards").
|
|
598
602
|
|
|
599
603
|
`role_grant_offer_supersede` carries
|
|
600
|
-
`reason: 'sibling_accepted' | 'role_grant_revoked' | 'scope_destroyed'`
|
|
604
|
+
`reason: 'sibling_accepted' | 'role_grant_revoked' | 'scope_destroyed' | 'account_deleted'` (for `account_deleted`, `cause_id` is the removed account, the grantor's or the recipient's; the WS `_supersede` notification never carries it — an account removal notifies no one)
|
|
601
605
|
plus `cause_id` pointing to the row that triggered the supersede.
|
|
602
606
|
|
|
603
607
|
### Keeper auth shape
|
|
@@ -703,9 +707,9 @@ reactivation has no self path because a soft-deleted account can't
|
|
|
703
707
|
authenticate.
|
|
704
708
|
|
|
705
709
|
- `admin_account_list_action_spec` — read; input `{limit?, offset?, include_deleted?}`; output `{accounts, grantable_roles}`. On it and the other paged reads (`audit_log_list`, `audit_log_role_grant_history`, `role_grant_offer_history`) `limit` / `offset` declare `invalid_reason` `ERROR_LIMIT_INVALID` / `ERROR_OFFSET_INVALID` (`http/error_schemas.ts`), and `audit_log_list`'s `since_seq` / `outcome` `ERROR_SINCE_SEQ_INVALID` / `ERROR_OUTCOME_INVALID`: every refusal of the field carries it. `include_deleted` (default false) surfaces soft-deleted rows (with `account.deleted_at` set) for the admin UI's reactivation view.
|
|
706
|
-
- `account_delete_action_spec` — mutation (soft delete); self-or-admin (`{account, actor}`, handler elevates to admin when `account_id` ≠ self); the self path is session-only, handler-enforced ahead of the target guards (an API or daemon token gets the dispatcher's `ERROR_CREDENTIAL_TYPE_REQUIRED` 403 via `credential_type_required_error`), while an admin deleting another account keeps any credential; input `{account_id?}`; output `{ok, deleted}`. Tombstones account + actor(s), revokes sessions/tokens, emits `account_delete` + per-actor `actor_delete`. Refuses a keeper-role target (`ERROR_CANNOT_DELETE_KEEPER`) or the sole active admin (`ERROR_CANNOT_DELETE_LAST_ADMIN`) — both fail-loud with a failure-audit row.
|
|
707
|
-
- `account_purge_action_spec` — mutation (hard purge); keeper-only (`credential_types: ['daemon_token']` + `roles: ['keeper']`) + `confirm: true` + WARN; input `{account_id, confirm?}`; output `{ok, purged}`.
|
|
708
|
-
- `account_undelete_action_spec` — mutation (reactivation, inverse of soft delete); admin-only (`roles: ['admin']` — no self path, a tombstoned account can't authenticate); input `{account_id}`; output `{ok, undeleted}`. Clears the `deleted_at` tombstone on the account + its actor(s), emits `account_undelete` + per-actor `actor_undelete`.
|
|
710
|
+
- `account_delete_action_spec` — mutation (soft delete); self-or-admin (`{account, actor}`, handler elevates to admin when `account_id` ≠ self); the self path is session-only, handler-enforced ahead of the target guards (an API or daemon token gets the dispatcher's `ERROR_CREDENTIAL_TYPE_REQUIRED` 403 via `credential_type_required_error`), while an admin deleting another account keeps any credential; input `{account_id?}`; output `{ok, deleted}`. Tombstones account + actor(s), supersedes every pending offer the account made and every pending offer made to it (`reason: 'account_deleted'`, an audit row each), revokes sessions/tokens, deletes the unclaimed invites the account issued (an `invite_delete` row each), emits `account_delete` + per-actor `actor_delete`. Role grants are kept — inert while the account is tombstoned. Refuses a keeper-role target (`ERROR_CANNOT_DELETE_KEEPER`) or the sole active admin (`ERROR_CANNOT_DELETE_LAST_ADMIN`) — both fail-loud with a failure-audit row.
|
|
711
|
+
- `account_purge_action_spec` — mutation (hard purge); keeper-only (`credential_types: ['daemon_token']` + `roles: ['keeper']`) + `confirm: true` + WARN; input `{account_id, confirm?}`; output `{ok, purged}`. Supersedes the account's outgoing offers and deletes the unclaimed invites it issued, then the cascading delete; emits `account_purge` + per-actor `actor_purge` (identity snapshot survives in metadata since `audit_log` ids carry no FK). Refuses a keeper-role target (`ERROR_CANNOT_DELETE_KEEPER`) or the sole active admin (`ERROR_CANNOT_DELETE_LAST_ADMIN`).
|
|
712
|
+
- `account_undelete_action_spec` — mutation (reactivation, inverse of soft delete); admin-only (`roles: ['admin']` — no self path, a tombstoned account can't authenticate); input `{account_id}`; output `{ok, undeleted}`. Clears the `deleted_at` tombstone on the account + its actor(s), emits `account_undelete` + per-actor `actor_undelete`. Restores the account, its actors and its role grants as they were; does not restore revoked sessions/tokens, superseded offers, or deleted invites.
|
|
709
713
|
- `admin_session_list_action_spec` — read; input `{acting?}` (an omitted input reads as `{}`); output `{sessions}`.
|
|
710
714
|
- `admin_session_revoke_all_action_spec` — mutation; input `{account_id}`; output `{ok, count}`.
|
|
711
715
|
- `admin_token_revoke_all_action_spec` — mutation; input `{account_id}`; output `{ok, count}`.
|
|
@@ -781,7 +785,7 @@ The create and assign inputs end in a `check` of `is_grant_scope_paired`
|
|
|
781
785
|
the list and history inputs read an omitted input as a fresh `{}`
|
|
782
786
|
(`with_default_fn`); history's `offset` is held to `Number.MAX_SAFE_INTEGER`.
|
|
783
787
|
|
|
784
|
-
- `role_grant_offer_create_action_spec` — session-only; input `{to_account_id, to_actor_id?, role, scope_kind?, scope_id?, message?}` (`scope_kind` a `ScopeKindName`; `scope_kind` + `scope_id` paired — both or neither, else `invalid_params`); output `{offer}`.
|
|
788
|
+
- `role_grant_offer_create_action_spec` — session-only; input `{to_account_id, to_actor_id?, role, scope_kind?, scope_id?, message?}` (`scope_kind` a `ScopeKindName`; `scope_kind` + `scope_id` paired — both or neither, else `invalid_params`); output `{offer}`. The create query itself (`query_role_grant_offer_create`) refuses a recipient that is not an active account — deleted or missing alike, answered as `role_grant_assign` answers them: 404 `not_found` (message `account not found`, no `data.reason`), or 400 `role_grant_offer_actor_account_mismatch` when an actor is named — after the self-target check and after the handler's authority gates, and a grantor that is no longer active (deleted mid-request: the dead-credential 401, no audit row). It takes `FOR SHARE` on both accounts first, so a delete of either party in flight is ordered against it.
|
|
785
789
|
- `role_grant_offer_accept_action_spec` — session-only; input `{offer_id}`; output `{role_grant_id, offer, superseded_offer_ids}`. Refuses a builtin-role offer that must not mint (see below), leaving it pending.
|
|
786
790
|
- `role_grant_offer_decline_action_spec` — input `{offer_id, reason?}`; output `{offer}` (the declined offer, as accept answers its own).
|
|
787
791
|
- `role_grant_offer_retract_action_spec` — input `{offer_id}`; output `{offer}` (the retracted offer).
|
|
@@ -796,7 +800,10 @@ the list and history inputs read an omitted input as a fresh `{}`
|
|
|
796
800
|
revokee's incoming sibling offers, the revoke supersedes every pending offer
|
|
797
801
|
the revokee's actor made (`query_role_grant_offer_supersede_outgoing`) —
|
|
798
802
|
`account_delete` / `account_purge` do the same for every actor of the account
|
|
799
|
-
(`reason: 'account_deleted'`, audited, no notification)
|
|
803
|
+
(`reason: 'account_deleted'`, audited, no notification), and `account_delete`
|
|
804
|
+
also supersedes every pending offer made TO the account
|
|
805
|
+
(`query_role_grant_offer_supersede_incoming`, same reason). Every supersede
|
|
806
|
+
cascade returns — and audits — its rows ordered by `created_at, id`.
|
|
800
807
|
- `role_grant_assign_action_spec` — global-admin-only immediate conferral (no
|
|
801
808
|
consent step); input `{to_account_id, to_actor_id?, role, scope_kind?, scope_id?}`
|
|
802
809
|
(the pair as on offer-create); output `{ok, role_grant_id}`. The handler:
|
|
@@ -937,12 +944,11 @@ Options: `roles?: RoleRegistry` (drives admin-grant-path lookup),
|
|
|
937
944
|
- `account_token_list_action_spec` — read; input fuz_schema's `void`; output `{tokens}`, each a `ClientApiTokenJson`.
|
|
938
945
|
- `account_token_revoke_action_spec` — mutation; input `{token_id}`; output `{ok, revoked}`.
|
|
939
946
|
|
|
940
|
-
`account_verify` is
|
|
941
|
-
|
|
942
|
-
`
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
as the anonymous caller.
|
|
947
|
+
`account_verify` is the credential probe on both spines: it returns
|
|
948
|
+
`SessionAccountJson`, and a narrowed token that names it may call it.
|
|
949
|
+
`GET /status` answers a narrowed token as the anonymous caller. There is no
|
|
950
|
+
REST probe (an nginx `auth_request` gate would need one mounted on both
|
|
951
|
+
spines).
|
|
946
952
|
|
|
947
953
|
`session_id` validates as `SessionId`, the fuz_schema `Blake3Hash` branded;
|
|
948
954
|
`token_id` as `ApiTokenId` (`tok_[A-Za-z0-9_-]{12}`). Every input and output
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/account_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"account_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/account_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AA2BhG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AA0B3D,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,yBAAyB,EAC/B,UAAS,oBAAyB,KAChC,KAAK,CAAC,SAAS,CAgNjB,CAAC"}
|
|
@@ -30,9 +30,11 @@
|
|
|
30
30
|
import { to_error_message } from '@fuzdev/fuz_util/error.ts';
|
|
31
31
|
import { rpc_action } from '../actions/action_types.js';
|
|
32
32
|
import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
|
|
33
|
+
import { ERROR_AUTHENTICATION_REQUIRED } from '../http/error_schemas.js';
|
|
33
34
|
import { queue_connection_close } from '../actions/connection_closer.js';
|
|
34
35
|
import { to_session_account } from './account_schema.js';
|
|
35
|
-
import {
|
|
36
|
+
import { query_account_lock_live } from './account_queries.js';
|
|
37
|
+
import { query_session_is_live, query_session_list_for_account, query_session_revoke_for_account, query_session_revoke_all_for_account } from './session_queries.js';
|
|
36
38
|
import { query_api_token_enforce_limit, query_api_token_list_for_account, query_create_api_token, query_revoke_api_token_for_account } from './api_token_queries.js';
|
|
37
39
|
import { parse_stored_token_scope, serialize_token_scope, token_scope_from_input, token_scope_label } from './token_scope.js';
|
|
38
40
|
import { token_lifetime_to_expires_at } from './token_lifetime.js';
|
|
@@ -131,6 +133,21 @@ export const create_account_actions = (deps, options = {}) => {
|
|
|
131
133
|
// `input.lifetime` is required for the same reason — an omitted lifetime
|
|
132
134
|
// is a validation error, never an eternal token.
|
|
133
135
|
const expires_at = token_lifetime_to_expires_at(input.lifetime);
|
|
136
|
+
// The session that authorized this was read before the transaction. A
|
|
137
|
+
// delete or a password change committed since mints nothing — refused as
|
|
138
|
+
// the dead session it now is, the two losers one answer — and one still
|
|
139
|
+
// to commit waits on the account lock and then revokes the token: both
|
|
140
|
+
// write the account row before they revoke (`query_account_lock_live`,
|
|
141
|
+
// then `query_session_is_live`, which sees a revoke committed before
|
|
142
|
+
// the lock was granted).
|
|
143
|
+
const session_hash = ctx.session_hash;
|
|
144
|
+
if (!(await query_account_lock_live(ctx, ctx.auth.account.id)) ||
|
|
145
|
+
session_hash === null ||
|
|
146
|
+
!(await query_session_is_live(ctx, session_hash, ctx.auth.account.id))) {
|
|
147
|
+
throw jsonrpc_errors.unauthenticated('unauthenticated', {
|
|
148
|
+
reason: ERROR_AUTHENTICATION_REQUIRED
|
|
149
|
+
});
|
|
150
|
+
}
|
|
134
151
|
await query_create_api_token(ctx, id, ctx.auth.account.id, input.name, token_hash, scope, expires_at);
|
|
135
152
|
if (max_tokens != null) {
|
|
136
153
|
const evicted = await query_api_token_enforce_limit(ctx, ctx.auth.account.id, max_tokens);
|
|
@@ -96,6 +96,75 @@ export declare const query_account_by_username_or_email: (deps: QueryDeps, input
|
|
|
96
96
|
* `updated_by` only when the stored hash equals `expected_hash`
|
|
97
97
|
*/
|
|
98
98
|
export declare const query_update_account_password: (deps: QueryDeps, id: string, password_hash: string, updated_by: string | null, expected_hash: string) => Promise<boolean>;
|
|
99
|
+
/**
|
|
100
|
+
* Lock an account row for a credential mint, when the account is live and
|
|
101
|
+
* still holds the password hash its authorization verified.
|
|
102
|
+
*
|
|
103
|
+
* A login verifies the password outside any transaction, so a password change
|
|
104
|
+
* or an account delete can commit between the verify and the session insert —
|
|
105
|
+
* and revoke "every session" before the new one exists. Run first in the
|
|
106
|
+
* mint's transaction, this read waits on the row lock either writer holds and
|
|
107
|
+
* then rereads the row as they committed it, so the mint is refused when the
|
|
108
|
+
* hash changed or the tombstone landed; and once it holds the lock, either
|
|
109
|
+
* writer waits for the mint to commit and then revokes what it minted. Both
|
|
110
|
+
* writers write the account row before they revoke, which is what makes the
|
|
111
|
+
* lock order them.
|
|
112
|
+
*
|
|
113
|
+
* `FOR SHARE` is the weakest lock that conflicts with their `UPDATE`s (the
|
|
114
|
+
* session insert's foreign-key `FOR KEY SHARE` does not), and concurrent
|
|
115
|
+
* logins of one account share it. Twin of the Rust
|
|
116
|
+
* `fuz_auth::query_account_lock_verified`.
|
|
117
|
+
*
|
|
118
|
+
* @param deps - query dependencies (must be the mint's transaction)
|
|
119
|
+
* @param id - the account the credential is for
|
|
120
|
+
* @param password_hash - the hash the password was verified against
|
|
121
|
+
* @returns `true` when the row is locked and current, `false` when it was deleted, tombstoned, or its hash changed
|
|
122
|
+
*/
|
|
123
|
+
export declare const query_account_lock_verified: (deps: QueryDeps, id: string, password_hash: string) => Promise<boolean>;
|
|
124
|
+
/**
|
|
125
|
+
* Lock a live account row for a credential mint authorized by a credential
|
|
126
|
+
* the account already holds (`account_token_create`).
|
|
127
|
+
*
|
|
128
|
+
* The request's credential was resolved outside the mint's transaction, so an
|
|
129
|
+
* account delete can commit between that read and the insert, revoking every
|
|
130
|
+
* token before the new one exists. Run first in the mint's transaction, this
|
|
131
|
+
* read waits on the delete's row lock and then sees its tombstone; once it
|
|
132
|
+
* holds the lock, a delete waits for the mint to commit and then revokes the
|
|
133
|
+
* token. The password is not re-checked: the mint verified none. `invite_create`
|
|
134
|
+
* takes the same lock on its issuer's account, before its insert, so an
|
|
135
|
+
* invite and a delete of its issuer are ordered: the invite is refused, or the
|
|
136
|
+
* delete deletes it. An offer locks two accounts, so it takes them together
|
|
137
|
+
* through `query_account_lock_live_many`. Twin of the Rust
|
|
138
|
+
* `fuz_auth::query_account_lock_live`; `query_account_lock_verified` has why
|
|
139
|
+
* `FOR SHARE`.
|
|
140
|
+
*
|
|
141
|
+
* @param deps - query dependencies (must be the mint's transaction)
|
|
142
|
+
* @param id - the account the credential is for
|
|
143
|
+
* @returns `true` when the row is locked and not tombstoned, `false` when it was deleted or tombstoned
|
|
144
|
+
*/
|
|
145
|
+
export declare const query_account_lock_live: (deps: QueryDeps, id: string) => Promise<boolean>;
|
|
146
|
+
/**
|
|
147
|
+
* Lock several live account rows in one statement, in id order, for a write
|
|
148
|
+
* that must be ordered against a delete of any of them — the two parties of an
|
|
149
|
+
* offer (`query_role_grant_offer_create`).
|
|
150
|
+
*
|
|
151
|
+
* The rows are locked as the sort returns them, so every caller takes them in
|
|
152
|
+
* id order, as the last-admin guard
|
|
153
|
+
* (`query_count_active_accounts_with_global_role_for_update`) takes its
|
|
154
|
+
* account rows: two transactions locking two of the same accounts never wait
|
|
155
|
+
* on each other in opposite orders. Taken one statement per account, an offer
|
|
156
|
+
* between two admins could hold one party's row while the guard held the
|
|
157
|
+
* other's, each waiting on the other. Ids never change, so the sort key a
|
|
158
|
+
* concurrent update could move is not one of them. As with
|
|
159
|
+
* `query_account_lock_live`, a delete committed before the read is waited for
|
|
160
|
+
* and its tombstone seen; one after it waits for the caller's commit. Twin of
|
|
161
|
+
* the Rust `fuz_auth::query_account_lock_live_many`.
|
|
162
|
+
*
|
|
163
|
+
* @param deps - query dependencies (must be the write's transaction)
|
|
164
|
+
* @param ids - the accounts to lock
|
|
165
|
+
* @returns the ids locked: those of the accounts neither deleted nor tombstoned
|
|
166
|
+
*/
|
|
167
|
+
export declare const query_account_lock_live_many: (deps: QueryDeps, ids: ReadonlyArray<string>) => Promise<Set<string>>;
|
|
99
168
|
/**
|
|
100
169
|
* Identifying values snapshotted into a deletion/purge audit event so the
|
|
101
170
|
* identity behind a now-orphaned `audit_log` id isn't lost. Mirrors the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_queries.d.ts","sourceRoot":"","sources":["../../src/lib/auth/account_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,MAAM,qBAAqB,CAAC;AAK7B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,6JAYqB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,aAAa,6GASqB,CAAC;AAehD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,SAAS,EACf,OAAO,kBAAkB,KACvB,OAAO,CAAC,OAAO,CAQjB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,SAAS,EACf,IAAI,MAAM,KACR,OAAO,CAAC,OAAO,GAAG,SAAS,CAK7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GACrC,MAAM,SAAS,EACf,UAAU,MAAM,KACd,OAAO,CAAC,OAAO,GAAG,SAAS,CAK7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,SAAS,EACf,OAAO,MAAM,KACX,OAAO,CAAC,OAAO,GAAG,SAAS,CAK7B,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kCAAkC,GAC9C,MAAM,SAAS,EACf,OAAO,MAAM,KACX,OAAO,CAAC,OAAO,GAAG,SAAS,CAS7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,6BAA6B,GACzC,MAAM,SAAS,EACf,IAAI,MAAM,EACV,eAAe,MAAM,EACrB,YAAY,MAAM,GAAG,IAAI,EACzB,eAAe,MAAM,KACnB,OAAO,C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,CAKtB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,GAC1C,MAAM,SAAS,EACf,YAAY,MAAM,KAChB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAKtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC7B,MAAM,SAAS,EACf,IAAI,MAAM,KACR,OAAO,CAAC,KAAK,GAAG,SAAS,CAK3B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,GAC3C,MAAM,SAAS,EACf,OAAO,kBAAkB,KACvB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAI5C,CAAC;AAgDF,8CAA8C;AAC9C,MAAM,WAAW,uBAAuB;IACvC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,SAAS,EACf,UAAU,uBAAuB,KAC/B,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAkHtC,CAAC"}
|
|
@@ -158,6 +158,88 @@ export const query_update_account_password = async (deps, id, password_hash, upd
|
|
|
158
158
|
RETURNING id`, [password_hash, updated_by ?? null, id, expected_hash]);
|
|
159
159
|
return rows.length > 0;
|
|
160
160
|
};
|
|
161
|
+
/**
|
|
162
|
+
* Lock an account row for a credential mint, when the account is live and
|
|
163
|
+
* still holds the password hash its authorization verified.
|
|
164
|
+
*
|
|
165
|
+
* A login verifies the password outside any transaction, so a password change
|
|
166
|
+
* or an account delete can commit between the verify and the session insert —
|
|
167
|
+
* and revoke "every session" before the new one exists. Run first in the
|
|
168
|
+
* mint's transaction, this read waits on the row lock either writer holds and
|
|
169
|
+
* then rereads the row as they committed it, so the mint is refused when the
|
|
170
|
+
* hash changed or the tombstone landed; and once it holds the lock, either
|
|
171
|
+
* writer waits for the mint to commit and then revokes what it minted. Both
|
|
172
|
+
* writers write the account row before they revoke, which is what makes the
|
|
173
|
+
* lock order them.
|
|
174
|
+
*
|
|
175
|
+
* `FOR SHARE` is the weakest lock that conflicts with their `UPDATE`s (the
|
|
176
|
+
* session insert's foreign-key `FOR KEY SHARE` does not), and concurrent
|
|
177
|
+
* logins of one account share it. Twin of the Rust
|
|
178
|
+
* `fuz_auth::query_account_lock_verified`.
|
|
179
|
+
*
|
|
180
|
+
* @param deps - query dependencies (must be the mint's transaction)
|
|
181
|
+
* @param id - the account the credential is for
|
|
182
|
+
* @param password_hash - the hash the password was verified against
|
|
183
|
+
* @returns `true` when the row is locked and current, `false` when it was deleted, tombstoned, or its hash changed
|
|
184
|
+
*/
|
|
185
|
+
export const query_account_lock_verified = async (deps, id, password_hash) => {
|
|
186
|
+
const row = await deps.db.query_one(`SELECT id FROM account
|
|
187
|
+
WHERE id = $1 AND deleted_at IS NULL AND password_hash = $2
|
|
188
|
+
FOR SHARE`, [id, password_hash]);
|
|
189
|
+
return row !== undefined;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Lock a live account row for a credential mint authorized by a credential
|
|
193
|
+
* the account already holds (`account_token_create`).
|
|
194
|
+
*
|
|
195
|
+
* The request's credential was resolved outside the mint's transaction, so an
|
|
196
|
+
* account delete can commit between that read and the insert, revoking every
|
|
197
|
+
* token before the new one exists. Run first in the mint's transaction, this
|
|
198
|
+
* read waits on the delete's row lock and then sees its tombstone; once it
|
|
199
|
+
* holds the lock, a delete waits for the mint to commit and then revokes the
|
|
200
|
+
* token. The password is not re-checked: the mint verified none. `invite_create`
|
|
201
|
+
* takes the same lock on its issuer's account, before its insert, so an
|
|
202
|
+
* invite and a delete of its issuer are ordered: the invite is refused, or the
|
|
203
|
+
* delete deletes it. An offer locks two accounts, so it takes them together
|
|
204
|
+
* through `query_account_lock_live_many`. Twin of the Rust
|
|
205
|
+
* `fuz_auth::query_account_lock_live`; `query_account_lock_verified` has why
|
|
206
|
+
* `FOR SHARE`.
|
|
207
|
+
*
|
|
208
|
+
* @param deps - query dependencies (must be the mint's transaction)
|
|
209
|
+
* @param id - the account the credential is for
|
|
210
|
+
* @returns `true` when the row is locked and not tombstoned, `false` when it was deleted or tombstoned
|
|
211
|
+
*/
|
|
212
|
+
export const query_account_lock_live = async (deps, id) => {
|
|
213
|
+
const row = await deps.db.query_one(`SELECT id FROM account WHERE id = $1 AND deleted_at IS NULL FOR SHARE`, [id]);
|
|
214
|
+
return row !== undefined;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Lock several live account rows in one statement, in id order, for a write
|
|
218
|
+
* that must be ordered against a delete of any of them — the two parties of an
|
|
219
|
+
* offer (`query_role_grant_offer_create`).
|
|
220
|
+
*
|
|
221
|
+
* The rows are locked as the sort returns them, so every caller takes them in
|
|
222
|
+
* id order, as the last-admin guard
|
|
223
|
+
* (`query_count_active_accounts_with_global_role_for_update`) takes its
|
|
224
|
+
* account rows: two transactions locking two of the same accounts never wait
|
|
225
|
+
* on each other in opposite orders. Taken one statement per account, an offer
|
|
226
|
+
* between two admins could hold one party's row while the guard held the
|
|
227
|
+
* other's, each waiting on the other. Ids never change, so the sort key a
|
|
228
|
+
* concurrent update could move is not one of them. As with
|
|
229
|
+
* `query_account_lock_live`, a delete committed before the read is waited for
|
|
230
|
+
* and its tombstone seen; one after it waits for the caller's commit. Twin of
|
|
231
|
+
* the Rust `fuz_auth::query_account_lock_live_many`.
|
|
232
|
+
*
|
|
233
|
+
* @param deps - query dependencies (must be the write's transaction)
|
|
234
|
+
* @param ids - the accounts to lock
|
|
235
|
+
* @returns the ids locked: those of the accounts neither deleted nor tombstoned
|
|
236
|
+
*/
|
|
237
|
+
export const query_account_lock_live_many = async (deps, ids) => {
|
|
238
|
+
if (ids.length === 0)
|
|
239
|
+
return new Set();
|
|
240
|
+
const rows = await deps.db.query(`SELECT id FROM account WHERE id = ANY($1) AND deleted_at IS NULL ORDER BY id FOR SHARE`, [ids]);
|
|
241
|
+
return new Set(rows.map((row) => row.id));
|
|
242
|
+
};
|
|
161
243
|
/**
|
|
162
244
|
* Soft-delete an account — the reversible tombstone (`delete` = soft).
|
|
163
245
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hono-free wire schemas + route shapes for the account REST routes.
|
|
3
3
|
*
|
|
4
|
-
* Split from `account_routes.ts` (whose handlers
|
|
5
|
-
* `session_middleware`) so cross-process test suites can build the account
|
|
4
|
+
* Split from `account_routes.ts` (whose handlers mint and end sessions through
|
|
5
|
+
* `session_middleware` and the query layer) so cross-process test suites can build the account
|
|
6
6
|
* route shapes — and assert on the `POST /login` / `GET /api/account/status`
|
|
7
|
-
* response shapes — without dragging the in-process
|
|
8
|
-
*
|
|
7
|
+
* response shapes — without dragging the in-process session handlers and
|
|
8
|
+
* their queries onto a backend-spawning consumer. `account_routes.ts`
|
|
9
9
|
* imports these back and attaches the live handlers; single source of truth
|
|
10
10
|
* for the wire shape.
|
|
11
11
|
*
|
|
@@ -108,13 +108,21 @@ export declare const DEFAULT_MAX_TOKENS = 10;
|
|
|
108
108
|
* context; surface generation attaches a stub.
|
|
109
109
|
*
|
|
110
110
|
* The path is **relative** like the sibling account shapes (`/login`,
|
|
111
|
-
* `/
|
|
111
|
+
* `/logout`), so it composes under `prefix_route_specs('/api/account', …)` into
|
|
112
112
|
* `/api/account/status`. `create_account_route_specs` bundles it (so every
|
|
113
113
|
* account surface serves `/status`, matching the Rust `account_router`);
|
|
114
114
|
* mirror Rust by mounting it as part of the account family, not separately.
|
|
115
115
|
*/
|
|
116
116
|
export declare const account_status_route_shape: import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "authentication_required", {
|
|
117
117
|
readonly bootstrap_available: import("@fuzdev/fuz_schema/schema.ts").OptionalSchema<import("@fuzdev/fuz_schema/schema.ts").BooleanSchema>;
|
|
118
|
+
}>, import("../http/error_schemas.js").RestErrorDef<400, "invalid_query_params", {
|
|
119
|
+
readonly issues: import("@fuzdev/fuz_schema/schema.ts").OptionalSchema<import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").LooseObjectSchema<{
|
|
120
|
+
kind: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
|
|
121
|
+
path: import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").UnionSchema<readonly [import("@fuzdev/fuz_schema/schema.ts").StringSchema, import("@fuzdev/fuz_schema/schema.ts").NumberSchema]>>;
|
|
122
|
+
expected: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
|
|
123
|
+
received: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
|
|
124
|
+
message: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
|
|
125
|
+
}>>>;
|
|
118
126
|
}>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
|
|
119
127
|
account: import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
|
|
120
128
|
id: import("@fuzdev/fuz_schema/schema.ts").BrandSchema<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>, "Uuid">;
|
|
@@ -139,40 +147,39 @@ export declare const account_status_route_shape: import("../http/route_spec.js")
|
|
|
139
147
|
}>, {
|
|
140
148
|
readonly account: "none";
|
|
141
149
|
readonly actor: "none";
|
|
142
|
-
}, undefined>;
|
|
150
|
+
}, undefined, import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<null>, undefined, undefined>;
|
|
143
151
|
/** Option inputs that shape the account route metadata (not its handlers). */
|
|
144
152
|
export interface AccountRouteShapeOptions {
|
|
145
153
|
/** Whether a per-account login rate limiter is wired — toggles `/password`'s `rate_limit`. */
|
|
146
154
|
login_account_rate_limited: boolean;
|
|
147
155
|
}
|
|
148
156
|
/**
|
|
149
|
-
* The
|
|
157
|
+
* The account route shapes (`/login`, `/logout`, `/password`)
|
|
150
158
|
* minus their handlers — pure hono-free data. `create_account_route_specs`
|
|
151
159
|
* attaches the live handler to each (`attach_route_handler`); cross-process
|
|
152
160
|
* surface builders attach stubs (`stub_route_spec`). Single source of truth —
|
|
153
161
|
* the shapes can't drift between the live routes and the surface.
|
|
154
162
|
*
|
|
155
|
-
* Returns a fixed
|
|
163
|
+
* Returns a fixed tuple `[login, logout, password]` so destructuring
|
|
156
164
|
* yields non-optional shapes under `noUncheckedIndexedAccess`, each with the
|
|
157
165
|
* types `attach_route_handler` checks its handler against.
|
|
158
166
|
*/
|
|
159
|
-
export declare const create_account_route_shapes: (options: AccountRouteShapeOptions) => readonly [import("../http/route_spec.js").RouteShape<[], import("@fuzdev/fuz_schema/schema.ts").
|
|
160
|
-
readonly account: "required";
|
|
161
|
-
readonly actor: "none";
|
|
162
|
-
readonly required_scope: "surface:account_verify";
|
|
163
|
-
}, undefined>, import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "invalid_credentials", Record<never, never>>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
|
|
167
|
+
export declare const create_account_route_shapes: (options: AccountRouteShapeOptions) => readonly [import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "invalid_credentials", Record<never, never>>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
|
|
164
168
|
ok: import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<true>;
|
|
165
169
|
}>, {
|
|
166
170
|
readonly account: "none";
|
|
167
171
|
readonly actor: "none";
|
|
168
|
-
}, "both"
|
|
172
|
+
}, "both", import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
|
|
173
|
+
username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>>;
|
|
174
|
+
password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
|
|
175
|
+
}>, undefined, undefined>, import("../http/route_spec.js").RouteShape<[], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
|
|
169
176
|
ok: import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<true>;
|
|
170
177
|
username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>>;
|
|
171
178
|
}>, {
|
|
172
179
|
readonly account: "required";
|
|
173
180
|
readonly actor: "none";
|
|
174
181
|
readonly credential_types: readonly ["session"];
|
|
175
|
-
}, undefined>, import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "invalid_credentials", Record<never, never>>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
|
|
182
|
+
}, undefined, import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<null>, undefined, undefined>, import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "invalid_credentials", Record<never, never>>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
|
|
176
183
|
ok: import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<true>;
|
|
177
184
|
sessions_revoked: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").NumberSchema>;
|
|
178
185
|
tokens_revoked: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").NumberSchema>;
|
|
@@ -180,5 +187,8 @@ export declare const create_account_route_shapes: (options: AccountRouteShapeOpt
|
|
|
180
187
|
readonly account: "required";
|
|
181
188
|
readonly actor: "none";
|
|
182
189
|
readonly credential_types: readonly ["session"];
|
|
183
|
-
}, "ip" | "both"
|
|
190
|
+
}, "ip" | "both", import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
|
|
191
|
+
current_password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
|
|
192
|
+
new_password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
|
|
193
|
+
}>, undefined, undefined>];
|
|
184
194
|
//# sourceMappingURL=account_route_schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_route_schema.d.ts","sourceRoot":"","sources":["../../src/lib/auth/account_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"account_route_schema.d.ts","sourceRoot":"","sources":["../../src/lib/auth/account_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAYtC,mGAAmG;AACnG,eAAO,MAAM,kBAAkB,4DAAgB,CAAC;AAChD,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;EAI9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,UAAU;;;EAGrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,WAAW;;EAEtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD,4FAA4F;AAC5F,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