Skip to main content

SigningSession

Struct SigningSession 

Source
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

Source

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.
Source

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
Source

pub fn is_complete(&self) -> bool

Return true if the session holds at least M valid signatures.

Source

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.

Source

pub fn valid_signature_count(&self) -> usize

Return the number of valid signatures collected so far.

Source

pub fn required(&self) -> usize

Return the threshold requirement.

Source

pub fn progress(&self) -> (usize, usize)

Return progress as (collected, required).

Source

pub fn message(&self) -> &[u8]

Return a reference to the message this session is authorising.

Source

pub fn config(&self) -> &ThresholdConfig

Return a reference to the threshold configuration.

Source

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.

Source

pub fn signed_indices(&self) -> Vec<usize>

Return the indices of all signers who have submitted valid signatures.

Trait Implementations§

Source§

impl Debug for SigningSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V