File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 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 {
5151 fn from_str ( s : & str ) -> Result < SecretKey , Error > {
5252 let mut res = [ 0 ; constants:: SECRET_KEY_SIZE ] ;
5353 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) ,
5555 _ => Err ( Error :: InvalidSecretKey )
5656 }
5757 }
@@ -525,6 +525,10 @@ mod test {
525525 fn invalid_secret_key ( ) {
526526 // Zero
527527 assert_eq ! ( SecretKey :: from_slice( & [ 0 ; 32 ] ) , Err ( InvalidSecretKey ) ) ;
528+ assert_eq ! (
529+ SecretKey :: from_str( & format!( "0000000000000000000000000000000000000000000000000000000000000000" ) ) ,
530+ Err ( InvalidSecretKey )
531+ ) ;
528532 // -1
529533 assert_eq ! ( SecretKey :: from_slice( & [ 0xff ; 32 ] ) , Err ( InvalidSecretKey ) ) ;
530534 // Top of range
You can’t perform that action at this time.
0 commit comments