pub struct CeremonyRandom { /* private fields */ }Expand description
The per-ceremony entropy source.
Owns the running epoch seed, the epoch index, and the set of paths already
issued. Held by the Reporter, which records a fact for
every gather and every draw so the source can be reconstructed from the
transcript.
The issued-paths set is internal runtime state only, never serialized; it
exists so a repeated (step, purpose) is rejected rather than silently
reusing a value.
Implementations§
Source§impl CeremonyRandom
impl CeremonyRandom
Sourcepub fn from_machine_seed(m: &[u8]) -> Self
pub fn from_machine_seed(m: &[u8]) -> Self
Build a source from gathered machine entropy m (epoch 0).
Sourcepub fn fold(&mut self, contribution: &[u8])
pub fn fold(&mut self, contribution: &[u8])
Fold a human contribution into the seed, advancing the epoch.
Sourcepub fn draw(&mut self, step: &StepId, purpose: &str, len: usize) -> Option<Draw>
pub fn draw(&mut self, step: &StepId, purpose: &str, len: usize) -> Option<Draw>
Draw len bytes for (step, purpose).
A purpose is drawn at most once per step. Returns None if this
(step, purpose) was already drawn, since deriving it again would reuse
the value; the caller turns that into a hard error. On success returns
the value together with its derivation path so the caller can record
both in the transcript.