Skip to main content

SignatureItemParseable

Trait SignatureItemParseable 

Source
pub trait SignatureItemParseable: Sized {
    type HashAccu;

    // Required method
    fn from_unparsed_and_body(
        item: UnparsedItem<'_>,
        hash_inputs: &SignatureHashInputs<'_>,
        hash: &mut Self::HashAccu,
    ) -> Result<Self, ErrorProblem>;
}
Expand description

A signature item that can appear in a netdoc

This is the type T of a field item: T in a netdoc signatures section type.

Types that implement this embody both:

  • The item, parameters, and signature data, provided in the document.

They do not embody:

  • The hash of the document body, which will needed during verification.

However, the hash is calculated by from_unparsed_and_body, during parsing, and stored in hash.

Typically derived with #[derive_deftly(ItemValueParseable)].

Normal (non-signature) items implement ItemValueParseable.

Required Associated Types§

Source

type HashAccu

The Rust type of the hash value accumulator for this item.

Often this will be Option<H> where H is the actual hash value.

This specific item’s HashAccu will be found via the document’s signatures’ NetdocParseableSignatures::HashesAccu, which must impl AsMut<SignatureItemParseable::HashAccu>.

Required Methods§

Source

fn from_unparsed_and_body( item: UnparsedItem<'_>, hash_inputs: &SignatureHashInputs<'_>, hash: &mut Self::HashAccu, ) -> Result<Self, ErrorProblem>

Parse the item’s value, and also calculate the relevant document hash

If the document hash needed for this item is not already present in hash, this function must store it there. An existing hash should not be overwritten: this is because multiple signature items of the same type and hash are supposed to be as multiple signatures on the same base document, not cumulative signatures where each signer signs the previous signatures.

(Parsing is entangled with hashing because some items have the hash algorithm as an argument, and we don’t want to parse that twice.)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§