@fuzdev/fuz_app 0.150.0 → 0.152.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/README.md +1 -1
- package/dist/actions/CLAUDE.md +324 -299
- package/dist/actions/action_bridge.d.ts +5 -86
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -84
- package/dist/actions/action_codegen.d.ts +8 -166
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +19 -95
- package/dist/actions/action_dispatcher.d.ts +10 -0
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +9 -6
- package/dist/actions/action_event.d.ts +1 -2
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -13
- package/dist/actions/action_event_helpers.d.ts +1 -40
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +1 -25
- package/dist/actions/action_rpc.d.ts +10 -215
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -111
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/action_spec.js +2 -2
- package/dist/actions/action_types.d.ts +229 -8
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +56 -5
- package/dist/actions/broadcast_api.d.ts +22 -17
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/broadcast_api.js +16 -27
- package/dist/actions/cancel.d.ts +4 -13
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +5 -17
- package/dist/actions/compile_action_registry.d.ts +1 -2
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +120 -50
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +139 -31
- package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
- package/dist/actions/connection_registry.d.ts.map +1 -0
- package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
- package/dist/actions/frontend_rpc_client.d.ts +52 -2
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +42 -4
- package/dist/actions/peer_ping.d.ts +7 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +6 -8
- package/dist/actions/peer_request.d.ts +6 -5
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +6 -5
- package/dist/actions/perform_action.d.ts +36 -28
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +60 -34
- package/dist/actions/protocol.d.ts +14 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +18 -0
- package/dist/actions/register_action_ws.d.ts +137 -298
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -923
- package/dist/actions/socket.svelte.d.ts +9 -0
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +16 -5
- package/dist/actions/transports.d.ts +88 -34
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +76 -76
- package/dist/actions/transports_http.d.ts +48 -12
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +75 -44
- package/dist/actions/transports_ws.d.ts +29 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +34 -8
- package/dist/actions/ws_endpoint_spec.d.ts +52 -75
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/actions/ws_endpoint_spec.js +27 -10
- package/dist/actions/ws_outbound_writer.d.ts +3 -3
- package/dist/actions/ws_outbound_writer.js +3 -3
- package/dist/actions/ws_socket_session.d.ts +321 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -0
- package/dist/actions/ws_socket_session.js +783 -0
- package/dist/auth/CLAUDE.md +70 -44
- package/dist/auth/account_action_specs.d.ts +2 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -3
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +27 -17
- package/dist/auth/account_routes.d.ts +2 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +14 -17
- package/dist/auth/account_schema.d.ts +5 -5
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +5 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +2 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +5 -5
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +7 -7
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +3 -1
- package/dist/auth/admin_actions.d.ts +1 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +12 -42
- package/dist/auth/all_cell_actions.d.ts +6 -4
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token_queries.d.ts +1 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -0
- package/dist/auth/audit_emitter.d.ts +3 -3
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +3 -2
- package/dist/auth/audit_log_routes.d.ts +20 -11
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +49 -29
- package/dist/auth/audit_log_schema.d.ts +13 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +10 -18
- package/dist/auth/bearer_auth.d.ts +7 -4
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +21 -15
- package/dist/auth/cell_action_helpers.d.ts +89 -0
- package/dist/auth/cell_action_helpers.d.ts.map +1 -0
- package/dist/auth/cell_action_helpers.js +113 -0
- package/dist/auth/cell_actions.d.ts +22 -13
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +105 -167
- package/dist/auth/cell_audit_actions.d.ts +1 -1
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +3 -12
- package/dist/auth/cell_audit_metadata.d.ts +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_actions.d.ts +1 -1
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +16 -66
- package/dist/auth/cell_grant_action_specs.d.ts +2 -2
- package/dist/auth/cell_grant_action_specs.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +73 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +63 -55
- package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +7 -4
- package/dist/auth/cell_item_actions.d.ts +1 -1
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +21 -82
- package/dist/auth/cleanup.d.ts +1 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -3
- package/dist/auth/credential_deadline.d.ts +3 -3
- package/dist/auth/credential_deadline.js +3 -3
- package/dist/auth/credential_type_schema.d.ts +5 -5
- package/dist/auth/credential_type_schema.js +5 -5
- package/dist/auth/daemon_token_middleware.d.ts +12 -6
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -17
- package/dist/auth/deps.d.ts +4 -4
- package/dist/auth/fail_floor.d.ts +55 -0
- package/dist/auth/fail_floor.d.ts.map +1 -0
- package/dist/auth/fail_floor.js +63 -0
- package/dist/auth/invite_queries.d.ts +3 -15
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -21
- package/dist/auth/middleware.d.ts +12 -7
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +42 -29
- package/dist/auth/migrations.d.ts +5 -33
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +9 -16
- package/dist/auth/request_context.d.ts +101 -71
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +137 -140
- package/dist/auth/resolved_auth.d.ts +122 -36
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +89 -38
- package/dist/auth/role_grant_offer_action_specs.d.ts +99 -14
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +26 -13
- package/dist/auth/role_grant_offer_actions.d.ts +13 -7
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +14 -12
- package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts +0 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +9 -41
- package/dist/auth/role_grant_queries.d.ts +17 -67
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +34 -106
- package/dist/auth/role_grant_sql.d.ts +42 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -0
- package/dist/auth/role_grant_sql.js +54 -0
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/session_queries.d.ts +2 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +2 -1
- package/dist/auth/signup_routes.d.ts +2 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +14 -13
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/token_scope.d.ts +19 -46
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +23 -41
- package/dist/db/CLAUDE.md +9 -4
- package/dist/db/cell_ddl.d.ts +5 -142
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +17 -16
- package/dist/db/cell_field_queries.d.ts +0 -13
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +0 -16
- package/dist/db/cell_grant_queries.d.ts +10 -5
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +13 -7
- package/dist/db/cell_item_queries.d.ts +0 -7
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +0 -10
- package/dist/db/cell_queries.d.ts +12 -48
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +24 -55
- package/dist/db/cell_view_sql.d.ts +1 -6
- package/dist/db/cell_view_sql.d.ts.map +1 -1
- package/dist/db/cell_view_sql.js +1 -2
- package/dist/db/fact_ddl.d.ts +5 -30
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +14 -13
- package/dist/db/fact_store.d.ts +11 -0
- package/dist/db/fact_store.d.ts.map +1 -1
- package/dist/db/fact_store.js +4 -1
- package/dist/db/migrate.d.ts +44 -6
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +63 -4
- package/dist/dev/setup.d.ts +18 -14
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -39
- package/dist/env/dotenv.d.ts +2 -2
- package/dist/env/dotenv.js +2 -2
- package/dist/env/update_env_variable.d.ts +33 -21
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +54 -35
- package/dist/hono_context.d.ts +15 -90
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +9 -56
- package/dist/http/CLAUDE.md +35 -20
- package/dist/http/auth_shape.d.ts +1 -8
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +6 -12
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +3 -2
- package/dist/http/db_routes.d.ts +3 -3
- package/dist/http/db_routes.js +3 -3
- package/dist/http/error_schemas.d.ts +1 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +1 -2
- package/dist/http/health_schema.d.ts +16 -0
- package/dist/http/health_schema.d.ts.map +1 -0
- package/dist/http/health_schema.js +12 -0
- package/dist/http/jsonrpc_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +41 -3
- package/dist/http/jsonrpc_helpers.d.ts +60 -17
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +67 -25
- package/dist/http/origin.d.ts +30 -1
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +46 -9
- package/dist/http/origin_wildcard.d.ts +97 -0
- package/dist/http/origin_wildcard.d.ts.map +1 -0
- package/dist/http/origin_wildcard.js +142 -0
- package/dist/http/pending_effects.d.ts +28 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +32 -1
- package/dist/http/route_spec.d.ts +4 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -45
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface_query.d.ts +9 -50
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +48 -94
- package/dist/realtime/audit_log_sse.d.ts +180 -0
- package/dist/realtime/audit_log_sse.d.ts.map +1 -0
- package/dist/realtime/audit_log_sse.js +154 -0
- package/dist/realtime/sse.d.ts +21 -6
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +33 -10
- package/dist/realtime/sse_constants.d.ts +29 -2
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +35 -2
- package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
- package/dist/realtime/sse_registry.d.ts.map +1 -0
- package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
- package/dist/schema_meta.d.ts +30 -10
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +85 -21
- package/dist/sensitivity.d.ts +9 -3
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -2
- package/dist/server/app_backend.d.ts +8 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +6 -12
- package/dist/server/app_server.d.ts +62 -51
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +84 -71
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.d.ts +24 -20
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +24 -34
- package/dist/server/serve_fact_route.d.ts +12 -16
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -34
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +2 -2
- package/dist/testing/CLAUDE.md +179 -158
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +10 -19
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -0
- package/dist/testing/app_server.d.ts +9 -77
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -112
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +3 -4
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -5
- package/dist/testing/auth_apps.d.ts +3 -3
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -6
- package/dist/testing/connection_closer_helpers.d.ts +8 -16
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +7 -20
- package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +13 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +25 -22
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
- package/dist/testing/cross_backend/capabilities.d.ts +13 -7
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_grant_role.js +2 -2
- package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
- package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +21 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +29 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +48 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +9 -2
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_scope.js +5 -13
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
- package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +56 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +18 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +23 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
- package/dist/testing/cross_backend/session_cap.d.ts +8 -0
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +66 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +5 -4
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +21 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -3
- package/dist/testing/cross_backend/standard.d.ts +6 -12
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -6
- package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +13 -2
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +68 -0
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +45 -3
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
- package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
- package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_envelope.js +172 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
- package/dist/testing/cross_backend/ws_role_gated.js +2 -2
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +6 -4
- package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
- package/dist/testing/daemon_info.d.ts.map +1 -0
- package/dist/testing/daemon_info.js +108 -0
- package/dist/testing/daemon_token_rotation.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -4
- package/dist/testing/db.js +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +35 -65
- package/dist/testing/integration_helpers.d.ts +0 -15
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -42
- package/dist/testing/middleware.d.ts +20 -12
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +49 -40
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +13 -22
- package/dist/testing/resolved_auth.d.ts +30 -0
- package/dist/testing/resolved_auth.d.ts.map +1 -0
- package/dist/testing/resolved_auth.js +41 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +3 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +2 -1
- package/dist/testing/sse_round_trip.d.ts +5 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/test_origin.d.ts +25 -0
- package/dist/testing/test_origin.d.ts.map +1 -0
- package/dist/testing/test_origin.js +28 -0
- package/dist/testing/transports/raw_http.d.ts +54 -0
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +58 -0
- package/dist/testing/transports/ws_raw_client.d.ts +8 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +13 -0
- package/dist/testing/transports/ws_transport.d.ts +15 -2
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +4 -2
- package/dist/testing/ws_round_trip.d.ts +27 -25
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +34 -26
- package/dist/ui/AccountSessions.svelte +48 -19
- package/dist/ui/AccountSessions.svelte.d.ts +2 -17
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +6 -1
- package/dist/ui/AdminAuditLog.svelte +61 -22
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +1 -1
- package/dist/ui/AdminOverview.svelte +76 -37
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
- package/dist/ui/AdminSessions.svelte +1 -1
- package/dist/ui/AppShell.svelte +3 -2
- package/dist/ui/AppShell.svelte.d.ts +3 -2
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +121 -35
- package/dist/ui/Datatable.svelte +33 -18
- package/dist/ui/Datatable.svelte.d.ts +2 -14
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +10 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte +13 -8
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +66 -27
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +6 -4
- package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +9 -9
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +9 -9
- package/dist/ui/app_settings_state.svelte.d.ts +2 -2
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +70 -13
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +239 -47
- package/dist/ui/backend_probe.svelte.d.ts +93 -0
- package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
- package/dist/ui/backend_probe.svelte.js +140 -0
- package/dist/ui/format_scope.d.ts +7 -7
- package/dist/ui/format_scope.d.ts.map +1 -1
- package/dist/ui/format_scope.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
- package/dist/ui/keyed_async_slot.svelte.js +2 -2
- package/dist/ui/popover.svelte.d.ts +18 -19
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +103 -16
- package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +37 -19
- package/dist/ui/ui_format.d.ts +17 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +20 -0
- package/package.json +9 -8
- package/dist/actions/register_ws_endpoint.d.ts +0 -79
- package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
- package/dist/actions/register_ws_endpoint.js +0 -109
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -96
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -141
- package/dist/actions/transports_ws_backend.d.ts.map +0 -1
- package/dist/cli/args.d.ts +0 -55
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -100
- package/dist/cli/config.d.ts +0 -47
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -77
- package/dist/cli/daemon.d.ts.map +0 -1
- package/dist/cli/daemon.js +0 -181
- package/dist/cli/help.d.ts +0 -124
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -215
- package/dist/cli/logger.d.ts +0 -46
- package/dist/cli/logger.d.ts.map +0 -1
- package/dist/cli/logger.js +0 -48
- package/dist/cli/util.d.ts +0 -36
- package/dist/cli/util.d.ts.map +0 -1
- package/dist/cli/util.js +0 -50
- package/dist/realtime/sse_auth_guard.d.ts +0 -197
- package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
- package/dist/realtime/sse_auth_guard.js +0 -239
- package/dist/realtime/subscriber_registry.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.d.ts +0 -29
- package/dist/testing/bootstrap_success.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.js +0 -144
- package/dist/testing/mock_fs.d.ts +0 -20
- package/dist/testing/mock_fs.d.ts.map +0 -1
- package/dist/testing/mock_fs.js +0 -28
- package/dist/testing/standard.d.ts +0 -122
- package/dist/testing/standard.d.ts.map +0 -1
- package/dist/testing/standard.js +0 -73
- package/dist/testing/testing_rate_limiter.d.ts +0 -65
- package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
- package/dist/testing/testing_rate_limiter.js +0 -80
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth middleware stack factory.
|
|
3
3
|
*
|
|
4
|
-
* Creates the standard middleware layers (origin,
|
|
5
|
-
*
|
|
4
|
+
* Creates the standard middleware layers (origin, optional daemon_token,
|
|
5
|
+
* session, request_context, bearer_auth) from configuration.
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
@@ -161,11 +161,16 @@ export interface AuthMiddlewareOptions {
|
|
|
161
161
|
/**
|
|
162
162
|
* Create the auth middleware stack.
|
|
163
163
|
*
|
|
164
|
-
* Returns `[origin, session, request_context, bearer_auth]`
|
|
165
|
-
* the origin check on every path less its carve-outs, the
|
|
166
|
-
* path pattern
|
|
167
|
-
*
|
|
168
|
-
*
|
|
164
|
+
* Returns `[origin, daemon_token?, session, request_context, bearer_auth]`
|
|
165
|
+
* middleware specs: the origin check on every path less its carve-outs, the
|
|
166
|
+
* rest for the given path pattern, with the `daemon_token` layer only when
|
|
167
|
+
* `daemon_token_state` is provided. The credential legs run daemon token →
|
|
168
|
+
* session cookie → bearer, the order of the Rust spine's
|
|
169
|
+
* `resolve_auth_from_headers`: the first that authenticates sets
|
|
170
|
+
* `ResolvedAuth`, and the later ones skip. The first leg composed (the daemon
|
|
171
|
+
* token's, else the session's) clears `ResolvedAuth` on entry, so the chain
|
|
172
|
+
* starts from a clean slate whatever a layer before it set. Apps can append extra entries for
|
|
173
|
+
* non-standard paths (e.g., tx's `/tx` binary endpoint).
|
|
169
174
|
*
|
|
170
175
|
* @param deps - stateless capabilities (keyring, db)
|
|
171
176
|
* @param options - middleware configuration (allowed_origins, session_options, path, daemon_token_state, origin_carve_outs)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,u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e,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACtD,mFAAmF;IACnF,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,OAAO,EACb,SAAS,qBAAqB,KAC5B,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAqF/B,CAAC"}
|
package/dist/auth/middleware.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth middleware stack factory.
|
|
3
3
|
*
|
|
4
|
-
* Creates the standard middleware layers (origin,
|
|
5
|
-
*
|
|
4
|
+
* Creates the standard middleware layers (origin, optional daemon_token,
|
|
5
|
+
* session, request_context, bearer_auth) from configuration.
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
@@ -200,11 +200,16 @@ export const assert_middleware_stack_mounted = (stack_specs, middleware_specs) =
|
|
|
200
200
|
/**
|
|
201
201
|
* Create the auth middleware stack.
|
|
202
202
|
*
|
|
203
|
-
* Returns `[origin, session, request_context, bearer_auth]`
|
|
204
|
-
* the origin check on every path less its carve-outs, the
|
|
205
|
-
* path pattern
|
|
206
|
-
*
|
|
207
|
-
*
|
|
203
|
+
* Returns `[origin, daemon_token?, session, request_context, bearer_auth]`
|
|
204
|
+
* middleware specs: the origin check on every path less its carve-outs, the
|
|
205
|
+
* rest for the given path pattern, with the `daemon_token` layer only when
|
|
206
|
+
* `daemon_token_state` is provided. The credential legs run daemon token →
|
|
207
|
+
* session cookie → bearer, the order of the Rust spine's
|
|
208
|
+
* `resolve_auth_from_headers`: the first that authenticates sets
|
|
209
|
+
* `ResolvedAuth`, and the later ones skip. The first leg composed (the daemon
|
|
210
|
+
* token's, else the session's) clears `ResolvedAuth` on entry, so the chain
|
|
211
|
+
* starts from a clean slate whatever a layer before it set. Apps can append extra entries for
|
|
212
|
+
* non-standard paths (e.g., tx's `/tx` binary endpoint).
|
|
208
213
|
*
|
|
209
214
|
* @param deps - stateless capabilities (keyring, db)
|
|
210
215
|
* @param options - middleware configuration (allowed_origins, session_options, path, daemon_token_state, origin_carve_outs)
|
|
@@ -230,16 +235,38 @@ export const create_auth_middleware_specs = async (deps, options) => {
|
|
|
230
235
|
import('./bearer_auth.js')
|
|
231
236
|
]);
|
|
232
237
|
const session_middleware = create_session_middleware(keyring, session_options);
|
|
233
|
-
|
|
238
|
+
// the first credential leg clears the resolved credential: the daemon
|
|
239
|
+
// token's when it is composed, else this one
|
|
240
|
+
const request_context_middleware = create_request_context_middleware(query_deps, {
|
|
241
|
+
starts_chain: !daemon_token_state,
|
|
242
|
+
log: deps.log
|
|
243
|
+
});
|
|
234
244
|
const bearer_auth_middleware = create_bearer_auth_middleware(query_deps, deps.log);
|
|
245
|
+
const origin_spec = {
|
|
246
|
+
name: 'origin',
|
|
247
|
+
path: ORIGIN_MIDDLEWARE_PATH,
|
|
248
|
+
handler: verify_request_source(allowed_origins, origin_carve_outs),
|
|
249
|
+
errors: { 403: ApiError },
|
|
250
|
+
...(origin_carve_outs.length > 0 && { carve_outs: origin_carve_outs })
|
|
251
|
+
};
|
|
252
|
+
let daemon_token_spec = null;
|
|
253
|
+
if (daemon_token_state) {
|
|
254
|
+
const { create_daemon_token_middleware } = await import('./daemon_token_middleware.js');
|
|
255
|
+
daemon_token_spec = {
|
|
256
|
+
name: 'daemon_token',
|
|
257
|
+
path,
|
|
258
|
+
handler: create_daemon_token_middleware(daemon_token_state, query_deps, deps.log),
|
|
259
|
+
// Soft-fails (discards) on every non-success path — browser context,
|
|
260
|
+
// malformed/invalid token, and no-keeper all `next()` through to the
|
|
261
|
+
// session and bearer legs, then the dispatcher's credential gate
|
|
262
|
+
// (matching the Rust spine's `None`). The layer returns no error
|
|
263
|
+
// response of its own.
|
|
264
|
+
errors: {}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
235
267
|
const specs = [
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
path: ORIGIN_MIDDLEWARE_PATH,
|
|
239
|
-
handler: verify_request_source(allowed_origins, origin_carve_outs),
|
|
240
|
-
errors: { 403: ApiError },
|
|
241
|
-
...(origin_carve_outs.length > 0 && { carve_outs: origin_carve_outs })
|
|
242
|
-
},
|
|
268
|
+
origin_spec,
|
|
269
|
+
...(daemon_token_spec ? [daemon_token_spec] : []),
|
|
243
270
|
{ name: 'session', path, handler: session_middleware },
|
|
244
271
|
{ name: 'request_context', path, handler: request_context_middleware },
|
|
245
272
|
{
|
|
@@ -256,19 +283,5 @@ export const create_auth_middleware_specs = async (deps, options) => {
|
|
|
256
283
|
errors: {}
|
|
257
284
|
}
|
|
258
285
|
];
|
|
259
|
-
if (daemon_token_state) {
|
|
260
|
-
const { create_daemon_token_middleware } = await import('./daemon_token_middleware.js');
|
|
261
|
-
const daemon_token_middleware = create_daemon_token_middleware(daemon_token_state, query_deps, deps.log);
|
|
262
|
-
specs.push({
|
|
263
|
-
name: 'daemon_token',
|
|
264
|
-
path,
|
|
265
|
-
handler: daemon_token_middleware,
|
|
266
|
-
// Soft-fails (discards) on every non-success path — browser context,
|
|
267
|
-
// malformed/invalid token, and no-keeper all `next()` through to the
|
|
268
|
-
// dispatcher's credential gate (matching the Rust spine's `None`). The
|
|
269
|
-
// layer returns no error response of its own.
|
|
270
|
-
errors: {}
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
286
|
return specs;
|
|
274
287
|
};
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* and the new column never lands — a silent, total auth outage. (The
|
|
13
13
|
* `deleted_at` / `deleted_by` soft-delete columns were added to v0's base DDL
|
|
14
14
|
* this way; an older deployed DB never got them and every login broke.) So:
|
|
15
|
-
* never edit, rename, reorder, or re-purpose an entry in `
|
|
15
|
+
* never edit, rename, reorder, or re-purpose an entry in `AUTH_MIGRATIONS`
|
|
16
16
|
* below. Add every additive change as a NEW appended entry using idempotent
|
|
17
17
|
* `ALTER TABLE ... ADD COLUMN IF NOT EXISTS` — a fresh bootstrap and an old
|
|
18
18
|
* deployed DB then converge on the same shape:
|
|
@@ -46,38 +46,10 @@
|
|
|
46
46
|
*
|
|
47
47
|
* @module
|
|
48
48
|
*/
|
|
49
|
-
import
|
|
50
|
-
/** Namespace identifier for fuz_app auth migrations. */
|
|
51
|
-
export declare const AUTH_MIGRATION_NAMESPACE = "fuz_auth";
|
|
49
|
+
import { type MigrationNamespace } from '../db/migrate.js';
|
|
52
50
|
/**
|
|
53
|
-
*
|
|
54
|
-
* `
|
|
55
|
-
* this list — the runtime check rejects matches with a thrown error. Typed
|
|
56
|
-
* as `ReadonlyArray<string>` (not a literal tuple) so `.includes()` accepts
|
|
57
|
-
* any consumer-supplied namespace string without a cast.
|
|
51
|
+
* Pre-composed migration namespace for auth tables — the spine's own (see
|
|
52
|
+
* `create_spine_migration_namespace`).
|
|
58
53
|
*/
|
|
59
|
-
export declare const
|
|
60
|
-
/**
|
|
61
|
-
* Auth schema migrations in order.
|
|
62
|
-
*
|
|
63
|
-
* - v0: Full auth schema — account (with email_verified), actor, role_grant,
|
|
64
|
-
* auth_session, api_token, audit_log (with seq), bootstrap_lock, invite,
|
|
65
|
-
* app_settings, plus all indexes and seeds.
|
|
66
|
-
* - v1: `role_grant_offer` table for consentful grants; adds `scope_id` /
|
|
67
|
-
* `scope_kind` / `source_offer_id` / `revoked_reason` to `role_grant` and
|
|
68
|
-
* swaps the `(actor_id, role)` partial unique index for a scope-aware
|
|
69
|
-
* variant using the index-side `'GLOBAL'` token + all-zeros sentinel
|
|
70
|
-
* UUID. The `(scope_kind, scope_id)` pair is enforced paired-null by
|
|
71
|
-
* `role_grant_scope_kind_paired` / `role_grant_offer_scope_kind_paired` CHECK
|
|
72
|
-
* constraints — both null for global, both non-null for scoped. The
|
|
73
|
-
* `role_grant_offer` table carries a `superseded_at` terminal state; its
|
|
74
|
-
* partial unique index is scoped by
|
|
75
|
-
* `(to_account, role, scope_kind, scope, from_actor)` so multiple
|
|
76
|
-
* grantors may coexist. `scope_kind` is informative-only in v1
|
|
77
|
-
* (registry-membership validation against `create_scope_kind_schema`);
|
|
78
|
-
* v2 may add INSERT-time `(role, scope_kind)` enforcement.
|
|
79
|
-
*/
|
|
80
|
-
export declare const auth_migrations: Array<Migration>;
|
|
81
|
-
/** Pre-composed migration namespace for auth tables. */
|
|
82
|
-
export declare const auth_migration_ns: MigrationNamespace;
|
|
54
|
+
export declare const AUTH_MIGRATION_NS: MigrationNamespace;
|
|
83
55
|
//# sourceMappingURL=migrations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AA+BH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AA+BH,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,kBAAkB,CAAC;AAqO1B;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,kBAG/B,CAAC"}
|
package/dist/auth/migrations.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* and the new column never lands — a silent, total auth outage. (The
|
|
13
13
|
* `deleted_at` / `deleted_by` soft-delete columns were added to v0's base DDL
|
|
14
14
|
* this way; an older deployed DB never got them and every login broke.) So:
|
|
15
|
-
* never edit, rename, reorder, or re-purpose an entry in `
|
|
15
|
+
* never edit, rename, reorder, or re-purpose an entry in `AUTH_MIGRATIONS`
|
|
16
16
|
* below. Add every additive change as a NEW appended entry using idempotent
|
|
17
17
|
* `ALTER TABLE ... ADD COLUMN IF NOT EXISTS` — a fresh bootstrap and an old
|
|
18
18
|
* deployed DB then converge on the same shape:
|
|
@@ -49,16 +49,9 @@
|
|
|
49
49
|
import { ACCOUNT_SCHEMA, ACCOUNT_EMAIL_INDEX, ACCOUNT_USERNAME_CI_INDEX, ACTOR_SCHEMA, ACTOR_INDEX, ACTOR_NAME_LOWER_INDEX, ROLE_GRANT_SCHEMA, ROLE_GRANT_INDEXES, AUTH_SESSION_SCHEMA, AUTH_SESSION_INDEXES, API_TOKEN_SCHEMA, API_TOKEN_INDEX, BOOTSTRAP_LOCK_SCHEMA, BOOTSTRAP_LOCK_SEED, INVITE_SCHEMA, INVITE_INDEXES, APP_SETTINGS_SCHEMA, APP_SETTINGS_SEED } from './auth_ddl.js';
|
|
50
50
|
import { AUDIT_LOG_SCHEMA, AUDIT_LOG_INDEXES } from './audit_log_ddl.js';
|
|
51
51
|
import { ROLE_GRANT_OFFER_SCHEMA, ROLE_GRANT_OFFER_PENDING_UNIQUE_INDEX, ROLE_GRANT_OFFER_INBOX_INDEX, ROLE_GRANT_OFFER_SCOPE_SENTINEL_UUID, ROLE_GRANT_OFFER_SCOPE_KIND_GLOBAL_TOKEN } from './role_grant_offer_ddl.js';
|
|
52
|
+
import { create_spine_migration_namespace } from '../db/migrate.js';
|
|
52
53
|
/** Namespace identifier for fuz_app auth migrations. */
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Migration namespaces reserved by fuz_app. Consumers passing
|
|
56
|
-
* `migration_namespaces` to `create_app_backend` must choose a name not in
|
|
57
|
-
* this list — the runtime check rejects matches with a thrown error. Typed
|
|
58
|
-
* as `ReadonlyArray<string>` (not a literal tuple) so `.includes()` accepts
|
|
59
|
-
* any consumer-supplied namespace string without a cast.
|
|
60
|
-
*/
|
|
61
|
-
export const reserved_migration_namespaces = [AUTH_MIGRATION_NAMESPACE];
|
|
54
|
+
const AUTH_MIGRATION_NAMESPACE = 'fuz_auth';
|
|
62
55
|
/**
|
|
63
56
|
* Auth schema migrations in order.
|
|
64
57
|
*
|
|
@@ -79,7 +72,7 @@ export const reserved_migration_namespaces = [AUTH_MIGRATION_NAMESPACE];
|
|
|
79
72
|
* (registry-membership validation against `create_scope_kind_schema`);
|
|
80
73
|
* v2 may add INSERT-time `(role, scope_kind)` enforcement.
|
|
81
74
|
*/
|
|
82
|
-
|
|
75
|
+
const AUTH_MIGRATIONS = [
|
|
83
76
|
// v0: full auth schema (frozen — never edit this body; see module doc)
|
|
84
77
|
{
|
|
85
78
|
name: 'full_auth_schema',
|
|
@@ -266,8 +259,8 @@ export const auth_migrations = [
|
|
|
266
259
|
}
|
|
267
260
|
}
|
|
268
261
|
];
|
|
269
|
-
/**
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
262
|
+
/**
|
|
263
|
+
* Pre-composed migration namespace for auth tables — the spine's own (see
|
|
264
|
+
* `create_spine_migration_namespace`).
|
|
265
|
+
*/
|
|
266
|
+
export const AUTH_MIGRATION_NS = create_spine_migration_namespace(AUTH_MIGRATION_NAMESPACE, AUTH_MIGRATIONS);
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* 1. **Authentication (middleware)** — `create_request_context_middleware`,
|
|
7
7
|
* `bearer_auth`, and `daemon_token_middleware` validate the credential
|
|
8
|
-
* (session cookie, bearer token
|
|
9
|
-
*
|
|
8
|
+
* (daemon token, session cookie, bearer token — the first that
|
|
9
|
+
* authenticates wins) and set one `ResolvedAuth` on the Hono context
|
|
10
|
+
* (`get_resolved_auth`). They do not resolve
|
|
10
11
|
* an acting actor or load role_grants; `REQUEST_CONTEXT_KEY` stays null at
|
|
11
12
|
* this stage, so account-grain identity is the only thing known.
|
|
12
13
|
* 2. **Authorization (route-spec wrapper / RPC dispatcher)** — after input
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
* schema declared `acting?: ActingActor` (reference equality with the
|
|
15
16
|
* canonical `ActingActor` schema) or the auth requires role_grants
|
|
16
17
|
* (`role` / `keeper`), `apply_authorization_phase` resolves the actor
|
|
17
|
-
* against
|
|
18
|
+
* against the resolved account id plus the validated `acting` value via
|
|
18
19
|
* `resolve_acting_actor`, builds the `{account, actor, role_grants}`
|
|
19
20
|
* context via `build_request_context`, and sets it on
|
|
20
21
|
* `REQUEST_CONTEXT_KEY` before auth guards fire. Authenticated routes
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
* @module
|
|
36
37
|
*/
|
|
37
38
|
import type { Context, MiddlewareHandler } from 'hono';
|
|
39
|
+
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
38
40
|
import { type Account, type Actor, type RoleGrant } from './account_schema.js';
|
|
39
41
|
import type { QueryDeps } from '../db/query_deps.js';
|
|
40
42
|
import type { RouteSpec } from '../http/route_spec.js';
|
|
@@ -46,7 +48,7 @@ import { ERROR_ACTOR_REQUIRED, ERROR_ACTOR_NOT_ON_ACCOUNT, ERROR_NO_ACTORS_ON_AC
|
|
|
46
48
|
* `actor` is null on account-grain routes (no `acting` field on input,
|
|
47
49
|
* no `role` / `keeper` auth) — those handlers don't trigger actor
|
|
48
50
|
* resolution. `role_grants` is empty in that case. Role grant checks
|
|
49
|
-
* (`
|
|
51
|
+
* (`has_scoped_role`, `has_any_scoped_role`) are
|
|
50
52
|
* null-tolerant on `RequestContext | null`; they additionally treat
|
|
51
53
|
* `actor: null` as "no role_grants" so callers don't have to narrow.
|
|
52
54
|
*
|
|
@@ -61,16 +63,6 @@ export interface RequestContext {
|
|
|
61
63
|
}
|
|
62
64
|
/** Hono context variable name for the request context. */
|
|
63
65
|
export declare const REQUEST_CONTEXT_KEY = "request_context";
|
|
64
|
-
/**
|
|
65
|
-
* Hono context variable name for the authenticated session token hash.
|
|
66
|
-
*
|
|
67
|
-
* Set by `create_request_context_middleware` after a successful session lookup.
|
|
68
|
-
* `null` when the request is unauthenticated or authenticated via a non-session
|
|
69
|
-
* credential (bearer token, daemon token). Exposed so handlers can scope
|
|
70
|
-
* per-session resources (e.g., SSE stream identity for targeted disconnection
|
|
71
|
-
* on `session_revoke`) without re-hashing the token.
|
|
72
|
-
*/
|
|
73
|
-
export declare const AUTH_SESSION_TOKEN_HASH_KEY = "auth_session_token_hash";
|
|
74
66
|
/**
|
|
75
67
|
* Get the request context from a Hono context, or `null` if unauthenticated.
|
|
76
68
|
*
|
|
@@ -104,27 +96,6 @@ export declare const require_request_context: (c: Context) => RequestContext;
|
|
|
104
96
|
export interface RequestActorContext extends RequestContext {
|
|
105
97
|
actor: Actor;
|
|
106
98
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Check if a request context has an active role_grant for a given role at
|
|
109
|
-
* **any** scope.
|
|
110
|
-
*
|
|
111
|
-
* Checks the role_grants already loaded in the context (no DB query).
|
|
112
|
-
* Null-tolerant — `null` ctx (unauthenticated) returns `false`. Symmetric
|
|
113
|
-
* with `has_scoped_role` / `has_any_scoped_role` so the three helpers
|
|
114
|
-
* compose freely in the same predicate.
|
|
115
|
-
*
|
|
116
|
-
* Scope-blind, so never the gate for a builtin role (`admin` / `keeper`) or
|
|
117
|
-
* for any capability that isn't itself scoped: a grant bound to one resource
|
|
118
|
-
* would pass it. Those gates read the global grant through
|
|
119
|
-
* `has_scoped_role(ctx, role, null)` (e.g.
|
|
120
|
-
* `has_scoped_role(auth, ROLE_ADMIN, null) || has_scoped_role(auth, role, scope)`).
|
|
121
|
-
*
|
|
122
|
-
* @param ctx - the request context, or `null` for unauthenticated callers
|
|
123
|
-
* @param role - the role to check
|
|
124
|
-
* @param now - current time (defaults to `new Date()`, pass for testability and hot-path efficiency)
|
|
125
|
-
* @returns `true` if the actor has an active role_grant for the role
|
|
126
|
-
*/
|
|
127
|
-
export declare const has_role: (ctx: RequestContext | null, role: string, now?: Date) => boolean;
|
|
128
99
|
/**
|
|
129
100
|
* Whether the request context holds an active role_grant for `role` at `scope_id`.
|
|
130
101
|
*
|
|
@@ -138,8 +109,8 @@ export declare const has_role: (ctx: RequestContext | null, role: string, now?:
|
|
|
138
109
|
* provides.
|
|
139
110
|
*
|
|
140
111
|
* Null-tolerant — `null` ctx (unauthenticated) and account-grain
|
|
141
|
-
* contexts (`actor: null`, empty `role_grants`) both return `false
|
|
142
|
-
*
|
|
112
|
+
* contexts (`actor: null`, empty `role_grants`) both return `false`, which
|
|
113
|
+
* lets the helper drop into public
|
|
143
114
|
* (`{account: 'none', actor: 'none'}`) and account-grain
|
|
144
115
|
* (`{account: 'required', actor: 'none'}`) handlers without a manual
|
|
145
116
|
* narrow. See `cell_authorize` for the resource-side analog.
|
|
@@ -221,37 +192,67 @@ export type ResolveActingActorResult = {
|
|
|
221
192
|
* @param acting_actor_id - the requested acting actor id, or `undefined`
|
|
222
193
|
*/
|
|
223
194
|
export declare const resolve_acting_actor: (deps: QueryDeps, account_id: string, acting_actor_id: string | undefined) => Promise<ResolveActingActorResult>;
|
|
195
|
+
/** Options for `create_request_context_middleware`. */
|
|
196
|
+
export interface RequestContextMiddlewareOptions {
|
|
197
|
+
/**
|
|
198
|
+
* The Hono context key where session middleware stored the session token.
|
|
199
|
+
*
|
|
200
|
+
* @default 'auth_session_id'
|
|
201
|
+
*/
|
|
202
|
+
session_context_key?: string;
|
|
203
|
+
/**
|
|
204
|
+
* Whether this leg starts the credential chain, clearing `RESOLVED_AUTH_KEY`
|
|
205
|
+
* on entry so a layer mounted before the legs cannot pre-set an identity
|
|
206
|
+
* that every leg would skip past. `false` only when an earlier credential
|
|
207
|
+
* leg runs first and clears it itself — `create_auth_middleware_specs`
|
|
208
|
+
* passes `false` when it composes the daemon-token leg.
|
|
209
|
+
*
|
|
210
|
+
* @default true
|
|
211
|
+
*/
|
|
212
|
+
starts_chain?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Debug-logs a start that clears a credential set before it — a hand-built
|
|
215
|
+
* chain that puts this leg behind an earlier credential leg but leaves
|
|
216
|
+
* `starts_chain` at its default.
|
|
217
|
+
*/
|
|
218
|
+
log?: Logger;
|
|
219
|
+
}
|
|
224
220
|
/**
|
|
225
|
-
* Create middleware that authenticates the account from a session cookie
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* `
|
|
229
|
-
* `
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
221
|
+
* Create middleware that authenticates the account from a session cookie —
|
|
222
|
+
* the session leg of the auth middleware chain.
|
|
223
|
+
*
|
|
224
|
+
* When it starts the chain (`starts_chain`, the default) it first clears
|
|
225
|
+
* `RESOLVED_AUTH_KEY`. It then skips when an earlier leg (the daemon token)
|
|
226
|
+
* already resolved the request. Otherwise reads the session identity (set by session middleware), looks up
|
|
227
|
+
* the `auth_session`, and on a valid session sets the `session` arm of
|
|
228
|
+
* `ResolvedAuth` (`RESOLVED_AUTH_KEY`): the account, the session hash, and the
|
|
229
|
+
* credential deadline — the earlier of the cookie's signed expiry
|
|
230
|
+
* (`SESSION_COOKIE_EXPIRES_AT_KEY`) and the row's. Writes nothing to the
|
|
231
|
+
* session row. Does not load actor or role_grants; `REQUEST_CONTEXT_KEY` is
|
|
232
|
+
* left null — the route-spec / RPC dispatcher authorization phase resolves the
|
|
233
|
+
* acting actor and builds the full `RequestContext` when the route needs one.
|
|
234
|
+
*
|
|
235
|
+
* An invalid or missing session leaves the request unresolved and calls
|
|
236
|
+
* `next()` — the bearer leg may still resolve it, and `require_auth` /
|
|
237
|
+
* `require_role` enforce.
|
|
239
238
|
*
|
|
240
239
|
* @param deps - query dependencies (pool-level db for middleware)
|
|
241
|
-
* @param
|
|
242
|
-
* @mutates Hono context -
|
|
240
|
+
* @param options - the session token's context key, whether this leg starts the chain, and the logger for a start that clears a credential
|
|
241
|
+
* @mutates Hono context - resets `REQUEST_CONTEXT_KEY` (and `RESOLVED_AUTH_KEY` when it starts the chain), then on a valid session (and no credential already resolved) sets `RESOLVED_AUTH_KEY`
|
|
243
242
|
*/
|
|
244
|
-
export declare const create_request_context_middleware: (deps: QueryDeps,
|
|
243
|
+
export declare const create_request_context_middleware: (deps: QueryDeps, options?: RequestContextMiddlewareOptions) => MiddlewareHandler;
|
|
245
244
|
/**
|
|
246
|
-
* Refuse a non-RPC surface to a narrowed token — rule 3
|
|
247
|
-
*
|
|
248
|
-
* (`token_scope_surface_denied_response`).
|
|
245
|
+
* Refuse a non-RPC surface to a narrowed token — rule 3. Under the Rust twin's
|
|
246
|
+
* name (`token_scope_surface_denied_response`).
|
|
249
247
|
*
|
|
250
|
-
* The
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
248
|
+
* The decision every token-scope gate outside the action dispatcher shares: a
|
|
249
|
+
* route spec declares `auth.required_scope` and gets `require_token_scope`,
|
|
250
|
+
* which calls this; a consumer gating something that is not a route spec calls
|
|
251
|
+
* it directly.
|
|
252
|
+
*
|
|
253
|
+
* The anonymous caller holds no credential to narrow, so it passes
|
|
254
|
+
* (`resolved_auth_scope` answers `null`). Sharing that branch is the point —
|
|
255
|
+
* hand-rolled per surface it is one `&&` from refusing every anonymous read.
|
|
255
256
|
*
|
|
256
257
|
* Takes the whole capability string, not a bare surface name — one spelling
|
|
257
258
|
* across route-spec declarations and direct calls alike, and the twin of the
|
|
@@ -281,7 +282,7 @@ export declare const token_scope_surface_denial: (c: Context, capability: string
|
|
|
281
282
|
* would enforce nothing — the holder drops the `Authorization` header and
|
|
282
283
|
* reads the anonymous answer anyway — so the narrowed token *is* the
|
|
283
284
|
* anonymous caller there. Read the credential through this on any
|
|
284
|
-
* `reads_credential` route instead of `
|
|
285
|
+
* `reads_credential` route instead of `get_resolved_auth` directly, so the
|
|
285
286
|
* downgrade is one decision rather than an `&&` hand-rolled per handler.
|
|
286
287
|
*
|
|
287
288
|
* The RPC endpoint is the exception: its dispatcher gates each method against
|
|
@@ -303,15 +304,19 @@ export declare const get_public_account_id: (c: Context) => string | null;
|
|
|
303
304
|
* Parses at construction, so a malformed capability is a registration-time
|
|
304
305
|
* throw rather than a guard that mounts and reports nonsense.
|
|
305
306
|
*
|
|
307
|
+
* Only the `surface:<name>` arm is accepted (`is_route_scope_capability`): an
|
|
308
|
+
* `rpc:<method>` capability is the dispatcher's per-method gate, which a route
|
|
309
|
+
* never reaches.
|
|
310
|
+
*
|
|
306
311
|
* @param capability - the capability string this route demands, e.g. `surface:audit_stream`
|
|
307
|
-
* @returns middleware that 403s a
|
|
308
|
-
* @throws Error if `capability` is not a well-formed `
|
|
312
|
+
* @returns middleware that 403s a narrowed token
|
|
313
|
+
* @throws Error if `capability` is not a well-formed `surface:<name>` string
|
|
309
314
|
*/
|
|
310
315
|
export declare const require_token_scope: (capability: string) => MiddlewareHandler;
|
|
311
316
|
/**
|
|
312
317
|
* Middleware that requires authentication.
|
|
313
318
|
*
|
|
314
|
-
* Returns 401 if the auth middleware
|
|
319
|
+
* Returns 401 if the auth middleware resolved no credential.
|
|
315
320
|
*/
|
|
316
321
|
export declare const require_auth: MiddlewareHandler;
|
|
317
322
|
/**
|
|
@@ -327,9 +332,8 @@ export declare const require_auth: MiddlewareHandler;
|
|
|
327
332
|
* **global / unscoped role_grants only**. A scoped role_grant
|
|
328
333
|
* (`{role: 'admin', scope_id: <some uuid>}`) does not unlock route-spec
|
|
329
334
|
* gates that are inherently global. The same scope-aware check is
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* transports agree.
|
|
335
|
+
* run in `actions/perform_action.ts`, the core both the HTTP RPC and WS
|
|
336
|
+
* dispatchers call, so the transports agree.
|
|
333
337
|
*
|
|
334
338
|
* Multi-role disjunction (any-of) lets `auth.roles: ['admin', 'steward']`
|
|
335
339
|
* specs translate to one middleware that admits either role. Single-role
|
|
@@ -346,8 +350,8 @@ export declare const require_role: (roles: ReadonlyArray<string>) => MiddlewareH
|
|
|
346
350
|
* `ERROR_CREDENTIAL_TYPE_REQUIRED` + `required_credential_types` echoing
|
|
347
351
|
* the spec's allowlist when the wire-side credential isn't in it.
|
|
348
352
|
*
|
|
349
|
-
* Reads only
|
|
350
|
-
*
|
|
353
|
+
* Reads only the credential the auth middleware resolved (`get_resolved_auth`)
|
|
354
|
+
* — never the resolved `RequestContext`. That is why
|
|
351
355
|
* `fuz_auth_guard_resolver` mounts it in the `pre_authorization` phase: a
|
|
352
356
|
* wrong channel is refused before the route resolves an actor for it, so the
|
|
353
357
|
* denial costs no DB work and discloses no account state.
|
|
@@ -501,6 +505,32 @@ export type AuthorizationResult = {
|
|
|
501
505
|
* resolve).
|
|
502
506
|
*/
|
|
503
507
|
export declare const apply_authorization_phase: (deps: QueryDeps, account_id: string | null, auth: RouteAuth, acting_value: string | undefined) => Promise<AuthorizationResult>;
|
|
508
|
+
/**
|
|
509
|
+
* Run the authorization phase on a Hono request: resolve the acting actor from
|
|
510
|
+
* `acting` against the authenticated account, and set the resulting
|
|
511
|
+
* `RequestContext` on `REQUEST_CONTEXT_KEY` for the post-authorization guards
|
|
512
|
+
* (`require_role`, `require_credential_types`) and the handler.
|
|
513
|
+
*
|
|
514
|
+
* The phase every Hono-mounted surface shares — the route-spec handler
|
|
515
|
+
* (`create_fuz_authorization_handler`) and the WebSocket upgrade
|
|
516
|
+
* (`register_action_ws`, which reads `acting` off the query string). The HTTP
|
|
517
|
+
* RPC and WS dispatchers consume `apply_authorization_phase` per action
|
|
518
|
+
* directly instead.
|
|
519
|
+
*
|
|
520
|
+
* Skipped for a public `auth` shape, and under the test-preset escape hatch:
|
|
521
|
+
* harnesses that pre-populate `REQUEST_CONTEXT_KEY` flag
|
|
522
|
+
* `TEST_CONTEXT_PRESET_KEY = true` so the phase trusts the supplied context
|
|
523
|
+
* instead of running DB-backed resolution. Production middleware never sets
|
|
524
|
+
* that flag.
|
|
525
|
+
*
|
|
526
|
+
* @param c - the request context, after the pre-authorization guards
|
|
527
|
+
* @param deps - query deps for actor resolution
|
|
528
|
+
* @param auth - the route's auth shape
|
|
529
|
+
* @param acting - the `acting` selector, already through `parse_acting`; `undefined` when absent
|
|
530
|
+
* @returns the refusal to answer (`400` actor selection, `500` a vanished
|
|
531
|
+
* account), or nothing when the request may proceed
|
|
532
|
+
*/
|
|
533
|
+
export declare const run_authorization_phase: (c: Context, deps: QueryDeps, auth: RouteAuth, acting: string | undefined) => Promise<Response | void>;
|
|
504
534
|
/**
|
|
505
535
|
* Create the route-spec authorization handler used by `apply_route_specs`.
|
|
506
536
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_context.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/request_context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"request_context.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/request_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,SAAS,EACd,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAarD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAIN,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CA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