Skip to content

Commit 5f7387b

Browse files
committed
re-export S256()
1 parent 22d7e23 commit 5f7387b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

crypt/common.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"fmt"
1111
"math/big"
1212

13-
"github.com/decred/dcrd/dcrec/secp256k1/v4"
1413
"github.com/ecadlabs/goblst/minpk"
1514
tz "github.com/ecadlabs/gotez/v2"
1615
"github.com/ecadlabs/gotez/v2/b58"
@@ -66,7 +65,7 @@ func NewPrivateKey(priv tz.PrivateKey) (PrivateKey, error) {
6665
return Ed25519PrivateKey(ed25519.NewKeyFromSeed(key[:])), nil
6766

6867
case *tz.Secp256k1PrivateKey:
69-
p, err := unmarshalPrivateKey(key[:], secp256k1.S256())
68+
p, err := unmarshalPrivateKey(key[:], S256())
7069
if err != nil {
7170
return nil, err
7271
}
@@ -106,7 +105,7 @@ func NewPublicKey(pub tz.PublicKey) (PublicKey, error) {
106105
)
107106
switch key := pub.(type) {
108107
case *tz.Secp256k1PublicKey:
109-
curve = secp256k1.S256()
108+
curve = S256()
110109
data = key[:]
111110
case *tz.P256PublicKey:
112111
curve = elliptic.P256()
@@ -134,7 +133,7 @@ func NewPrivateKeyFrom(priv crypto.PrivateKey) (PrivateKey, error) {
134133
switch priv := priv.(type) {
135134
case *ecdsa.PrivateKey:
136135
switch priv.Curve {
137-
case secp256k1.S256(), elliptic.P256():
136+
case S256(), elliptic.P256():
138137
return (*ECDSAPrivateKey)(priv), nil
139138
default:
140139
return nil, ErrUnsupportedKeyType
@@ -154,7 +153,7 @@ func NewPublicKeyFrom(pub crypto.PublicKey) (PublicKey, error) {
154153
switch pub := pub.(type) {
155154
case *ecdsa.PublicKey:
156155
switch pub.Curve {
157-
case secp256k1.S256(), elliptic.P256():
156+
case S256(), elliptic.P256():
158157
return (*ECDSAPublicKey)(pub), nil
159158
default:
160159
return nil, ErrUnsupportedKeyType
@@ -184,7 +183,7 @@ func NewSignature(sig tz.Signature) (Signature, error) {
184183
return &ECDSASignature{
185184
R: r,
186185
S: s,
187-
Curve: secp256k1.S256(),
186+
Curve: S256(),
188187
}, nil
189188

190189
case *tz.P256Signature:

crypt/ecdsa.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
tz "github.com/ecadlabs/gotez/v2"
1313
)
1414

15+
func S256() *secp256k1.KoblitzCurve { return secp256k1.S256() }
16+
1517
type ECDSAPrivateKey ecdsa.PrivateKey
1618

1719
func (priv *ECDSAPrivateKey) ToBase58() []byte {

0 commit comments

Comments
 (0)