Skip to main content

Module sealed

Module sealed 

Source
Expand description

Sealed envelopes (spec §10.1): end-to-end confidentiality through relays.

seal takes an inner envelope and produces an outer envelope whose body is Body::Sealed: the inner envelope’s msgpack encoding, encrypted with ChaCha20-Poly1305 under a key derived via X25519 ECDH(sender_secret, recipient_public) + HKDF-ish salt. open reverses it.

Functions§

derive_session_key
§10.2: Derive a session-specific symmetric key from a root secret. Used to derive ephemeral keys for specific message streams (e.g. per agent-pair, per task-id) without re-running the full ECDH handshake for every message (reduces CPU overhead and exposure). root_secret must be the 32-byte ECDH shared secret. session_id is an opaque string distinguishing the channel (e.g. “agent-a-to-b-task-123”).
open
Open a sealed envelope. recipient_secret must pair with the sender public key embedded in the Sealed body.
seal
Seal inner so only the holder of recipient_secret’s counterpart public key can open it. The outer envelope keeps routing metadata (from/to/performative=inform) but the payload is opaque in transit.