pub trait SealProtocol<Seal> {
    type Witness;
    type Message;
    type PublicationId;
    type Error: Error;

    // Required method
    fn get_seal_status(&self, seal: &Seal) -> Result<SealStatus, Self::Error>;

    // Provided methods
    fn publish_witness(
        &mut self,
        _witness: &Self::Witness
    ) -> Result<Self::PublicationId, SealMediumError<Self::Error>> { ... }
    fn get_witness_publication_id(
        &self,
        _witness: &Self::Witness
    ) -> Result<Option<Self::PublicationId>, SealMediumError<Self::Error>> { ... }
    fn validate_publication_id(
        &self,
        _publication_id: &Self::PublicationId
    ) -> Result<bool, SealMediumError<Self::Error>> { ... }
}
Expand description

Trait for proof-of-publication medium on which the seals are defined, closed, verified and which can be used for convenience operations related to seals:

  • finding out the seal status
  • publishing witness information
  • get some identifier on the exact place of the witness publication
  • check validity of the witness publication identifier

Since the medium may require network communications or extensive computing involved (like in case with blockchain) there is a special asynchronous version of the seal medium SealProtocolAsync, which requires use of async feature of this crate.

All these operations are medium-specific; for the same single-use-seal type they may differ when are applied to different proof of publication mediums.

To read more on proof-of-publication please check https://petertodd.org/2014/setting-the-record-proof-of-publication

Required Associated Types§

source

type Witness

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

source

type Message

Message type that is supported by the current single-use-seal

source

type PublicationId

Publication id that may be used for referencing publication of witness data in the medium. By default set (), so SealProtocol may not implement publication id and related functions

source

type Error: Error

Error type that contains reasons of medium access failure

Required Methods§

source

fn get_seal_status(&self, seal: &Seal) -> Result<SealStatus, Self::Error>

Checks the status for a given seal in proof-of-publication medium

Provided Methods§

source

fn publish_witness( &mut self, _witness: &Self::Witness ) -> Result<Self::PublicationId, SealMediumError<Self::Error>>

Publishes witness data to the medium. Function has default implementation doing nothing and returning SealMediumError::PublicationNotSupported error.

source

fn get_witness_publication_id( &self, _witness: &Self::Witness ) -> Result<Option<Self::PublicationId>, SealMediumError<Self::Error>>

Returns Self::PublicationId for a given witness, if any; the id is returned as an option. Function has default implementation doing nothing and just returning SealMediumError::PublicationNotSupported error.

source

fn validate_publication_id( &self, _publication_id: &Self::PublicationId ) -> Result<bool, SealMediumError<Self::Error>>

Validates whether a given publication id is present in the medium. Function has default implementation doing nothing and returning SealMediumError::PublicationNotSupported error.

Implementors§