Trait breez_sdk_liquid::bitcoin::util::schnorr::TapTweak
pub trait TapTweak {
type TweakedAux;
type TweakedKey;
// Required methods
fn tap_tweak<C>(
self,
secp: &Secp256k1<C>,
merkle_root: Option<TapBranchHash>,
) -> Self::TweakedAux
where C: Verification;
fn dangerous_assume_tweaked(self) -> Self::TweakedKey;
}
Expand description
A trait for tweaking BIP340 key types (x-only public keys and key pairs).
Required Associated Types§
type TweakedAux
type TweakedAux
Tweaked key type with optional auxiliary information
type TweakedKey
type TweakedKey
Tweaked key type
Required Methods§
fn tap_tweak<C>(
self,
secp: &Secp256k1<C>,
merkle_root: Option<TapBranchHash>,
) -> Self::TweakedAuxwhere
C: Verification,
fn tap_tweak<C>(
self,
secp: &Secp256k1<C>,
merkle_root: Option<TapBranchHash>,
) -> Self::TweakedAuxwhere
C: Verification,
Tweaks an untweaked key with corresponding public key value and optional script tree merkle
root. For the KeyPair
type this also tweaks the private key in the pair.
This is done by using the equation Q = P + H(P|c)G, where
- Q is the tweaked public key
- P is the internal public key
- H is the hash function
- c is the commitment data
- G is the generator point
§Returns
The tweaked key and its parity.
fn dangerous_assume_tweaked(self) -> Self::TweakedKey
fn dangerous_assume_tweaked(self) -> Self::TweakedKey
Directly converts an UntweakedPublicKey
to a TweakedPublicKey
This method is dangerous and can lead to loss of funds if used incorrectly. Specifically, in multi-party protocols a peer can provide a value that allows them to steal.
Object Safety§
This trait is not object safe.