Skip to content

Commit

Permalink
chore: update to latest btcec (#6)
Browse files Browse the repository at this point in the history
Signed-off-by: Volodymyr Kubiv <[email protected]>
  • Loading branch information
vkubiv authored Nov 17, 2023
1 parent 30e78b6 commit d71ec97
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 18 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module github.com/trustbloc/sidetree-go

require (
github.com/btcsuite/btcd v0.22.3
github.com/btcsuite/btcd/btcec/v2 v2.1.3
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/evanphx/json-patch v4.1.0+incompatible
github.com/multiformats/go-multibase v0.0.1
Expand All @@ -18,6 +18,7 @@ require (

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
Expand Down
9 changes: 5 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.22.3 h1:kYNaWFvOw6xvqP0vR20RP1Zq1DVMBxEO8QN5d1/EfNg=
github.com/btcsuite/btcd v0.22.3/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btcd/btcec/v2 v2.1.3 h1:xM/n3yIhHAhHy04z4i43C8p4ehixJZMsnrVJkgl+MTE=
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ=
Expand All @@ -18,6 +16,9 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/evanphx/json-patch v4.1.0+incompatible h1:K1MDoo4AZ4wU0GIU/fPmtZg7VpzLjCxu+UwBD1FvwOc=
github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down
13 changes: 7 additions & 6 deletions pkg/jwsutil/jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"math/big"
"strings"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/square/go-jose/v3"
"github.com/square/go-jose/v3/json"
"golang.org/x/crypto/ed25519"
Expand Down Expand Up @@ -47,12 +47,13 @@ func (j *JWK) PublicKeyBytes() ([]byte, error) {
ecPubKey = &j.Key.(*ecdsa.PrivateKey).PublicKey
}

pubKey := &btcec.PublicKey{
Curve: btcec.S256(),
X: ecPubKey.X,
Y: ecPubKey.Y,
}
x := &btcec.FieldVal{}
x.SetByteSlice(ecPubKey.X.Bytes())

y := &btcec.FieldVal{}
y.SetByteSlice(ecPubKey.Y.Bytes())

pubKey := btcec.NewPublicKey(x, y)
return pubKey.SerializeCompressed(), nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/jwsutil/jwk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"crypto/rand"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/square/go-jose/v3"
"github.com/square/go-jose/v3/json"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion pkg/jwsutil/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"fmt"
"math/big"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"

"github.com/trustbloc/sidetree-go/pkg/jws"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/jwsutil/signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"reflect"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
gojose "github.com/square/go-jose/v3"
"github.com/square/go-jose/v3/json"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/ecsigner/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"crypto/rand"
"errors"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"

"github.com/trustbloc/sidetree-go/pkg/jws"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/ecsigner/signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"crypto/rand"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/util/pubkey/jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"fmt"
"reflect"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
gojose "github.com/square/go-jose/v3"
"github.com/square/go-jose/v3/json"

Expand Down
2 changes: 1 addition & 1 deletion pkg/util/pubkey/jwk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"crypto/rand"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"
)

Expand Down

0 comments on commit d71ec97

Please sign in to comment.