Expand description
Tower middleware for Chio capability validation and receipt signing.
Provides a tower::Layer that wraps any HTTP service with Chio evaluation:
extracting caller identity, evaluating requests against the Chio kernel,
and attaching signed receipts to responses.
Works with replayable Tower request body types, including Axum’s
axum::body::Body and bytes-backed HTTP bodies used in generic Tower/HTTP2
tests. Real tonic::body::Body replay remains a follow-on concern and is
not claimed as fully covered by the current middleware contract.
§Example with Tower service
use chio_tower::ChioLayer;
use chio_core_types::crypto::Keypair;
use tower::Layer;
let keypair = Keypair::generate();
let layer = ChioLayer::new(keypair, "policy-hash-abc".to_string());
// Wrap any tower Service with Chio evaluation.
let inner = tower::service_fn(|_req: http::Request<http_body_util::Full<bytes::Bytes>>| async {
Ok::<_, Box<dyn std::error::Error + Send + Sync>>(http::Response::new(()))
});
let _service = layer.layer(inner);Structs§
- Chio
Evaluator - Chio request evaluator. Holds the shared HTTP authority and tower-specific hooks.
- Chio
Layer - Tower
Layerthat wraps inner services with Chio evaluation. - Chio
Service - Tower
Servicethat evaluates HTTP requests against the Chio kernel. - Evaluation
Result - Result of evaluating an HTTP request.
- Kernel
Request - Request accepted by
KernelService. - Kernel
Service - Tower service that dispatches tool-call requests through a shared kernel.
- Kernel
Trace Layer - Trace layer for kernel service calls.
- Kernel
Trace Service - Trace service emitted by
KernelTraceLayer. - Tenant
Concurrency Limit Layer - Per-tenant concurrency limiter for kernel requests.
- Tenant
Concurrency Limit Service - Service emitted by
TenantConcurrencyLimitLayer.
Enums§
- Chio
Tower Error - Error type for Chio tower middleware operations.
- Kernel
Service Error - Errors returned by the kernel service stack.
Constants§
- DEFAULT_
MAX_ BODY_ BYTES - Default upper bound on buffered request body size (8 MiB).
- HOST_
CALL_ FETCH_ BLOB - HOST_
CALL_ GET_ CONFIG - HOST_
CALL_ GET_ TIME_ UNIX_ SECS - HOST_
CALL_ LOG - HOST_
CALL_ METRIC_ LABEL_ VALUES
Functions§
- build_
layered - Build the layered kernel service stack.
- extract_
identity - Extract caller identity from HTTP headers.
- normalize_
host_ call_ metric_ label
Type Aliases§
- Identity
Extractor - Function that extracts caller identity from HTTP request headers.
- Kernel
Response - Response produced by
KernelService. - Tenant
Id - Tenant identifier carried for tower-side admission layers.