@@ -13,7 +13,7 @@ use {core, std};
13
13
14
14
use crate :: ffi:: { self , CPtr } ;
15
15
use crate :: ZERO_TWEAK ;
16
- use crate :: { schnorr, KeyPair , XOnlyPublicKey } ;
16
+ use crate :: { schnorr, Keypair , XOnlyPublicKey } ;
17
17
use crate :: { Message , PublicKey , Secp256k1 , SecretKey , Tweak } ;
18
18
use crate :: { Signing , Verification } ;
19
19
use secp256k1:: Parity ;
@@ -114,7 +114,7 @@ impl MusigKeyAggCache {
114
114
/// ```rust
115
115
/// # # [cfg(any(test, feature = "rand-std"))] {
116
116
/// # use secp256k1_zkp::rand::{thread_rng, RngCore};
117
- /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair , PublicKey};
117
+ /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair , PublicKey};
118
118
/// # let secp = Secp256k1::new();
119
119
/// # let sk1 = SecretKey::new(&mut thread_rng());
120
120
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
@@ -177,7 +177,7 @@ impl MusigKeyAggCache {
177
177
/// ```rust
178
178
/// # # [cfg(any(test, feature = "rand-std"))] {
179
179
/// # use secp256k1_zkp::rand::{thread_rng, RngCore};
180
- /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair , PublicKey};
180
+ /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair , PublicKey};
181
181
/// # let secp = Secp256k1::new();
182
182
/// # let sk1 = SecretKey::new(&mut thread_rng());
183
183
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
@@ -234,7 +234,7 @@ impl MusigKeyAggCache {
234
234
/// ```rust
235
235
/// # # [cfg(any(test, feature = "rand-std"))] {
236
236
/// # use secp256k1_zkp::rand::{thread_rng, RngCore};
237
- /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair , PublicKey};
237
+ /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair , PublicKey};
238
238
/// # let secp = Secp256k1::new();
239
239
/// # let sk1 = SecretKey::new(&mut thread_rng());
240
240
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
@@ -308,7 +308,7 @@ impl MusigKeyAggCache {
308
308
/// ```rust
309
309
/// # # [cfg(any(test, feature = "rand-std"))] {
310
310
/// # use secp256k1_zkp::rand::{thread_rng, RngCore};
311
- /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair , PublicKey, MusigSessionId, Message};
311
+ /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair , PublicKey, MusigSessionId, Message};
312
312
/// # let secp = Secp256k1::new();
313
313
/// # let sk1 = SecretKey::new(&mut thread_rng());
314
314
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
@@ -319,7 +319,7 @@ impl MusigKeyAggCache {
319
319
/// // The session id must be sampled at random. Read documentation for more details.
320
320
/// let session_id = MusigSessionId::new(&mut thread_rng());
321
321
///
322
- /// let msg = Message::from_slice (b"Public Message we want to sign!!").unwrap();
322
+ /// let msg = Message::from_digest_slice (b"Public Message we want to sign!!").unwrap();
323
323
///
324
324
/// // Provide the current time for mis-use resistance
325
325
/// let extra_rand : Option<[u8; 32]> = None;
@@ -678,7 +678,7 @@ pub fn adapt(
678
678
/// ```rust
679
679
/// # # [cfg(any(test, feature = "rand-std"))] {
680
680
/// # use secp256k1_zkp::rand::{thread_rng, RngCore};
681
- /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair , PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession, adapt, extract_adaptor, Tweak};
681
+ /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair , PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession, adapt, extract_adaptor, Tweak};
682
682
/// # let secp = Secp256k1::new();
683
683
/// # let sk1 = SecretKey::new(&mut thread_rng());
684
684
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
@@ -688,7 +688,7 @@ pub fn adapt(
688
688
/// let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]);
689
689
/// // The session id must be sampled at random. Read documentation for more details.
690
690
///
691
- /// let msg = Message::from_slice (b"Public Message we want to sign!!").unwrap();
691
+ /// let msg = Message::from_digest_slice (b"Public Message we want to sign!!").unwrap();
692
692
///
693
693
/// // Provide the current time for mis-use resistance
694
694
/// let session_id1 = MusigSessionId::new(&mut thread_rng());
@@ -718,15 +718,15 @@ pub fn adapt(
718
718
/// let partial_sig1 = session.partial_sign(
719
719
/// &secp,
720
720
/// sec_nonce1,
721
- /// &KeyPair ::from_secret_key(&secp, &sk1),
721
+ /// &Keypair ::from_secret_key(&secp, &sk1),
722
722
/// &key_agg_cache,
723
723
/// ).unwrap();
724
724
///
725
725
/// // Other party creates the other partial signature
726
726
/// let partial_sig2 = session.partial_sign(
727
727
/// &secp,
728
728
/// sec_nonce2,
729
- /// &KeyPair ::from_secret_key(&secp, &sk2),
729
+ /// &Keypair ::from_secret_key(&secp, &sk2),
730
730
/// &key_agg_cache,
731
731
/// ).unwrap();
732
732
///
@@ -916,7 +916,7 @@ impl MusigAggNonce {
916
916
/// ```rust
917
917
/// # # [cfg(any(test, feature = "rand-std"))] {
918
918
/// # use secp256k1_zkp::rand::{thread_rng, RngCore};
919
- /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair , PublicKey, MusigSessionId, Message, MusigAggNonce};
919
+ /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair , PublicKey, MusigSessionId, Message, MusigAggNonce};
920
920
/// # let secp = Secp256k1::new();
921
921
/// # let sk1 = SecretKey::new(&mut thread_rng());
922
922
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
@@ -926,7 +926,7 @@ impl MusigAggNonce {
926
926
/// # let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]);
927
927
/// // The session id must be sampled at random. Read documentation for more details.
928
928
///
929
- /// let msg = Message::from_slice (b"Public Message we want to sign!!").unwrap();
929
+ /// let msg = Message::from_digest_slice (b"Public Message we want to sign!!").unwrap();
930
930
///
931
931
/// let session_id1 = MusigSessionId::new(&mut thread_rng());
932
932
/// let (_sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_id1, pub_key1, msg, None)
@@ -1059,7 +1059,7 @@ impl MusigSession {
1059
1059
/// ```rust
1060
1060
/// # # [cfg(any(test, feature = "rand-std"))] {
1061
1061
/// # use secp256k1_zkp::rand::{thread_rng, RngCore};
1062
- /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair , PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession};
1062
+ /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair , PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession};
1063
1063
/// # let secp = Secp256k1::new();
1064
1064
/// # let sk1 = SecretKey::new(&mut thread_rng());
1065
1065
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
@@ -1069,7 +1069,7 @@ impl MusigSession {
1069
1069
/// # let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]);
1070
1070
/// // The session id must be sampled at random. Read documentation for more details.
1071
1071
///
1072
- /// let msg = Message::from_slice (b"Public Message we want to sign!!").unwrap();
1072
+ /// let msg = Message::from_digest_slice (b"Public Message we want to sign!!").unwrap();
1073
1073
///
1074
1074
/// // Provide the current time for mis-use resistance
1075
1075
/// let session_id1 = MusigSessionId::new(&mut thread_rng());
@@ -1164,7 +1164,7 @@ impl MusigSession {
1164
1164
/// * `sec_nonce`: [`MusigSecNonce`] to be used for this session that has never
1165
1165
/// been used before. For mis-use resistance, this API takes a mutable reference
1166
1166
/// to `sec_nonce` and sets it to zero even if the partial signing fails.
1167
- /// * `key_pair`: The [`KeyPair `] to sign the message
1167
+ /// * `key_pair`: The [`Keypair `] to sign the message
1168
1168
/// * `key_agg_cache`: [`MusigKeyAggCache`] containing the aggregate pubkey used in
1169
1169
/// the creation of this session
1170
1170
///
@@ -1176,7 +1176,7 @@ impl MusigSession {
1176
1176
& self ,
1177
1177
secp : & Secp256k1 < C > ,
1178
1178
mut secnonce : MusigSecNonce ,
1179
- keypair : & KeyPair ,
1179
+ keypair : & Keypair ,
1180
1180
key_agg_cache : & MusigKeyAggCache ,
1181
1181
) -> Result < MusigPartialSignature , MusigSignError > {
1182
1182
unsafe {
@@ -1228,7 +1228,7 @@ impl MusigSession {
1228
1228
/// ```rust
1229
1229
/// # # [cfg(any(test, feature = "rand-std"))] {
1230
1230
/// # use secp256k1_zkp::rand::{thread_rng, RngCore};
1231
- /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair , PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession};
1231
+ /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair , PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession};
1232
1232
/// # let secp = Secp256k1::new();
1233
1233
/// # let sk1 = SecretKey::new(&mut thread_rng());
1234
1234
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
@@ -1238,7 +1238,7 @@ impl MusigSession {
1238
1238
/// # let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]);
1239
1239
/// // The session id must be sampled at random. Read documentation for more details.
1240
1240
///
1241
- /// let msg = Message::from_slice (b"Public Message we want to sign!!").unwrap();
1241
+ /// let msg = Message::from_digest_slice (b"Public Message we want to sign!!").unwrap();
1242
1242
///
1243
1243
/// // Provide the current time for mis-use resistance
1244
1244
/// let session_id1 = MusigSessionId::new(&mut thread_rng());
@@ -1259,7 +1259,7 @@ impl MusigSession {
1259
1259
/// msg,
1260
1260
/// );
1261
1261
///
1262
- /// let keypair = KeyPair ::from_secret_key(&secp, &sk1);
1262
+ /// let keypair = Keypair ::from_secret_key(&secp, &sk1);
1263
1263
/// let partial_sig1 = session.partial_sign(
1264
1264
/// &secp,
1265
1265
/// sec_nonce1,
@@ -1311,7 +1311,7 @@ impl MusigSession {
1311
1311
/// ```rust
1312
1312
/// # # [cfg(any(test, feature = "rand-std"))] {
1313
1313
/// # use secp256k1_zkp::rand::{thread_rng, RngCore};
1314
- /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, KeyPair , PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession};
1314
+ /// # use secp256k1_zkp::{MusigKeyAggCache, Secp256k1, SecretKey, Keypair , PublicKey, MusigSessionId, Message, MusigAggNonce, MusigSession};
1315
1315
/// # let secp = Secp256k1::new();
1316
1316
/// # let sk1 = SecretKey::new(&mut thread_rng());
1317
1317
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
@@ -1321,7 +1321,7 @@ impl MusigSession {
1321
1321
/// let key_agg_cache = MusigKeyAggCache::new(&secp, &[pub_key1, pub_key2]);
1322
1322
/// // The session id must be sampled at random. Read documentation for more details.
1323
1323
///
1324
- /// let msg = Message::from_slice (b"Public Message we want to sign!!").unwrap();
1324
+ /// let msg = Message::from_digest_slice (b"Public Message we want to sign!!").unwrap();
1325
1325
///
1326
1326
/// // Provide the current time for mis-use resistance
1327
1327
/// let session_id1 = MusigSessionId::new(&mut thread_rng());
@@ -1345,15 +1345,15 @@ impl MusigSession {
1345
1345
/// let partial_sig1 = session.partial_sign(
1346
1346
/// &secp,
1347
1347
/// sec_nonce1,
1348
- /// &KeyPair ::from_secret_key(&secp, &sk1),
1348
+ /// &Keypair ::from_secret_key(&secp, &sk1),
1349
1349
/// &key_agg_cache,
1350
1350
/// ).unwrap();
1351
1351
///
1352
1352
/// // Other party creates the other partial signature
1353
1353
/// let partial_sig2 = session.partial_sign(
1354
1354
/// &secp,
1355
1355
/// sec_nonce2,
1356
- /// &KeyPair ::from_secret_key(&secp, &sk2),
1356
+ /// &Keypair ::from_secret_key(&secp, &sk2),
1357
1357
/// &key_agg_cache,
1358
1358
/// ).unwrap();
1359
1359
///
@@ -1462,7 +1462,7 @@ mod tests {
1462
1462
let pub_key = PublicKey :: from_secret_key ( & secp, & sec_key) ;
1463
1463
1464
1464
let key_agg_cache = MusigKeyAggCache :: new ( & secp, & [ pub_key, pub_key] ) ;
1465
- let msg = Message :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
1465
+ let msg = Message :: from_digest_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
1466
1466
let session_id = MusigSessionId :: assume_unique_per_nonce_gen ( [ 1 ; 32 ] ) ;
1467
1467
let ( _secnonce, pubnonce) = key_agg_cache
1468
1468
. nonce_gen ( & secp, session_id, pub_key, msg, None )
0 commit comments