Trait single_use_seals::SingleUseSeal[][src]

pub trait SingleUseSeal {
    type Witness;
    type Definition;
    type Error: Error;
    fn close(
        &self,
        over: impl AsRef<[u8]>
    ) -> Result<Self::Witness, Self::Error>;
fn verify(
        &self,
        msg: impl AsRef<[u8]>,
        witness: &Self::Witness,
        medium: &impl SealMedium<Self>
    ) -> Result<bool, Self::Error>
    where
        Self: Sized
; }
Expand description

Single-use-seal trait: implement for a data structure that will hold a single-use-seal definition and will contain a business logic for closing seal over some message and verification of the seal against the message and witness.

NB: It is recommended that single-use-seal instances to be instantiated not by a constructor, but by a factory, i.e. “seal medium”: data type implementing either SealMedium or AsyncSealMedium traits.

Associated Types

Associated type for the witness produced by the single-use-seal close procedure

Type that contains seal definition

Closing and verification errors

Required methods

Closes seal over a message, producing witness

NB: Closing of the seal MUST not change the internal state of the seal itself; all the data produced by the process must be placed into the returned Witness type

Verifies that the seal was indeed closed over the message on the specific seal medium (see SealMedium)

Implementors