Skip to main content

apply_incoming_envelope

Function apply_incoming_envelope 

Source
pub fn apply_incoming_envelope(
    storage_root: &Path,
    session_id: &str,
    envelope: &RelayEnvelope,
) -> Result<bool, ChatError>
Expand description

Apply an inbound RelayEnvelope to a session, regardless of the transport it arrived on.

This is the transport-agnostic ingest path shared by the HTTP relay and the SocialWebNet mesh (chat_mesh): it deduplicates by (lamport, author_did), validates agent messages, and appends the message. Returns true if the message was newly applied, false if it was a duplicate or our own echo. Envelope signature verification is the caller’s/session policy’s concern, exactly as for the relay pull path.