File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ impl str::FromStr for SecretKey {
51
51
fn from_str ( s : & str ) -> Result < SecretKey , Error > {
52
52
let mut res = [ 0 ; constants:: SECRET_KEY_SIZE ] ;
53
53
match from_hex ( s, & mut res) {
54
- Ok ( constants:: SECRET_KEY_SIZE ) => Ok ( SecretKey ( res) ) ,
54
+ Ok ( constants:: SECRET_KEY_SIZE ) => SecretKey :: from_slice ( & res) ,
55
55
_ => Err ( Error :: InvalidSecretKey )
56
56
}
57
57
}
@@ -525,6 +525,10 @@ mod test {
525
525
fn invalid_secret_key ( ) {
526
526
// Zero
527
527
assert_eq ! ( SecretKey :: from_slice( & [ 0 ; 32 ] ) , Err ( InvalidSecretKey ) ) ;
528
+ assert_eq ! (
529
+ SecretKey :: from_str( & format!( "0000000000000000000000000000000000000000000000000000000000000000" ) ) ,
530
+ Err ( InvalidSecretKey )
531
+ ) ;
528
532
// -1
529
533
assert_eq ! ( SecretKey :: from_slice( & [ 0xff ; 32 ] ) , Err ( InvalidSecretKey ) ) ;
530
534
// Top of range
You can’t perform that action at this time.
0 commit comments