Skip to main content

Module emergency

Module emergency 

Source
Expand description

Phase 1.4 emergency kill-switch HTTP surface.

This module is intentionally substrate-agnostic – chio-http-core does not embed an HTTP server. It exposes:

  • Route constants used by every substrate adapter (chio-tower, chio-api-protect, hosted sidecars).
  • Request/response DTOs that serialize into the wire shapes documented in STRUCTURAL-SECURITY-FIXES.md section 5.4.
  • Pure handler functions that take parsed inputs and return a structured response. Each substrate adapter calls the handler from its own framework route, preserving framework-native streaming, tracing, and error-mapping behavior.

Authentication: the handlers require an X-Admin-Token header whose value matches the string configured on EmergencyAdmin. No new middleware layer is introduced. Adapters that already have their own auth middleware can either pass the caller’s bearer token through as the admin token (when configured that way) or short-circuit the expected_admin_token check.

Re-exports§

pub use crate::routes::EMERGENCY_ADMIN_TOKEN_HEADER as ADMIN_TOKEN_HEADER;
pub use crate::routes::EMERGENCY_RESUME_PATH as RESUME_PATH;
pub use crate::routes::EMERGENCY_STATUS_PATH as STATUS_PATH;
pub use crate::routes::EMERGENCY_STOP_PATH as STOP_PATH;

Structs§

EmergencyAdmin
Admin handle bound to a kernel and a configured admin token.
EmergencyResumeResponse
Wire response for POST /emergency-resume.
EmergencyStatusResponse
Wire response for GET /emergency-status.
EmergencyStopRequest
Canonical JSON body for POST /emergency-stop.
EmergencyStopResponse
Wire response for POST /emergency-stop.

Enums§

EmergencyHandlerError
Errors returned by the emergency handlers. Each variant maps cleanly onto an HTTP status code via EmergencyHandlerError::status.

Functions§

handle_emergency_resume
Handler for POST /emergency-resume.
handle_emergency_status
Handler for GET /emergency-status.
handle_emergency_stop
Handler for POST /emergency-stop.