File tree Expand file tree Collapse file tree 1 file changed +8
-17
lines changed Expand file tree Collapse file tree 1 file changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -114,12 +114,7 @@ impl<const B: usize> SecretKey<B> {
114
114
rand_chacha7:: ChaCha8Rng :: from_seed ( seed)
115
115
}
116
116
117
- pub fn new (
118
- _: Mode ,
119
- curve : Curve ,
120
- path : BIP32Path < B > ,
121
- ed25519_secret_key_bytes : Option < [ u8 ; 32 ] > ,
122
- ) -> Self {
117
+ pub fn new ( _: Mode , curve : Curve , path : BIP32Path < B > ) -> Self {
123
118
let bytes = match curve {
124
119
Curve :: Secp256K1 => {
125
120
let secret = k256:: ecdsa:: SigningKey :: random ( & mut Self :: rng8 ( path) ) ;
@@ -132,17 +127,13 @@ impl<const B: usize> SecretKey<B> {
132
127
* secret. to_bytes ( ) . as_ref ( )
133
128
}
134
129
Curve :: Ed25519 => {
135
- if let Some ( bytes) = ed25519_secret_key_bytes {
136
- let secret = ed25519_dalek:: SigningKey :: from_bytes ( & bytes) ;
137
- secret. to_bytes ( )
138
- } else {
139
- // Generate random bytes using the path if no bytes provided
140
- let mut bytes = [ 0u8 ; 32 ] ;
141
- let mut rng = Self :: rng8 ( path) ;
142
- use rand_chacha8:: rand_core:: RngCore ;
143
- rng. fill_bytes ( & mut bytes) ;
144
- bytes
145
- }
130
+ use rand_chacha7:: rand_core:: RngCore ;
131
+ let mut rng = Self :: rng7 ( path) ;
132
+ let mut bytes = [ 0u8 ; 32 ] ;
133
+ rng. fill_bytes ( & mut bytes) ;
134
+ let secret = ed25519_dalek:: SigningKey :: from_bytes ( & bytes) ;
135
+
136
+ secret. to_bytes ( )
146
137
}
147
138
Curve :: Stark256 => {
148
139
panic ! ( "invalid curve passed to ecfp256 new" )
You can’t perform that action at this time.
0 commit comments