@@ -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" ) ]
@@ -142,12 +142,12 @@ impl fmt::Display for InvalidTweakErr {
142
142
///
143
143
/// ```rust
144
144
/// # # [cfg(any(test, feature = "rand-std"))] {
145
- /// # use secp256k1::rand::{thread_rng , RngCore};
145
+ /// # use secp256k1::rand::{rng , RngCore};
146
146
/// # use secp256k1::{PublicKey, Secp256k1, SecretKey, new_nonce_pair, SessionSecretRand};
147
147
/// # let secp = Secp256k1::new();
148
148
/// // The session id must be sampled at random. Read documentation for more details.
149
- /// let session_secrand = SessionSecretRand::new(&mut thread_rng ());
150
- /// let sk = SecretKey::new(&mut thread_rng ());
149
+ /// let session_secrand = SessionSecretRand::new(&mut rng ());
150
+ /// let sk = SecretKey::new(&mut rng ());
151
151
/// let pk = PublicKey::from_secret_key(&secp, &sk);
152
152
///
153
153
/// // Supply extra auxillary randomness to prevent misuse(for example, time of day)
@@ -298,12 +298,12 @@ impl KeyAggCache {
298
298
///
299
299
/// ```rust
300
300
/// # # [cfg(any(test, feature = "rand-std"))] {
301
- /// # use secp256k1::rand::{thread_rng , RngCore};
301
+ /// # use secp256k1::rand::{rng , RngCore};
302
302
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey};
303
303
/// # let secp = Secp256k1::new();
304
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
304
+ /// # let sk1 = SecretKey::new(&mut rng ());
305
305
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
306
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
306
+ /// # let sk2 = SecretKey::new(&mut rng ());
307
307
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
308
308
/// #
309
309
/// let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -387,12 +387,12 @@ impl KeyAggCache {
387
387
///
388
388
/// ```rust
389
389
/// # # [cfg(any(test, feature = "rand-std"))] {
390
- /// # use secp256k1::rand::{thread_rng , RngCore};
390
+ /// # use secp256k1::rand::{rng , RngCore};
391
391
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey};
392
392
/// # let secp = Secp256k1::new();
393
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
393
+ /// # let sk1 = SecretKey::new(&mut rng ());
394
394
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
395
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
395
+ /// # let sk2 = SecretKey::new(&mut rng ());
396
396
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
397
397
/// #
398
398
/// let mut key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -446,12 +446,12 @@ impl KeyAggCache {
446
446
///
447
447
/// ```rust
448
448
/// # # [cfg(any(test, feature = "rand-std"))] {
449
- /// # use secp256k1::rand::{thread_rng , RngCore};
449
+ /// # use secp256k1::rand::{rng , RngCore};
450
450
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey};
451
451
/// # let secp = Secp256k1::new();
452
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
452
+ /// # let sk1 = SecretKey::new(&mut rng ());
453
453
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
454
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
454
+ /// # let sk2 = SecretKey::new(&mut rng ());
455
455
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
456
456
///
457
457
/// let mut key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -520,17 +520,17 @@ impl KeyAggCache {
520
520
///
521
521
/// ```rust
522
522
/// # # [cfg(any(test, feature = "rand-std"))] {
523
- /// # use secp256k1::rand::{thread_rng , RngCore};
523
+ /// # use secp256k1::rand::{rng , RngCore};
524
524
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message};
525
525
/// # let secp = Secp256k1::new();
526
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
526
+ /// # let sk1 = SecretKey::new(&mut rng ());
527
527
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
528
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
528
+ /// # let sk2 = SecretKey::new(&mut rng ());
529
529
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
530
530
/// #
531
531
/// let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
532
532
/// // The session id must be sampled at random. Read documentation for more details.
533
- /// let session_secrand = SessionSecretRand::new(&mut thread_rng ());
533
+ /// let session_secrand = SessionSecretRand::new(&mut rng ());
534
534
///
535
535
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
536
536
///
@@ -708,25 +708,25 @@ impl AggregatedNonce {
708
708
///
709
709
/// ```rust
710
710
/// # # [cfg(any(test, feature = "rand-std"))] {
711
- /// # use secp256k1::rand::{thread_rng , RngCore};
711
+ /// # use secp256k1::rand::{rng , RngCore};
712
712
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce};
713
713
/// # let secp = Secp256k1::new();
714
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
714
+ /// # let sk1 = SecretKey::new(&mut rng ());
715
715
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
716
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
716
+ /// # let sk2 = SecretKey::new(&mut rng ());
717
717
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
718
718
///
719
719
/// # let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
720
720
/// // The session id must be sampled at random. Read documentation for more details.
721
721
///
722
722
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
723
723
///
724
- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
724
+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
725
725
/// let (_sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, None)
726
726
/// .expect("non zero session id");
727
727
///
728
728
/// // Signer two does the same: Possibly on a different device
729
- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
729
+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
730
730
/// let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, None)
731
731
/// .expect("non zero session id");
732
732
///
@@ -870,12 +870,12 @@ impl Session {
870
870
///
871
871
/// ```rust
872
872
/// # # [cfg(any(test, feature = "rand-std"))] {
873
- /// # use secp256k1::rand::{thread_rng , RngCore};
873
+ /// # use secp256k1::rand::{rng , RngCore};
874
874
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce, Session};
875
875
/// # let secp = Secp256k1::new();
876
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
876
+ /// # let sk1 = SecretKey::new(&mut rng ());
877
877
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
878
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
878
+ /// # let sk2 = SecretKey::new(&mut rng ());
879
879
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
880
880
///
881
881
/// # let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -884,13 +884,13 @@ impl Session {
884
884
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
885
885
///
886
886
/// // Provide the current time for mis-use resistance
887
- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
887
+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
888
888
/// let extra_rand1 : Option<[u8; 32]> = None;
889
889
/// let (_sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, extra_rand1)
890
890
/// .expect("non zero session id");
891
891
///
892
892
/// // Signer two does the same. Possibly on a different device
893
- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
893
+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
894
894
/// let extra_rand2 : Option<[u8; 32]> = None;
895
895
/// let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, extra_rand2)
896
896
/// .expect("non zero session id");
@@ -1006,12 +1006,12 @@ impl Session {
1006
1006
///
1007
1007
/// ```rust
1008
1008
/// # # [cfg(any(test, feature = "rand-std"))] {
1009
- /// # use secp256k1::rand::{thread_rng , RngCore};
1009
+ /// # use secp256k1::rand::{rng , RngCore};
1010
1010
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce, Session};
1011
1011
/// # let secp = Secp256k1::new();
1012
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
1012
+ /// # let sk1 = SecretKey::new(&mut rng ());
1013
1013
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
1014
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
1014
+ /// # let sk2 = SecretKey::new(&mut rng ());
1015
1015
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
1016
1016
///
1017
1017
/// # let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -1020,12 +1020,12 @@ impl Session {
1020
1020
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
1021
1021
///
1022
1022
/// // Provide the current time for mis-use resistance
1023
- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
1023
+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
1024
1024
/// let (mut sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, None)
1025
1025
/// .expect("non zero session id");
1026
1026
///
1027
1027
/// // Signer two does the same. Possibly on a different device
1028
- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
1028
+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
1029
1029
/// let (_sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, None)
1030
1030
/// .expect("non zero session id");
1031
1031
///
@@ -1089,12 +1089,12 @@ impl Session {
1089
1089
///
1090
1090
/// ```rust
1091
1091
/// # # [cfg(any(test, feature = "rand-std"))] {
1092
- /// # use secp256k1::rand::{thread_rng , RngCore};
1092
+ /// # use secp256k1::rand::{rng , RngCore};
1093
1093
/// # use secp256k1::{KeyAggCache, Secp256k1, SecretKey, Keypair, PublicKey, SessionSecretRand, Message, AggregatedNonce, Session};
1094
1094
/// # let secp = Secp256k1::new();
1095
- /// # let sk1 = SecretKey::new(&mut thread_rng ());
1095
+ /// # let sk1 = SecretKey::new(&mut rng ());
1096
1096
/// # let pub_key1 = PublicKey::from_secret_key(&secp, &sk1);
1097
- /// # let sk2 = SecretKey::new(&mut thread_rng ());
1097
+ /// # let sk2 = SecretKey::new(&mut rng ());
1098
1098
/// # let pub_key2 = PublicKey::from_secret_key(&secp, &sk2);
1099
1099
///
1100
1100
/// let key_agg_cache = KeyAggCache::new(&secp, &[pub_key1, pub_key2]);
@@ -1103,12 +1103,12 @@ impl Session {
1103
1103
/// let msg = Message::from_digest_slice(b"Public Message we want to sign!!").unwrap();
1104
1104
///
1105
1105
/// // Provide the current time for mis-use resistance
1106
- /// let session_secrand1 = SessionSecretRand::new(&mut thread_rng ());
1106
+ /// let session_secrand1 = SessionSecretRand::new(&mut rng ());
1107
1107
/// let (mut sec_nonce1, pub_nonce1) = key_agg_cache.nonce_gen(&secp, session_secrand1, pub_key1, msg, None)
1108
1108
/// .expect("non zero session id");
1109
1109
///
1110
1110
/// // Signer two does the same. Possibly on a different device
1111
- /// let session_secrand2 = SessionSecretRand::new(&mut thread_rng ());
1111
+ /// let session_secrand2 = SessionSecretRand::new(&mut rng ());
1112
1112
/// let (mut sec_nonce2, pub_nonce2) = key_agg_cache.nonce_gen(&secp, session_secrand2, pub_key2, msg, None)
1113
1113
/// .expect("non zero session id");
1114
1114
///
0 commit comments