Skip to content

Commit d4eeaa3

Browse files
committed
zkp: Add Musig2 module
1 parent f735f14 commit d4eeaa3

File tree

3 files changed

+1197
-0
lines changed

3 files changed

+1197
-0
lines changed

src/lib.rs

+18
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ pub enum Error {
108108
CannotRecoverAdaptorSecret,
109109
/// Given adaptor signature is not valid for the provided combination of public key, encryption key and message
110110
CannotVerifyAdaptorSignature,
111+
/// Cannot establish Musig pre-session
112+
InvalidMusigPreSession,
113+
/// Invalid tweak to Musig public key
114+
InvalidMusigTweak,
115+
/// Cannot establish a Musig session
116+
InvalidMusigSession,
117+
/// Invalid Musig public nonces
118+
InvalidMusigPubNonce,
119+
/// Invalid Musig partial signature
120+
InvalidMusigPartSig,
121+
/// Cannot extract Musig secret adaptor
122+
InvalidMusigExtract,
111123
}
112124

113125
// Passthrough Debug to Display, since errors should be user-visible
@@ -127,6 +139,12 @@ impl fmt::Display for Error {
127139
Error::Upstream(inner) => return write!(f, "{}", inner),
128140
Error::InvalidTweakLength => "Tweak must of size 32",
129141
Error::TweakOutOfBounds => "Tweak must be less than secp curve order",
142+
Error::InvalidMusigPreSession => "failed to create Musig pre-session",
143+
Error::InvalidMusigTweak => "malformed Musig tweak",
144+
Error::InvalidMusigSession => "failed to create a Musig session",
145+
Error::InvalidMusigPubNonce => "malformed Musig public nonce(s)",
146+
Error::InvalidMusigPartSig => "malformed Musig partial signature",
147+
Error::InvalidMusigExtract => "failed to extract Musig secret adaptor",
130148
};
131149

132150
f.write_str(str)

src/zkp/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
mod ecdsa_adaptor;
22
mod generator;
33
#[cfg(feature = "std")]
4+
mod musig;
5+
#[cfg(feature = "std")]
46
mod pedersen;
57
#[cfg(feature = "std")]
68
mod rangeproof;
@@ -11,6 +13,8 @@ mod tag;
1113
pub use self::ecdsa_adaptor::*;
1214
pub use self::generator::*;
1315
#[cfg(feature = "std")]
16+
pub use self::musig::*;
17+
#[cfg(feature = "std")]
1418
pub use self::pedersen::*;
1519
#[cfg(feature = "std")]
1620
pub use self::rangeproof::*;

0 commit comments

Comments
 (0)