@@ -44,7 +44,7 @@ pub struct SessionSecretRand([u8; 32]);
44
44
impl SessionSecretRand {
45
45
/// Generates a new session ID using thread RNG.
46
46
#[ cfg( all( feature = "rand" , feature = "std" ) ) ]
47
- pub fn new ( ) -> Self { Self :: from_rng ( & mut rand:: thread_rng ( ) ) }
47
+ pub fn new ( ) -> Self { Self :: from_rng ( & mut rand:: rng ( ) ) }
48
48
49
49
/// Creates a new [`SessionSecretRand`] with random bytes from the given rng
50
50
#[ cfg( feature = "rand" ) ]
@@ -137,12 +137,12 @@ impl fmt::Display for InvalidTweakErr {
137
137
///
138
138
/// ```rust
139
139
/// # # [cfg(any(test, feature = "rand-std"))] {
140
- /// # use secp256k1::rand::{thread_rng , RngCore};
140
+ /// # use secp256k1::rand::{rng , RngCore};
141
141
/// # use secp256k1::{PublicKey, Secp256k1, SecretKey, new_nonce_pair, SessionSecretRand};
142
142
/// # let secp = Secp256k1::new();
143
143
/// // The session id must be sampled at random. Read documentation for more details.
144
- /// let session_secrand = SessionSecretRand::new(&mut thread_rng ());
145
- /// let sk = SecretKey::new(&mut thread_rng ());
144
+ /// let session_secrand = SessionSecretRand::new(&mut rng ());
145
+ /// let sk = SecretKey::new(&mut rng ());
146
146
/// let pk = PublicKey::from_secret_key(&secp, &sk);
147
147
///
148
148
/// // Supply extra auxillary randomness to prevent misuse(for example, time of day)
@@ -287,12 +287,12 @@ impl KeyAggCache {
287
287
///
288
288
/// ```rust
289
289
/// # # [cfg(any(test, feature = "rand-std"))] {
290
- /// # use secp256k1::rand::{thread_rng , RngCore};
290
+ /// # use secp256k1::rand::{rng , RngCore};
291
291
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey};
292
292
/// # let secp = Secp256k1::new();
293
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
293
+ /// # let sk1 = SecretKey::new(&mut rng ());
294
294
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
295
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
295
+ /// # let sk2 = SecretKey::new(&mut rng ());
296
296
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
297
297
/// #
298
298
/// let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -376,12 +376,12 @@ impl KeyAggCache {
376
376
///
377
377
/// ```rust
378
378
/// # # [cfg(any(test, feature = "rand-std"))] {
379
- /// # use secp256k1::rand::{thread_rng , RngCore};
379
+ /// # use secp256k1::rand::{rng , RngCore};
380
380
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey};
381
381
/// # let secp = Secp256k1::new();
382
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
382
+ /// # let sk1 = SecretKey::new(&mut rng ());
383
383
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
384
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
384
+ /// # let sk2 = SecretKey::new(&mut rng ());
385
385
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
386
386
/// #
387
387
/// let mut key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -435,12 +435,12 @@ impl KeyAggCache {
435
435
///
436
436
/// ```rust
437
437
/// # # [cfg(any(test, feature = "rand-std"))] {
438
- /// # use secp256k1::rand::{thread_rng , RngCore};
438
+ /// # use secp256k1::rand::{rng , RngCore};
439
439
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey};
440
440
/// # let secp = Secp256k1::new();
441
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
441
+ /// # let sk1 = SecretKey::new(&mut rng ());
442
442
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
443
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
443
+ /// # let sk2 = SecretKey::new(&mut rng ());
444
444
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
445
445
///
446
446
/// let mut key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -509,17 +509,17 @@ impl KeyAggCache {
509
509
///
510
510
/// ```rust
511
511
/// # # [cfg(any(test, feature = "rand-std"))] {
512
- /// # use secp256k1::rand::{thread_rng , RngCore};
512
+ /// # use secp256k1::rand::{rng , RngCore};
513
513
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message};
514
514
/// # let secp = Secp256k1::new();
515
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
515
+ /// # let sk1 = SecretKey::new(&mut rng ());
516
516
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
517
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
517
+ /// # let sk2 = SecretKey::new(&mut rng ());
518
518
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
519
519
/// #
520
520
/// let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
521
521
/// // The session id must be sampled at random. Read documentation for more details.
522
- /// let session_secrand = SessionSecretRand::new(&mut thread_rng ());
522
+ /// let session_secrand = SessionSecretRand::new(&mut rng ());
523
523
///
524
524
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
525
525
///
@@ -697,25 +697,25 @@ impl AggregatedNonce {
697
697
///
698
698
/// ```rust
699
699
/// # # [cfg(any(test, feature = "rand-std"))] {
700
- /// # use secp256k1::rand::{thread_rng , RngCore};
700
+ /// # use secp256k1::rand::{rng , RngCore};
701
701
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce};
702
702
/// # let secp = Secp256k1::new();
703
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
703
+ /// # let sk1 = SecretKey::new(&mut rng ());
704
704
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
705
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
705
+ /// # let sk2 = SecretKey::new(&mut rng ());
706
706
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
707
707
///
708
708
/// # let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
709
709
/// // The session id must be sampled at random. Read documentation for more details.
710
710
///
711
711
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
712
712
///
713
- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
713
+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
714
714
/// let (_sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, None)
715
715
/// .expect("non zero session id");
716
716
///
717
717
/// // Signer two does the same: Possibly on a different device
718
- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
718
+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
719
719
/// let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, None)
720
720
/// .expect("non zero session id");
721
721
///
@@ -859,12 +859,12 @@ impl Session {
859
859
///
860
860
/// ```rust
861
861
/// # # [cfg(any(test, feature = "rand-std"))] {
862
- /// # use secp256k1::rand::{thread_rng , RngCore};
862
+ /// # use secp256k1::rand::{rng , RngCore};
863
863
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce, Session};
864
864
/// # let secp = Secp256k1::new();
865
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
865
+ /// # let sk1 = SecretKey::new(&mut rng ());
866
866
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
867
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
867
+ /// # let sk2 = SecretKey::new(&mut rng ());
868
868
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
869
869
///
870
870
/// # let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -873,13 +873,13 @@ impl Session {
873
873
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
874
874
///
875
875
/// // Provide the current time for mis-use resistance
876
- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
876
+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
877
877
/// let extra_rand1 : Option<[u8; 32]> = None;
878
878
/// let (_sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, extra_rand1)
879
879
/// .expect("non zero session id");
880
880
///
881
881
/// // Signer two does the same. Possibly on a different device
882
- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
882
+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
883
883
/// let extra_rand2 : Option<[u8; 32]> = None;
884
884
/// let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, extra_rand2)
885
885
/// .expect("non zero session id");
@@ -995,12 +995,12 @@ impl Session {
995
995
///
996
996
/// ```rust
997
997
/// # # [cfg(any(test, feature = "rand-std"))] {
998
- /// # use secp256k1::rand::{thread_rng , RngCore};
998
+ /// # use secp256k1::rand::{rng , RngCore};
999
999
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce, Session};
1000
1000
/// # let secp = Secp256k1::new();
1001
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
1001
+ /// # let sk1 = SecretKey::new(&mut rng ());
1002
1002
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
1003
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
1003
+ /// # let sk2 = SecretKey::new(&mut rng ());
1004
1004
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
1005
1005
///
1006
1006
/// # let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -1009,12 +1009,12 @@ impl Session {
1009
1009
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
1010
1010
///
1011
1011
/// // Provide the current time for mis-use resistance
1012
- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
1012
+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
1013
1013
/// let (mut sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, None)
1014
1014
/// .expect("non zero session id");
1015
1015
///
1016
1016
/// // Signer two does the same. Possibly on a different device
1017
- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
1017
+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
1018
1018
/// let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, None)
1019
1019
/// .expect("non zero session id");
1020
1020
///
@@ -1078,12 +1078,12 @@ impl Session {
1078
1078
///
1079
1079
/// ```rust
1080
1080
/// # # [cfg(any(test, feature = "rand-std"))] {
1081
- /// # use secp256k1::rand::{thread_rng , RngCore};
1081
+ /// # use secp256k1::rand::{rng , RngCore};
1082
1082
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce, Session};
1083
1083
/// # let secp = Secp256k1::new();
1084
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
1084
+ /// # let sk1 = SecretKey::new(&mut rng ());
1085
1085
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
1086
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
1086
+ /// # let sk2 = SecretKey::new(&mut rng ());
1087
1087
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
1088
1088
///
1089
1089
/// let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -1092,12 +1092,12 @@ impl Session {
1092
1092
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
1093
1093
///
1094
1094
/// // Provide the current time for mis-use resistance
1095
- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
1095
+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
1096
1096
/// let (mut sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, None)
1097
1097
/// .expect("non zero session id");
1098
1098
///
1099
1099
/// // Signer two does the same. Possibly on a different device
1100
- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
1100
+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
1101
1101
/// let (mut sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, None)
1102
1102
/// .expect("non zero session id");
1103
1103
///
0 commit comments