Expand description
Reading and checking a vCon: which form it is in, whether it is
gzipped, its uuid, and whether it needs extensions the caller does not
support. inspect does no I/O and returns no bytes.
Inspection, Limits and Rejection are #[non_exhaustive], so
a later release can add a field or a refusal without breaking a caller.
A caller reads an Inspection but does not build one:
ⓘ
let found = vcon::read::Inspection {
form: vcon::Form::Unsigned,
gzip: false,
uuid: "01a07da8-c2bb-83e5-b9a2-279e0d16bc46".parse().unwrap(),
};makes Limits with Limits::new:
ⓘ
let limits = vcon::read::Limits { inflated: 1 << 20 };and, matching a Rejection, has an arm for refusals it does not name:
ⓘ
fn named(r: &vcon::read::Rejection) -> &'static str {
use vcon::read::Rejection::*;
match r {
TooLarge => "too-large", TooDeep => "too-deep", BadGzip => "bad-gzip",
NotJson => "not-json", DuplicateKey => "duplicate", AmbiguousForm => "ambiguous",
NoForm => "no-form", MissingUuid => "missing-uuid", BadUuid => "bad-uuid",
MissingCreatedAt => "missing-created-at", BadPayload => "bad-payload",
UuidMismatch => "uuid-mismatch", BadCritical => "bad-critical",
UnsupportedCritical(_) => "unsupported",
}
}Structs§
- Fields
- The members of a vCon that an export may copy into clear columns, read
from an unsigned vCon or from the vCon inside a signed one. A member
that is missing, or not of the type the vCon core draft gives it, is
None. - Inspection
- What a received vCon is.
- Limits
- Bounds on the work one inspection may do.
- Party
- The members of one party that
Fieldscopies.
Enums§
- Rejection
- Why a received body cannot be stored as a vCon.
Constants§
- MAX_
JSON_ DEPTH - The most arrays and objects open at once in any one JSON text read: the
body, a signed payload, the vCon itself counting as one. More is refused
as
Rejection::TooDeep. It is below the JSON parser’s own bound of 127, so too deep is told apart from not JSON. - MAX_
SIGNED_ LAYERS - The most signed (JWS) layers a body may have, counting from the body to
the unsigned vCon: one for a vCon signed once. A layer is added each time
a signed vCon is signed again, as the vCon core draft describes for
archives kept longer than their signing certificates; 64 allows one a
year for 63 years. More is refused as
Rejection::TooDeepbefore the next layer is read.
Functions§
- fields
- Reads the
Fieldsofbody, a vConinspecthas accepted, within the samelimits. An encrypted vCon givesNone: nothing in it can be read without its key. - inspect
- Reads
bodywithout changing it.content_typeis the media type it arrived with, if any, andsupportedthe extension names this server accepts incritical. An encrypted vCon’scriticalcannot be read and is not checked.