Trait modular_frost::sign::SignMachine
source · pub trait SignMachine<S>: Send + Sync + Sized {
type Params: Clone;
type Keys;
type Preprocess: Clone + PartialEq + Writable;
type SignatureShare: Clone + PartialEq + Writable;
type SignatureMachine: SignatureMachine<S, SignatureShare = Self::SignatureShare>;
// Required methods
fn cache(self) -> CachedPreprocess;
fn from_cache(
params: Self::Params,
keys: Self::Keys,
cache: CachedPreprocess,
) -> (Self, Self::Preprocess);
fn read_preprocess<R: Read>(
&self,
reader: &mut R,
) -> Result<Self::Preprocess>;
fn sign(
self,
commitments: HashMap<Participant, Self::Preprocess>,
msg: &[u8],
) -> Result<(Self::SignatureMachine, Self::SignatureShare), FrostError>;
}
Expand description
Trait for the second machine of a two-round signing protocol.
Required Associated Types§
sourcetype Params: Clone
type Params: Clone
Params used to instantiate this machine which can be used to rebuild from a cache.
sourcetype Preprocess: Clone + PartialEq + Writable
type Preprocess: Clone + PartialEq + Writable
Preprocess message for this machine.
SignatureShare message for this machine.
sourcetype SignatureMachine: SignatureMachine<S, SignatureShare = Self::SignatureShare>
type SignatureMachine: SignatureMachine<S, SignatureShare = Self::SignatureShare>
SignatureMachine this SignMachine turns into.
Required Methods§
sourcefn cache(self) -> CachedPreprocess
fn cache(self) -> CachedPreprocess
Cache this preprocess for usage later. This cached preprocess MUST only be used once. Reuse of it enables recovery of your private key share. Third-party recovery of a cached preprocess also enables recovery of your private key share, so this MUST be treated with the same security as your private key share.
sourcefn from_cache(
params: Self::Params,
keys: Self::Keys,
cache: CachedPreprocess,
) -> (Self, Self::Preprocess)
fn from_cache( params: Self::Params, keys: Self::Keys, cache: CachedPreprocess, ) -> (Self, Self::Preprocess)
Create a sign machine from a cached preprocess. After this, the preprocess must be deleted so it’s never reused. Any reuse will presumably cause the signer to leak their secret share.
sourcefn read_preprocess<R: Read>(&self, reader: &mut R) -> Result<Self::Preprocess>
fn read_preprocess<R: Read>(&self, reader: &mut R) -> Result<Self::Preprocess>
Read a Preprocess message. Despite taking self, this does not save the preprocess. It must be externally cached and passed into sign.
sourcefn sign(
self,
commitments: HashMap<Participant, Self::Preprocess>,
msg: &[u8],
) -> Result<(Self::SignatureMachine, Self::SignatureShare), FrostError>
fn sign( self, commitments: HashMap<Participant, Self::Preprocess>, msg: &[u8], ) -> Result<(Self::SignatureMachine, Self::SignatureShare), FrostError>
Sign a message. Takes in the participants’ preprocess messages. Returns the signature share to be broadcast to all participants, over an authenticated channel. The parties who participate here will become the signing set for this session.