Trait flexible_transcript::Transcript

source ·
pub trait Transcript: Send + Clone {
    type Challenge: Send + Sync + Clone + AsRef<[u8]>;

    // Required methods
    fn new(name: &'static [u8]) -> Self;
    fn domain_separate(&mut self, label: &'static [u8]);
    fn append_message<M: AsRef<[u8]>>(
        &mut self,
        label: &'static [u8],
        message: M,
    );
    fn challenge(&mut self, label: &'static [u8]) -> Self::Challenge;
    fn rng_seed(&mut self, label: &'static [u8]) -> [u8; 32];
}
Expand description

A transcript trait valid over a variety of transcript formats.

Required Associated Types§

Required Methods§

source

fn new(name: &'static [u8]) -> Self

Create a new transcript with the specified name.

source

fn domain_separate(&mut self, label: &'static [u8])

Apply a domain separator to the transcript.

source

fn append_message<M: AsRef<[u8]>>(&mut self, label: &'static [u8], message: M)

Append a message to the transcript.

source

fn challenge(&mut self, label: &'static [u8]) -> Self::Challenge

Produce a challenge.

Implementors MUST update the transcript as it does so, preventing the same challenge from being generated multiple times.

source

fn rng_seed(&mut self, label: &'static [u8]) -> [u8; 32]

Produce a RNG seed.

Helper function for parties needing to generate random data from an agreed upon state.

Implementors MAY internally call the challenge function for the needed bytes, and accordingly produce a transcript conflict between two transcripts, one which called challenge(label) and one which called rng_seed(label) at the same point.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Transcript for MerlinTranscript

Available on crate feature merlin only.
§

type Challenge = [u8; 64]

source§

impl<D: Send + Clone + SecureDigest> Transcript for DigestTranscript<D>

§

type Challenge = GenericArray<u8, <D as OutputSizeUser>::OutputSize>