Expand description
The shared durable envelope codec: probe, validation rules, JSON codec, and the one error vocabulary every family reports through.
Published so a durable format outside this crate — a first-party extension’s own objects — parameterizes the same codec instead of copying it and drifting from the rules in section 4 of the format spec.
Structs§
- Decoded
Json Envelope - A decoded JSON-bodied envelope’s shared fields plus its parsed payload.
- Envelope
Probe - Identifying prefix of a durable envelope document.
Enums§
- Envelope
Codec Error - Failure vocabulary shared by every envelope codec. Messages are envelope-generic; the wrapping error names the object (and its key) the bytes came from.
Functions§
- decode_
json_ envelope - Decodes one JSON-bodied envelope: probe first (kind through
classify_kind, then version), then the checksum over the stored payload fragment, then the payload itself. - decode_
strict_ json_ envelope - Immutable envelope families tolerate unknown fields, while mutable control-object envelopes reject them. A tolerant read followed by rewrite would erase fields the current binary does not understand.
- encode_
json_ envelope - Encodes one JSON-bodied envelope, validating that the recorded version is
what this build writes for
kindand that the recorded checksum still matches the payload. - json_
payload_ checksum - The
sha256:<hex>checksum a JSON payload will carry, computed over its canonical serialization. - verify_
checksum_ fresh - Requires an in-memory envelope’s recorded checksum to still match its payload before encoding — a stale checksum means the caller mutated the payload without rebuilding the envelope.
- verify_
kind - Requires the probed kind to be exactly
expected. - verify_
payload_ checksum - Requires the stored checksum to match the payload bytes as stored.
- verify_
version - Requires the probed format version to be exactly what this build writes
for
kind— no envelope family tolerates version skew.