Skip to main content

Module validate

Module validate 

Source
Expand description

Shared v1 frame-envelope validation (#376).

Client and broker validate the same four Frame envelope fields in the same order before touching a payload: envelope_version, kind, payload_protocol, payload_encoding. This module centralizes that check once; each call site keeps its own error type by mapping the neutral FrameValidationError onto its existing errors, so observable behavior (error variants, refusal codes, message strings) is unchanged.

The expected frame kind and payload protocol differ per call site (client expects RESPONSE frames, the broker Hello path expects REQUEST, the handoff relay expects EVENT), so both are explicit parameters rather than baked-in defaults.

Enums§

FrameValidationError
Neutral envelope-validation failure.

Functions§

validate_frame_envelope
Validate the four v1 envelope fields shared by every framed exchange.