pub struct AggregatedNonce(/* private fields */);Expand description
Musig aggregated nonce computed by aggregating all individual public nonces
Implementations§
Source§impl AggregatedNonce
impl AggregatedNonce
Sourcepub fn new(nonces: &[&PublicNonce]) -> AggregatedNonce
pub fn new(nonces: &[&PublicNonce]) -> AggregatedNonce
Combine received public nonces into a single aggregated nonce
This is useful to reduce the communication between signers, because instead of everyone sending nonces to everyone else, there can be one party receiving all nonces, combining the nonces with this function and then sending only the combined nonce back to the signers.
Example:
// The session id must be sampled at random. Read documentation for more details.
let msg = b"Public message we want to sign!!";
let session_secrand1 = SessionSecretRand::from_rng(&mut rand::rng());
let (_sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(session_secrand1, pub_key1, msg, None);
// Signer two does the same: Possibly on a different device
let session_secrand2 = SessionSecretRand::from_rng(&mut rand::rng());
let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(session_secrand2, pub_key2, msg, None);
let aggnonce = AggregatedNonce::new(&[&pub_nonce1, &pub_nonce2]);§Panics
Panics if an empty slice of nonces is provided.
Sourcepub fn from_byte_array(data: &[u8; 66]) -> Result<AggregatedNonce, ParseError>
pub fn from_byte_array(data: &[u8; 66]) -> Result<AggregatedNonce, ParseError>
Deserialize a AggregatedNonce from byte slice
§Errors:
- MalformedArg: If the byte slice is 66 bytes, but the
AggregatedNonceis invalid
Sourcepub fn as_ptr(&self) -> *const MusigAggNonce
pub fn as_ptr(&self) -> *const MusigAggNonce
Get a const pointer to the inner AggregatedNonce
Sourcepub fn as_mut_ptr(&mut self) -> *mut MusigAggNonce
pub fn as_mut_ptr(&mut self) -> *mut MusigAggNonce
Get a mut pointer to the inner AggregatedNonce
Trait Implementations§
Source§impl CPtr for AggregatedNonce
impl CPtr for AggregatedNonce
type Target = MusigAggNonce
fn as_c_ptr(&self) -> *const <AggregatedNonce as CPtr>::Target
fn as_mut_c_ptr(&mut self) -> *mut <AggregatedNonce as CPtr>::Target
Source§impl Clone for AggregatedNonce
impl Clone for AggregatedNonce
Source§fn clone(&self) -> AggregatedNonce
fn clone(&self) -> AggregatedNonce
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AggregatedNonce
impl Debug for AggregatedNonce
Source§impl<'de> Deserialize<'de> for AggregatedNonce
Available on crate feature serde only.
impl<'de> Deserialize<'de> for AggregatedNonce
Available on crate feature
serde only.Source§fn deserialize<D>(
d: D,
) -> Result<AggregatedNonce, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
d: D,
) -> Result<AggregatedNonce, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for AggregatedNonce
impl Display for AggregatedNonce
Source§impl FromStr for AggregatedNonce
impl FromStr for AggregatedNonce
Source§type Err = ParseError
type Err = ParseError
The associated error which can be returned from parsing.
Source§fn from_str(
s: &str,
) -> Result<AggregatedNonce, <AggregatedNonce as FromStr>::Err>
fn from_str( s: &str, ) -> Result<AggregatedNonce, <AggregatedNonce as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for AggregatedNonce
impl Hash for AggregatedNonce
Source§impl LowerHex for AggregatedNonce
impl LowerHex for AggregatedNonce
Source§impl Ord for AggregatedNonce
impl Ord for AggregatedNonce
Source§fn cmp(&self, other: &AggregatedNonce) -> Ordering
fn cmp(&self, other: &AggregatedNonce) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for AggregatedNonce
impl PartialEq for AggregatedNonce
Source§impl PartialOrd for AggregatedNonce
impl PartialOrd for AggregatedNonce
Source§impl Serialize for AggregatedNonce
Available on crate feature serde only.
impl Serialize for AggregatedNonce
Available on crate feature
serde only.Source§fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for AggregatedNonce
impl Eq for AggregatedNonce
impl StructuralPartialEq for AggregatedNonce
Auto Trait Implementations§
impl Freeze for AggregatedNonce
impl RefUnwindSafe for AggregatedNonce
impl Send for AggregatedNonce
impl Sync for AggregatedNonce
impl Unpin for AggregatedNonce
impl UnwindSafe for AggregatedNonce
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
Mutably borrows from an owned value. Read more