Skip to main content

message_handler

Function message_handler 

Source
pub async fn message_handler(
    __arg0: State<Arc<NodeState>>,
    __arg1: Path<(String, String)>,
    headers: HeaderMap,
) -> impl IntoResponse
Expand description

Axum handler for GET /scp/broadcast/<routing_id>/messages/<blob_id>.

Retrieves a single stored blob, deserializes it as a BroadcastEnvelope, decrypts it with the epoch-matched broadcast key, and returns the result as a JSON FeedMessage.

§Headers

  • Cache-Control: public, immutable, max-age=31536000 — broadcast messages are content-addressed and never change.
  • ETag: "<blob_id_hex>" — enables conditional GET.

§Conditional GET

If the client sends If-None-Match: "<blob_id_hex>", the server returns 304 Not Modified with no body, saving bandwidth for repeated fetches of the same message.

§Errors

  • 400 — Invalid hex in routing_id or blob_id path segment.
  • 404 — Unknown routing ID (no projected context registered) or unknown blob ID (not in storage or routing ID mismatch).
  • 410 — Content revoked (epoch key purged after a Full-scope governance ban).
  • 500 — Decryption failure (corrupt envelope or AEAD open failure).

See spec section 18.11.4.