diff --git a/crypto/secp256k1/secp256k1.go b/crypto/secp256k1/secp256k1.go index fc64a0b0f..0ff64be13 100644 --- a/crypto/secp256k1/secp256k1.go +++ b/crypto/secp256k1/secp256k1.go @@ -12,7 +12,9 @@ import ( secp256k1 "github.com/btcsuite/btcd/btcec" - amino "github.com/tendermint/go-amino" + insecp256k1 "github.com/tendermint/tendermint/crypto/secp256k1/internal/secp256k1" + + "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/crypto" ) @@ -65,6 +67,14 @@ func (privKey PrivKeySecp256k1) Equals(other crypto.PrivKey) bool { return false } +// RecoverPubkey returns the public key of the signer. +// msg must be the 32-byte hash of the message to be signed. +// sig must be a 65-byte compact ECDSA signature containing the +// recovery id as the last element. +func RecoverPubkey(msg []byte, sig []byte) ([]byte, error) { + return insecp256k1.RecoverPubkey(msg, sig) +} + // GenPrivKey generates a new ECDSA private key on curve secp256k1 private key. // It uses OS randomness to generate the private key. func GenPrivKey() PrivKeySecp256k1 {