Skip to content

Commit

Permalink
re-export S256()
Browse files Browse the repository at this point in the history
  • Loading branch information
e-asphyx committed Jan 23, 2025
1 parent 22d7e23 commit 5f7387b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions crypt/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"math/big"

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

case *tz.Secp256k1PrivateKey:
p, err := unmarshalPrivateKey(key[:], secp256k1.S256())
p, err := unmarshalPrivateKey(key[:], S256())
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -106,7 +105,7 @@ func NewPublicKey(pub tz.PublicKey) (PublicKey, error) {
)
switch key := pub.(type) {
case *tz.Secp256k1PublicKey:
curve = secp256k1.S256()
curve = S256()
data = key[:]
case *tz.P256PublicKey:
curve = elliptic.P256()
Expand Down Expand Up @@ -134,7 +133,7 @@ func NewPrivateKeyFrom(priv crypto.PrivateKey) (PrivateKey, error) {
switch priv := priv.(type) {
case *ecdsa.PrivateKey:
switch priv.Curve {
case secp256k1.S256(), elliptic.P256():
case S256(), elliptic.P256():
return (*ECDSAPrivateKey)(priv), nil
default:
return nil, ErrUnsupportedKeyType
Expand All @@ -154,7 +153,7 @@ func NewPublicKeyFrom(pub crypto.PublicKey) (PublicKey, error) {
switch pub := pub.(type) {
case *ecdsa.PublicKey:
switch pub.Curve {
case secp256k1.S256(), elliptic.P256():
case S256(), elliptic.P256():
return (*ECDSAPublicKey)(pub), nil
default:
return nil, ErrUnsupportedKeyType
Expand Down Expand Up @@ -184,7 +183,7 @@ func NewSignature(sig tz.Signature) (Signature, error) {
return &ECDSASignature{
R: r,
S: s,
Curve: secp256k1.S256(),
Curve: S256(),
}, nil

case *tz.P256Signature:
Expand Down
2 changes: 2 additions & 0 deletions crypt/ecdsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
tz "github.com/ecadlabs/gotez/v2"
)

func S256() *secp256k1.KoblitzCurve { return secp256k1.S256() }

type ECDSAPrivateKey ecdsa.PrivateKey

func (priv *ECDSAPrivateKey) ToBase58() []byte {
Expand Down

0 comments on commit 5f7387b

Please sign in to comment.