[][src]Trait lnpbp::single_use_seals::SealMedium

pub trait SealMedium<'a, SEAL> where
    SEAL: SingleUseSeal
{ type PublicationId; type Error: Error; fn define_seal(
        &'a self,
        definition: &SEAL::Definition
    ) -> Result<SEAL, Self::Error>;
fn get_seal_status(&self, seal: &SEAL) -> Result<SealStatus, Self::Error>; fn publish_witness(
        &mut self,
        _witness: &SEAL::Witness
    ) -> Result<Self::PublicationId, SealMediumError<Self::Error>> { ... }
fn get_witness_publication_id(
        &self,
        _witness: &SEAL::Witness
    ) -> Result<Option<Self::PublicationId>, SealMediumError<Self::Error>> { ... }
fn validate_publication_id(
        &self,
        _publication_id: &Self::PublicationId
    ) -> Result<bool, SealMediumError<Self::Error>> { ... } }

Trait for proof-of-publication medium on which the seals are defined 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 SealMedium [AsyncSealMedium], 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

Associated Types

type PublicationId

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

type Error: Error

Error type that contains reasons of medium access failure

Loading content...

Required methods

fn define_seal(
    &'a self,
    definition: &SEAL::Definition
) -> Result<SEAL, Self::Error>

Creates a single-use-seal having type of implementation-specific generic parameter SEAL.

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

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

Loading content...

Provided methods

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

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

fn get_witness_publication_id(
    &self,
    _witness: &SEAL::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::PublicationIdNotSupported error.

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::PublicationIdNotSupported error.

Loading content...

Implementors

impl<'a, TXGRAPH> SealMedium<'a, TxoutSeal<'a, TXGRAPH>> for TXGRAPH where
    TXGRAPH: TxGraph + TxResolve
[src]

type PublicationId = ShortId

type Error = Error

Loading content...