forked from cerc-io/laconicd-deprecated
crypto: updates from reviews (#535)
This commit is contained in:
+7
-2
@@ -74,14 +74,19 @@ func UnsafeExportEthKeyCommand() *cobra.Command {
|
||||
return fmt.Errorf("invalid key algorithm, got %s, expected %s", algo, ethsecp256k1.KeyType)
|
||||
}
|
||||
|
||||
// Converts key to Ethermint secp256 implementation
|
||||
// Converts key to Ethermint secp256k1 implementation
|
||||
ethPrivKey, ok := privKey.(*ethsecp256k1.PrivKey)
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid private key type %T, expected %T", privKey, ðsecp256k1.PrivKey{})
|
||||
}
|
||||
|
||||
key, err := ethPrivKey.ToECDSA()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Formats key for output
|
||||
privB := ethcrypto.FromECDSA(ethPrivKey.ToECDSA())
|
||||
privB := ethcrypto.FromECDSA(key)
|
||||
keyS := strings.ToUpper(hexutil.Encode(privB)[2:])
|
||||
|
||||
fmt.Println(keyS)
|
||||
|
||||
Reference in New Issue
Block a user