Struct Signer

Source
pub struct Signer<D: Digest> { /* private fields */ }
Expand description

Participant in the protocol can sign messages.

  • If the signer has closed_reg, then it can generate Stm certificate.
    • This kind of signer can only be generated out of an Initializer and a ClosedKeyRegistration.
    • This ensures that a MerkleTree root is not computed before all participants have registered.
  • If the signer does not have closed_reg, then it is a core signer.
    • This kind of signer cannot participate certificate generation.
    • Signature generated can be verified by a full node verifier (core verifier).

Implementations§

Source§

impl<D: Clone + Digest + FixedOutput> Signer<D>

Source

pub fn set_stm_signer( signer_index: u64, stake: Stake, params: Parameters, sk: BlsSigningKey, vk: VerificationKey, closed_reg: ClosedKeyRegistration<D>, ) -> Signer<D>

👎Deprecated since 0.4.9: Use set_signer instead

Create a Signer for given input

Source

pub fn set_core_signer( signer_index: u64, stake: Stake, params: Parameters, sk: BlsSigningKey, vk: VerificationKey, ) -> Signer<D>

👎Deprecated since 0.4.9: Use set_basic_signer instead

Create a core signer (no registration data) for given input

Source

pub fn sign(&self, msg: &[u8]) -> Option<SingleSignature>

This function produces a signature following the description of Section 2.4. Once the signature is produced, this function checks whether any index in [0,..,self.params.m] wins the lottery by evaluating the dense mapping. It records all the winning indexes in Self.indexes. If it wins at least one lottery, it stores the signer’s merkle tree index. The proof of membership will be handled by the aggregator.

Source

pub fn get_verification_key(&self) -> VerificationKey

Extract the verification key.

Source

pub fn verification_key(&self) -> VerificationKey

👎Deprecated since 0.4.9: Use get_verification_key instead

Extract the verification key.

Source

pub fn get_stake(&self) -> Stake

Extract stake from the signer.

Source

pub fn basic_sign( &self, msg: &[u8], total_stake: Stake, ) -> Option<SingleSignature>

A basic signature generated without closed key registration. The basic signature can be verified by basic verifier. Once the signature is produced, this function checks whether any index in [0,..,self.params.m] wins the lottery by evaluating the dense mapping. It records all the winning indexes in Self.indexes.

Source

pub fn core_sign( &self, msg: &[u8], total_stake: Stake, ) -> Option<SingleSignature>

👎Deprecated since 0.4.9: Use basic_sign instead

A basic signature generated without closed key registration. The basic signature can be verified by basic verifier. Once the signature is produced, this function checks whether any index in [0,..,self.params.m] wins the lottery by evaluating the dense mapping. It records all the winning indexes in Self.indexes.

Source

pub fn check_lottery( &self, msg: &[u8], sigma: &BlsSignature, total_stake: Stake, ) -> Vec<u64>

Collects and returns the winning indices.

Source

pub fn get_params(&self) -> Parameters

👎Deprecated since 0.4.9: Use get_parameters instead

Get Parameters

Source

pub fn get_closed_reg(&self) -> Option<ClosedKeyRegistration<D>>

👎Deprecated since 0.4.9: Use get_closed_key_registration instead

Get closed key registration

Trait Implementations§

Source§

impl<D: Clone + Digest> Clone for Signer<D>

Source§

fn clone(&self) -> Signer<D>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<D: Debug + Digest> Debug for Signer<D>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<D> Freeze for Signer<D>

§

impl<D> RefUnwindSafe for Signer<D>
where D: RefUnwindSafe,

§

impl<D> Send for Signer<D>
where D: Sync + Send,

§

impl<D> Sync for Signer<D>
where D: Sync + Send,

§

impl<D> Unpin for Signer<D>

§

impl<D> UnwindSafe for Signer<D>
where D: RefUnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.