aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/keypair.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain/keypair.go')
-rw-r--r--ethchain/keypair.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/ethchain/keypair.go b/ethchain/keypair.go
index a5af791d0..0f23bacdf 100644
--- a/ethchain/keypair.go
+++ b/ethchain/keypair.go
@@ -2,6 +2,7 @@ package ethchain
import (
"github.com/ethereum/eth-go/ethutil"
+ "github.com/obscuren/secp256k1-go"
"math/big"
)
@@ -14,6 +15,15 @@ type KeyPair struct {
state *State
}
+func NewKeyPairFromSec(seckey []byte) (*KeyPair, error) {
+ pubkey, err := secp256k1.GeneratePubKey(seckey)
+ if err != nil {
+ return nil, err
+ }
+
+ return &KeyPair{PrivateKey: seckey, PublicKey: pubkey}, nil
+}
+
func NewKeyPairFromValue(val *ethutil.Value) *KeyPair {
keyPair := &KeyPair{PrivateKey: val.Get(0).Bytes(), PublicKey: val.Get(1).Bytes()}