Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #138 from binance-chain/side_slash
Browse files Browse the repository at this point in the history
expose RecoverPubkey from internal secp256k1
  • Loading branch information
fletcher142 authored Apr 30, 2020
2 parents 2f1f700 + 71347d2 commit 39f228d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crypto/secp256k1/secp256k1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 39f228d

Please sign in to comment.