Skip to main content

Module iroh_rpc

Module iroh_rpc 

Source
Expand description

Iroh RPC plane — server-side protocol handler for ALPN hyprstream-rpc/1.

Part of Epic #131 Phase 2 (#133). This module ships:

Trust model: The protocol handler does not parse SignedEnvelope — it forwards opaque bytes to the IrohRequestProcessor. Envelope verification, JWT/DPoP, and authorize_signer enforcement happen inside the processor (which is LocalServiceBridge in production, delegating to crate::service::dispatch::process_request). The handler does hold a signing key for trusted-local transport-only processor failures. Admission failures on the untrusted iroh carrier are reset/dropped without a signed response, preventing an unauthenticated signing oracle.

Wire framing: each request is the opaque bytes of a Cap’n Proto-encoded crate::envelope::SignedEnvelope written to a freshly-opened iroh bidi stream. The response is symmetric. Both endpoints are our code; iroh’s QUIC TLS authenticates the addressed NodeId only at the carrier layer; the request envelope independently supplies application identity proof.

Re-exports§

pub use super::rpc_session::build_error_envelope;
pub use super::rpc_session::from_fn;
pub use super::rpc_session::read_to_cap;
pub use super::rpc_session::serve_rpc_connection;
pub use super::rpc_session::IrohRequestProcessor;
pub use super::rpc_session::DEFAULT_STREAM_LIMIT;
pub use super::rpc_session::MAX_FRAME_BYTES;

Structs§

IrohRpcProtocolHandler
Iroh protocol handler that terminates hyprstream-rpc/1 bidi streams, dispatches each request through the wrapped IrohRequestProcessor, caps concurrent streams server-wide (shared semaphore), and drains in-flight requests on ProtocolHandler::shutdown (called by Router::shutdown).
LocalServiceBridge
Adapt a crate::service::RequestService to IrohRequestProcessor.

Enums§

BridgeShutdownError
Stable terminal outcome shared by all explicit shutdown waiters.

Functions§

client_request
Client-side helper: open a bidi stream on hyprstream-rpc/1 against an already-connected iroh [Connection], write the request, read the response.