pub struct SigningSession { /* private fields */ }Expand description
A stateful signing session for a single message under a ThresholdConfig.
The session verifies each partial signature at the time it is added, so
SigningSession::verify is a pure threshold check — it does not
re-verify individual signatures.
Sessions are single-use: one session corresponds to exactly one message. Create a new session for each message that requires threshold authorisation.
Implementations§
Source§impl SigningSession
impl SigningSession
Sourcepub fn new(config: &ThresholdConfig, message: &[u8]) -> Self
pub fn new(config: &ThresholdConfig, message: &[u8]) -> Self
Create a new signing session.
§Parameters
config: The threshold configuration for this session.message: The raw message payload to be authorised. Domain separation is applied internally; pass the plaintext message, not a pre-computed hash.
Sourcepub fn add_signature(
&mut self,
signer_index: usize,
signature: Vec<u8>,
) -> Result<(), Error>
pub fn add_signature( &mut self, signer_index: usize, signature: Vec<u8>, ) -> Result<(), Error>
Add a partial signature from committee member at signer_index.
The signature is verified cryptographically before being recorded.
Adding the same index twice returns Error::DuplicateSignature.
§Errors
Error::SignerIndexOutOfRangeifsigner_index >= total.Error::DuplicateSignatureif this index has already been signed.Error::VerificationFailedif the Falcon-512 check fails.- Propagates length-validation errors from
verify_partial.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Return true if the session holds at least M valid signatures.
Sourcepub fn verify(&self) -> Result<bool, Error>
pub fn verify(&self) -> Result<bool, Error>
Verify that the threshold is met.
Because individual signatures are verified at insertion time, this method
only checks that valid_count >= required.
§Errors
Returns Error::ThresholdNotMet if the session does not yet hold
enough valid signatures.
Sourcepub fn valid_signature_count(&self) -> usize
pub fn valid_signature_count(&self) -> usize
Return the number of valid signatures collected so far.
Sourcepub fn message(&self) -> &[u8] ⓘ
pub fn message(&self) -> &[u8] ⓘ
Return a reference to the message this session is authorising.
Sourcepub fn config(&self) -> &ThresholdConfig
pub fn config(&self) -> &ThresholdConfig
Return a reference to the threshold configuration.
Sourcepub fn get_signature(&self, signer_index: usize) -> Option<&[u8]>
pub fn get_signature(&self, signer_index: usize) -> Option<&[u8]>
Retrieve the recorded signature for signer_index, if present.
Returns None if no valid signature has been submitted for that index.
Sourcepub fn signed_indices(&self) -> Vec<usize>
pub fn signed_indices(&self) -> Vec<usize>
Return the indices of all signers who have submitted valid signatures.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SigningSession
impl RefUnwindSafe for SigningSession
impl Send for SigningSession
impl Sync for SigningSession
impl Unpin for SigningSession
impl UnsafeUnpin for SigningSession
impl UnwindSafe for SigningSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more