Trait modular_frost::algorithm::Algorithm
source · pub trait Algorithm<C: Curve>: Send + Sync + Clone {
type Transcript: Sync + Clone + Debug + Transcript;
type Addendum: Addendum;
type Signature: Clone + PartialEq + Debug;
// Required methods
fn transcript(&mut self) -> &mut Self::Transcript;
fn nonces(&self) -> Vec<Vec<C::G>>;
fn preprocess_addendum<R: RngCore + CryptoRng>(
&mut self,
rng: &mut R,
keys: &ThresholdKeys<C>,
) -> Self::Addendum;
fn read_addendum<R: Read>(&self, reader: &mut R) -> Result<Self::Addendum>;
fn process_addendum(
&mut self,
params: &ThresholdView<C>,
l: Participant,
reader: Self::Addendum,
) -> Result<(), FrostError>;
fn sign_share(
&mut self,
params: &ThresholdView<C>,
nonce_sums: &[Vec<C::G>],
nonces: Vec<Zeroizing<C::F>>,
msg: &[u8],
) -> C::F;
fn verify(
&self,
group_key: C::G,
nonces: &[Vec<C::G>],
sum: C::F,
) -> Option<Self::Signature>;
fn verify_share(
&self,
verification_share: C::G,
nonces: &[Vec<C::G>],
share: C::F,
) -> Result<Vec<(C::F, C::G)>, ()>;
}
Expand description
Algorithm trait usable by the FROST signing machine to produce signatures..
Required Associated Types§
sourcetype Transcript: Sync + Clone + Debug + Transcript
type Transcript: Sync + Clone + Debug + Transcript
The transcript format this algorithm uses. This likely should NOT be the IETF-compatible transcript included in this crate.
Required Methods§
sourcefn transcript(&mut self) -> &mut Self::Transcript
fn transcript(&mut self) -> &mut Self::Transcript
Obtain a mutable borrow of the underlying transcript.
sourcefn nonces(&self) -> Vec<Vec<C::G>>
fn nonces(&self) -> Vec<Vec<C::G>>
Obtain the list of nonces to generate, as specified by the generators to create commitments against per-nonce.
The Algorithm is responsible for all transcripting of these nonce specifications/generators.
The prover will be passed the commitments, and the commitments will be sent to all other participants. No guarantees the commitments are internally consistent (have the same discrete logarithm across generators) are made. Any Algorithm which specifies multiple generators for a single nonce must handle that itself.
sourcefn preprocess_addendum<R: RngCore + CryptoRng>(
&mut self,
rng: &mut R,
keys: &ThresholdKeys<C>,
) -> Self::Addendum
fn preprocess_addendum<R: RngCore + CryptoRng>( &mut self, rng: &mut R, keys: &ThresholdKeys<C>, ) -> Self::Addendum
Generate an addendum to FROST“s preprocessing stage.
sourcefn read_addendum<R: Read>(&self, reader: &mut R) -> Result<Self::Addendum>
fn read_addendum<R: Read>(&self, reader: &mut R) -> Result<Self::Addendum>
Read an addendum from a reader.
sourcefn process_addendum(
&mut self,
params: &ThresholdView<C>,
l: Participant,
reader: Self::Addendum,
) -> Result<(), FrostError>
fn process_addendum( &mut self, params: &ThresholdView<C>, l: Participant, reader: Self::Addendum, ) -> Result<(), FrostError>
Process the addendum for the specified participant. Guaranteed to be called in order.
Sign a share with the given secret/nonce. The secret will already have been its lagrange coefficient applied so it is the necessary key share. The nonce will already have been processed into the combined form d + (e * p).
sourcefn verify(
&self,
group_key: C::G,
nonces: &[Vec<C::G>],
sum: C::F,
) -> Option<Self::Signature>
fn verify( &self, group_key: C::G, nonces: &[Vec<C::G>], sum: C::F, ) -> Option<Self::Signature>
Verify a signature.
Verify a specific share given as a response. This function should return a series of pairs whose products should sum to zero for a valid share. Any error raised is treated as the share being invalid.