Expand description
Wire decoders and the VerificationReceipt codec pair (SPEC §17.5, §5.1).
Decoders are strict: unknown fields are rejected (serde deny_unknown_fields
on the wire types), the wire-integer domain and canonical base64 are
enforced by the field (de)serializers, and the input bounds of SPEC §5.1 are
enforced here — decode_proof_bundle rejects an oversized payload BEFORE
parsing, and JSON container nesting beyond MAX_JSON_NESTING_DEPTH is
rejected up front. Violations are structural failures — callers surface them
as the existing invalid status.
JSON parsing (and therefore the decode_* functions) requires serde_json
and is only available with the std feature. encode_verification_receipt
and check_json_nesting_depth are no_std-compatible.
Functions§
- check_
cert_ bounds - Enforce the per-cert count and length limits of SPEC §5.1 during decode.
Does NOT enforce issuance hygiene (
validate_resource_constraints) — decoders accept what issuance rejects; verification fails unsatisfiable sets closed. - check_
json_ nesting_ depth - Reject JSON whose container nesting exceeds
MAX_JSON_NESTING_DEPTH, scanning the raw bytes with string-literal awareness so brackets inside strings do not count. Mirrors the depth rule of Go’sCheckWireJSON. - check_
receipt_ structure - Enforce the structural invariants of a wire
VerificationReceipt(SPEC §17.5) — shared by the encoder and decoder so the codec pair never emits a document its counterpart rejects. - decode_
delegation_ cert - Parse canonical wire JSON into a
DelegationCertunder strict wire acceptance and the SPEC §5.1 input bounds. - decode_
proof_ bundle - Parse canonical wire JSON into a
crate::types::ProofBundleunder strict wire acceptance and the SPEC §5.1 input bounds. The [MAX_PROOF_BUNDLE_BYTES] check runs BEFORE any parsing: an oversized payload is rejected without being parsed at all. - decode_
verification_ receipt - Parse canonical wire JSON into a
VerificationReceiptunder strict wire acceptance and the same structural invariants the encoder enforces (hash and key-component lengths, known decision, protocol version). Signature verification is the caller’s job viaverify_verification_receipt. - encode_
verification_ receipt - Marshal a
VerificationReceiptinto its canonical wire JSON (SPEC §17.5): lex-sorted keys, byte fields as base64-standard strings, optional fields omitted when empty. A structurally invalid receipt is an error, never emitted: the codec pair never produces a document its own decoder rejects.