Struct schnorr_fun::musig::AggKey

source ·
pub struct AggKey<T> { /* private fields */ }
Expand description

A list of keys aggregated into a single key.

Created using MuSig::new_agg_key.

The AggKey can’t be serialized but it’s very efficient to re-create it from the initial list of keys.

MuSig::new_agg_key

Implementations§

source§

impl<T: Copy> AggKey<T>

source

pub fn agg_public_key(&self) -> Point<T>

The aggregate key.

Note that before using it as a key in a system that accepts “x-only” keys like [BIP341] you must call into_xonly_key and use that aggregate key.

source

pub fn keys(&self) -> impl Iterator<Item = Point> + '_

An iterator over the public keys of each party in the aggregate key.

source§

impl AggKey<Normal>

source

pub fn into_xonly_key(self) -> AggKey<EvenY>

Convert the key into a BIP340 AggKey.

This is the BIP340 x-only version of the key which you can put in a segwitv1 output and create/verify BIP340 signatures under.

source

pub fn tweak(self, tweak: Scalar<impl Secrecy, impl ZeroChoice>) -> Option<Self>

Add a scalar tweak to aggregate MuSig public key.

The resulting key is equal to the existing key plus tweak * G. The tweak mutates the public key while still allowing the original set of signers to sign under the new key. This function is appropriate for doing BIP32 tweaks before calling into_xonly_key. It is not appropriate for doing taproot tweaking which must be done on an AggKey with EvenY public key in BIP340 form, see into_xonly_key.

§Return value

In the erroneous case that the tweak is exactly equal to the negation of the aggregate secret key it returns None.

source§

impl AggKey<EvenY>

source

pub fn tweak(self, tweak: Scalar<impl Secrecy, impl ZeroChoice>) -> Option<Self>

Applies an “x-only” tweak to the aggregate key.

This function exists to allow for BIP341 tweaks to the aggregate public key.

Trait Implementations§

source§

impl<T: Clone> Clone for AggKey<T>

source§

fn clone(&self) -> AggKey<T>

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<T: Debug> Debug for AggKey<T>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for AggKey<T>
where T: RefUnwindSafe,

§

impl<T> Send for AggKey<T>
where T: Send,

§

impl<T> Sync for AggKey<T>
where T: Sync,

§

impl<T> Unpin for AggKey<T>
where T: Unpin,

§

impl<T> UnwindSafe for AggKey<T>
where T: UnwindSafe,

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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

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

§

fn vzip(self) -> V