#[non_exhaustive]pub struct KeyDocument {
pub keys: KeyDoc,
pub declarations: Option<Declarations>,
}Expand description
A host’s key document (9.2) with its declarations (spec-0.4.3), checked: the keys as a
KeyDoc, and the declarations the publisher made for its own functions, which licence
inheritance (8.5, crate::inherit_licence) and the entitlement check (10.3,
crate::check_entitlement) read. Verification (10.1) reads the keys only: a document with
declarations verifies every receipt exactly as the same document without them.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.keys: KeyDocThe host and its keys.
declarations: Option<Declarations>The declarations; None when the document has none (an empty declarations is not a
valid document, so Some is never empty).
Implementations§
Source§impl KeyDocument
impl KeyDocument
Sourcepub fn from_json(host: &str, body: &[u8]) -> Result<KeyDocument>
pub fn from_json(host: &str, body: &[u8]) -> Result<KeyDocument>
Parses and checks a key document fetched from host, declarations included (9.2).
Every failure is E_KEY_DOC: anything malformed in the declarations rejects the whole
document, as a malformed key does.
Sourcepub fn new(
keys: KeyDoc,
declarations: Option<Declarations>,
) -> Result<KeyDocument>
pub fn new( keys: KeyDoc, declarations: Option<Declarations>, ) -> Result<KeyDocument>
A key document from its parts, for a publisher writing its own: declarations, when
given, must be non-empty and name only functions under keys.host (E_KEY_DOC).