pub async fn process_request<S>(
raw_bytes: &[u8],
service: &S,
verification: EnvelopeVerification<'_>,
signing_key: &SigningKey,
nonce_cache: &InMemoryNonceCache,
carrier: CarrierContext,
) -> Result<Vec<u8>>where
S: RequestService,Expand description
Process a request through the full envelope verification pipeline.
Unified handler for all transport front-ends. The only difference between
them is envelope signer verification, controlled by verification.
§Pipeline
- Unwrap
SignedEnvelopeand verify the signature (mode-dependent), under the process-global verify policy + kid-anchored PQ trust store. - Verify JWT claims (
sub,exp,aud,scope, downgrade protection). - Dispatch to
service.handle_request()with a verifiedEnvelopeContext. - Sign the response with the server’s
signing_key.
§Streaming
A streaming handler returns a Continuation (the server-side streaming
response that runs after the reply). As of #186 that task is spawned
here, via crate::streaming::spawn_streaming_response, rather than
handed back to the transport front-end — so every front-end (ZMQ
RequestLoop, WebTransport server, generic-plane LocalServiceBridge) is
uniform “bytes in → bytes out” and the generic plane no longer has to spawn
(or, worse, reject) continuations itself. Invariant: process_request
must therefore run on a tokio::task::LocalSet (it already did —
RequestService is ?Send); the spawned task is ?Send.
§Returns
Ok(response_bytes)- Signed response. Any streaming pump has already been spawned onto the currentLocalSet.Err(e)- Processing error (already logged)