diff --git a/cmd/aries-agent-mobile/go.mod b/cmd/aries-agent-mobile/go.mod index 4fc44074b..752471290 100644 --- a/cmd/aries-agent-mobile/go.mod +++ b/cmd/aries-agent-mobile/go.mod @@ -27,6 +27,7 @@ require ( github.com/cenkalti/backoff/v4 v4.0.2 // indirect github.com/cespare/xxhash/v2 v2.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/tink/go v1.7.0 // indirect @@ -51,7 +52,6 @@ require ( github.com/pquerna/cachecontrol v0.1.0 // indirect github.com/rs/cors v1.7.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 // indirect github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8 // indirect github.com/tidwall/gjson v1.6.7 // indirect github.com/tidwall/match v1.0.3 // indirect diff --git a/cmd/aries-agent-mobile/go.sum b/cmd/aries-agent-mobile/go.sum index 9c7026966..577b657c6 100644 --- a/cmd/aries-agent-mobile/go.sum +++ b/cmd/aries-agent-mobile/go.sum @@ -35,6 +35,8 @@ 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/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 h1:w5li6eMV6NCHh1YVbKRM/gMCVtZ2w7mnwq78eNnHXQQ= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -120,8 +122,6 @@ github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 h1:wD1IWQwAhdWclCwaf6DdzgCAe9Bfz1M+4AHRd7N786Y= -github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693/go.mod h1:6hSY48PjDm4UObWmGLyJE9DxYVKTgR9kbCspXXJEhcU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= diff --git a/cmd/aries-agent-rest/go.mod b/cmd/aries-agent-rest/go.mod index 91285a90a..4cd4b304c 100644 --- a/cmd/aries-agent-rest/go.mod +++ b/cmd/aries-agent-rest/go.mod @@ -28,6 +28,7 @@ require ( github.com/cenkalti/backoff v2.2.1+incompatible // indirect github.com/cespare/xxhash/v2 v2.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 // indirect github.com/go-kivik/couchdb/v3 v3.2.6 // indirect github.com/go-kivik/kivik/v3 v3.2.3 // indirect github.com/go-sql-driver/mysql v1.5.0 // indirect @@ -67,7 +68,6 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pquerna/cachecontrol v0.1.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 // indirect github.com/syndtr/goleveldb v1.0.0 // indirect github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8 // indirect github.com/tidwall/gjson v1.6.7 // indirect diff --git a/cmd/aries-agent-rest/go.sum b/cmd/aries-agent-rest/go.sum index 4f5a51ab8..7596dd73c 100644 --- a/cmd/aries-agent-rest/go.sum +++ b/cmd/aries-agent-rest/go.sum @@ -110,6 +110,8 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 h1:w5li6eMV6NCHh1YVbKRM/gMCVtZ2w7mnwq78eNnHXQQ= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -493,8 +495,6 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 h1:wD1IWQwAhdWclCwaf6DdzgCAe9Bfz1M+4AHRd7N786Y= -github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693/go.mod h1:6hSY48PjDm4UObWmGLyJE9DxYVKTgR9kbCspXXJEhcU= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= diff --git a/cmd/aries-js-worker/go.mod b/cmd/aries-js-worker/go.mod index afcea297a..c99217082 100644 --- a/cmd/aries-js-worker/go.mod +++ b/cmd/aries-js-worker/go.mod @@ -25,6 +25,7 @@ require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/tink/go v1.7.0 // indirect @@ -51,7 +52,6 @@ require ( github.com/pquerna/cachecontrol v0.1.0 // indirect github.com/rs/cors v1.7.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 // indirect github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8 // indirect github.com/tidwall/gjson v1.6.7 // indirect github.com/tidwall/match v1.0.3 // indirect diff --git a/cmd/aries-js-worker/go.sum b/cmd/aries-js-worker/go.sum index 1b1bcdedd..a8d2a8b5f 100644 --- a/cmd/aries-js-worker/go.sum +++ b/cmd/aries-js-worker/go.sum @@ -36,6 +36,8 @@ 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/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 h1:w5li6eMV6NCHh1YVbKRM/gMCVtZ2w7mnwq78eNnHXQQ= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -118,8 +120,6 @@ github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 h1:wD1IWQwAhdWclCwaf6DdzgCAe9Bfz1M+4AHRd7N786Y= -github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693/go.mod h1:6hSY48PjDm4UObWmGLyJE9DxYVKTgR9kbCspXXJEhcU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= diff --git a/component/storageutil/go.sum b/component/storageutil/go.sum index cc7d3c6de..35d23fedd 100644 --- a/component/storageutil/go.sum +++ b/component/storageutil/go.sum @@ -3,7 +3,6 @@ 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/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hyperledger/aries-framework-go/spi v0.0.0-20211203210130-e927c9ed581a/go.mod h1:dBYKKD8U8U9o0g5BdNFFaRtjt9KTkiAYfQt+TTp+w1o= github.com/hyperledger/aries-framework-go/spi v0.0.0-20220322085443-50e8f9bd208b h1:Fo9mK3eB+TiYu2/hbTWtt0kWg9j1QRqnnbQQqaytJzE= github.com/hyperledger/aries-framework-go/spi v0.0.0-20220322085443-50e8f9bd208b/go.mod h1:4bD5c5fj5K7rkQurVa/8I8+TfNcI4bxIBzaUNcxTOTg= github.com/hyperledger/aries-framework-go/test/component v0.0.0-20220322085443-50e8f9bd208b h1:tq8CYv5vCJBSG2CjWKNt4l1BzZVJUy+GGF4U80fJV8o= @@ -16,7 +15,6 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/go.mod b/go.mod index 622e62a97..b5c672235 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/btcsuite/btcd v0.22.0-beta github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cenkalti/backoff/v4 v4.0.2 + github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 github.com/golang/mock v1.4.4 github.com/golang/protobuf v1.5.2 github.com/google/tink/go v1.7.0 @@ -32,7 +33,6 @@ require ( github.com/piprate/json-gold v0.4.2 github.com/pkg/errors v0.9.1 github.com/rs/cors v1.7.0 - github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 github.com/stretchr/testify v1.8.1 github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8 github.com/tidwall/gjson v1.6.7 @@ -70,3 +70,11 @@ require ( ) go 1.19 + +//replace github.com/square/go-jose/v3 => github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 +// +//replace github.com/square/go-jose/v3/json => github.com/go-jose/go-jose/v3/json v1.0.1-0.20221117193127-916db76e8214 +// +//replace github.com/square/go-jose/v3/jwt => github.com/go-jose/go-jose/v3/jwt v1.0.1-0.20221117193127-916db76e8214 +// +//replace github.com/square/go-jose/v3/cipher => github.com/go-jose/go-jose/v3/cipher v1.0.1-0.20221117193127-916db76e8214 diff --git a/go.sum b/go.sum index 2ed733652..34ed5ed42 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,8 @@ 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/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 h1:w5li6eMV6NCHh1YVbKRM/gMCVtZ2w7mnwq78eNnHXQQ= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -127,8 +129,6 @@ github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 h1:wD1IWQwAhdWclCwaf6DdzgCAe9Bfz1M+4AHRd7N786Y= -github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693/go.mod h1:6hSY48PjDm4UObWmGLyJE9DxYVKTgR9kbCspXXJEhcU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= diff --git a/pkg/controller/command/kms/command_test.go b/pkg/controller/command/kms/command_test.go index 1d997fbf8..e60b0667c 100644 --- a/pkg/controller/command/kms/command_test.go +++ b/pkg/controller/command/kms/command_test.go @@ -17,7 +17,7 @@ import ( "fmt" "testing" - "github.com/square/go-jose/v3" + "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/jose/jwk" diff --git a/pkg/controller/webnotifier/webhook_test.go b/pkg/controller/webnotifier/webhook_test.go index 0fdf2a608..1885ab3e3 100644 --- a/pkg/controller/webnotifier/webhook_test.go +++ b/pkg/controller/webnotifier/webhook_test.go @@ -15,8 +15,8 @@ import ( "testing" "time" + "github.com/go-jose/go-jose/v3/json" "github.com/google/uuid" - "github.com/square/go-jose/v3/json" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/internal/test/transportutil" diff --git a/pkg/crypto/tinkcrypto/key_wrapper.go b/pkg/crypto/tinkcrypto/key_wrapper.go index 5399920fb..c8644036a 100644 --- a/pkg/crypto/tinkcrypto/key_wrapper.go +++ b/pkg/crypto/tinkcrypto/key_wrapper.go @@ -14,9 +14,9 @@ import ( "fmt" "math/big" + josecipher "github.com/go-jose/go-jose/v3/cipher" hybrid "github.com/google/tink/go/hybrid/subtle" "github.com/google/tink/go/keyset" - josecipher "github.com/square/go-jose/v3/cipher" "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/curve25519" diff --git a/pkg/crypto/tinkcrypto/primitive/aead/subtle/aes_cbc_test.go b/pkg/crypto/tinkcrypto/primitive/aead/subtle/aes_cbc_test.go index b433176b4..15288906f 100644 --- a/pkg/crypto/tinkcrypto/primitive/aead/subtle/aes_cbc_test.go +++ b/pkg/crypto/tinkcrypto/primitive/aead/subtle/aes_cbc_test.go @@ -13,8 +13,8 @@ import ( "fmt" "testing" + josecipher "github.com/go-jose/go-jose/v3/cipher" "github.com/google/tink/go/subtle/random" - josecipher "github.com/square/go-jose/v3/cipher" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/crypto/tinkcrypto/primitive/aead/subtle" diff --git a/pkg/crypto/tinkcrypto/primitive/aead/subtle/gojose_aes_cbc_hmac.go b/pkg/crypto/tinkcrypto/primitive/aead/subtle/gojose_aes_cbc_hmac.go index 7c367de9d..b138fbcf5 100644 --- a/pkg/crypto/tinkcrypto/primitive/aead/subtle/gojose_aes_cbc_hmac.go +++ b/pkg/crypto/tinkcrypto/primitive/aead/subtle/gojose_aes_cbc_hmac.go @@ -11,8 +11,8 @@ import ( "errors" "fmt" + josecipher "github.com/go-jose/go-jose/v3/cipher" "github.com/google/tink/go/subtle/random" - josecipher "github.com/square/go-jose/v3/cipher" ) // AESCBCHMAC is an implementation of AEAD interface. diff --git a/pkg/crypto/tinkcrypto/primitive/aead/subtle/gojose_aes_cbc_hmac_test.go b/pkg/crypto/tinkcrypto/primitive/aead/subtle/gojose_aes_cbc_hmac_test.go index dfa3b2ad7..2536d950d 100644 --- a/pkg/crypto/tinkcrypto/primitive/aead/subtle/gojose_aes_cbc_hmac_test.go +++ b/pkg/crypto/tinkcrypto/primitive/aead/subtle/gojose_aes_cbc_hmac_test.go @@ -13,7 +13,7 @@ import ( "fmt" "testing" - josecipher "github.com/square/go-jose/v3/cipher" + josecipher "github.com/go-jose/go-jose/v3/cipher" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/crypto/tinkcrypto/primitive/aead/subtle" @@ -308,7 +308,7 @@ func RunRoundtrip(t *testing.T, key []byte) { t.Run("failure: cipher not short but not large enough to contain an authentication tag", func(t *testing.T) { result, err = aead.Decrypt([]byte("bad cipher with not too short length to cause decryption failure"), aad) - require.EqualError(t, err, "aes_cbc_hmac: failed to decrypt: square/go-jose: invalid ciphertext "+ + require.EqualError(t, err, "aes_cbc_hmac: failed to decrypt: go-jose/go-jose: invalid ciphertext "+ "(auth tag mismatch)") }) } diff --git a/pkg/crypto/tinkcrypto/wrap_support.go b/pkg/crypto/tinkcrypto/wrap_support.go index 22df984dd..7be12b3fd 100644 --- a/pkg/crypto/tinkcrypto/wrap_support.go +++ b/pkg/crypto/tinkcrypto/wrap_support.go @@ -18,8 +18,8 @@ import ( "errors" "fmt" + josecipher "github.com/go-jose/go-jose/v3/cipher" hybrid "github.com/google/tink/go/hybrid/subtle" - josecipher "github.com/square/go-jose/v3/cipher" "golang.org/x/crypto/chacha20poly1305" "github.com/hyperledger/aries-framework-go/pkg/crypto/tinkcrypto/primitive/aead/subtle" diff --git a/pkg/didcomm/common/peerdid/creator.go b/pkg/didcomm/common/peerdid/creator.go index 90c615197..597277596 100644 --- a/pkg/didcomm/common/peerdid/creator.go +++ b/pkg/didcomm/common/peerdid/creator.go @@ -10,7 +10,7 @@ import ( "encoding/json" "fmt" - gojose "github.com/square/go-jose/v3" + gojose "github.com/go-jose/go-jose/v3" "github.com/hyperledger/aries-framework-go/pkg/crypto" "github.com/hyperledger/aries-framework-go/pkg/doc/did" diff --git a/pkg/didcomm/packer/anoncrypt/pack_test.go b/pkg/didcomm/packer/anoncrypt/pack_test.go index 7eb6ffabe..b9748bf10 100644 --- a/pkg/didcomm/packer/anoncrypt/pack_test.go +++ b/pkg/didcomm/packer/anoncrypt/pack_test.go @@ -18,12 +18,12 @@ import ( "strings" "testing" + "github.com/go-jose/go-jose/v3" "github.com/golang/protobuf/proto" hybrid "github.com/google/tink/go/hybrid/subtle" "github.com/google/tink/go/keyset" commonpb "github.com/google/tink/go/proto/common_go_proto" tinkpb "github.com/google/tink/go/proto/tink_go_proto" - "github.com/square/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/common/log" diff --git a/pkg/didcomm/packer/authcrypt/pack_test.go b/pkg/didcomm/packer/authcrypt/pack_test.go index c25960d02..2f748559c 100644 --- a/pkg/didcomm/packer/authcrypt/pack_test.go +++ b/pkg/didcomm/packer/authcrypt/pack_test.go @@ -18,12 +18,12 @@ import ( "strings" "testing" + "github.com/go-jose/go-jose/v3" "github.com/golang/protobuf/proto" hybrid "github.com/google/tink/go/hybrid/subtle" "github.com/google/tink/go/keyset" commonpb "github.com/google/tink/go/proto/common_go_proto" tinkpb "github.com/google/tink/go/proto/tink_go_proto" - "github.com/square/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/common/log" diff --git a/pkg/didcomm/protocol/didexchange/keys.go b/pkg/didcomm/protocol/didexchange/keys.go index acb9caef6..70e09cb49 100644 --- a/pkg/didcomm/protocol/didexchange/keys.go +++ b/pkg/didcomm/protocol/didexchange/keys.go @@ -10,7 +10,7 @@ import ( "encoding/json" "fmt" - gojose "github.com/square/go-jose/v3" + gojose "github.com/go-jose/go-jose/v3" "github.com/hyperledger/aries-framework-go/pkg/crypto" "github.com/hyperledger/aries-framework-go/pkg/doc/did" diff --git a/pkg/didcomm/protocol/didexchange/states_test.go b/pkg/didcomm/protocol/didexchange/states_test.go index 0fd5882f6..7a3c4926c 100644 --- a/pkg/didcomm/protocol/didexchange/states_test.go +++ b/pkg/didcomm/protocol/didexchange/states_test.go @@ -1501,7 +1501,7 @@ func TestContext_DIDDocAttachment(t *testing.T) { doc := mockdiddoc.GetMockDIDDoc(t, false) - didKey, _ := fingerprint.CreateDIDKey([]byte("abcdefghabcdefghabcdefghabcdefgh~!@#")) + didKey, _ := fingerprint.CreateDIDKey([]byte{}) _, err := ctx.didDocAttachment(doc, didKey) require.Error(t, err) diff --git a/pkg/didcomm/protocol/outofbandv2/service.go b/pkg/didcomm/protocol/outofbandv2/service.go index 47d464971..c0ba19ccc 100644 --- a/pkg/didcomm/protocol/outofbandv2/service.go +++ b/pkg/didcomm/protocol/outofbandv2/service.go @@ -12,8 +12,8 @@ import ( "fmt" "strings" + gojose "github.com/go-jose/go-jose/v3" "github.com/google/uuid" - gojose "github.com/square/go-jose/v3" "github.com/hyperledger/aries-framework-go/pkg/common/log" "github.com/hyperledger/aries-framework-go/pkg/common/model" diff --git a/pkg/doc/did/doc_test.go b/pkg/doc/did/doc_test.go index 65ec84bdc..5db0301dc 100644 --- a/pkg/doc/did/doc_test.go +++ b/pkg/doc/did/doc_test.go @@ -20,7 +20,7 @@ import ( "time" "github.com/btcsuite/btcutil/base58" - gojose "github.com/square/go-jose/v3" + gojose "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/common/model" diff --git a/pkg/doc/jose/common_test.go b/pkg/doc/jose/common_test.go index ab0a4e636..b103b4b65 100644 --- a/pkg/doc/jose/common_test.go +++ b/pkg/doc/jose/common_test.go @@ -11,7 +11,7 @@ import ( "encoding/json" "testing" - "github.com/square/go-jose/v3" + "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/jose/jwk" diff --git a/pkg/doc/jose/encrypter.go b/pkg/doc/jose/encrypter.go index 7662fba4c..f6a7f11cf 100644 --- a/pkg/doc/jose/encrypter.go +++ b/pkg/doc/jose/encrypter.go @@ -20,10 +20,10 @@ import ( "sort" "strings" + "github.com/go-jose/go-jose/v3" hybrid "github.com/google/tink/go/hybrid/subtle" "github.com/google/tink/go/keyset" "github.com/google/tink/go/subtle/random" - "github.com/square/go-jose/v3" "golang.org/x/crypto/curve25519" cryptoapi "github.com/hyperledger/aries-framework-go/pkg/crypto" diff --git a/pkg/doc/jose/encrypter_decrypter_test.go b/pkg/doc/jose/encrypter_decrypter_test.go index 4c76054ba..2e8ecb575 100644 --- a/pkg/doc/jose/encrypter_decrypter_test.go +++ b/pkg/doc/jose/encrypter_decrypter_test.go @@ -21,11 +21,11 @@ import ( "testing" "time" + "github.com/go-jose/go-jose/v3" hybrid "github.com/google/tink/go/hybrid/subtle" "github.com/google/tink/go/keyset" tinkpb "github.com/google/tink/go/proto/tink_go_proto" "github.com/google/tink/go/subtle" - "github.com/square/go-jose/v3" "github.com/stretchr/testify/require" cryptoapi "github.com/hyperledger/aries-framework-go/pkg/crypto" @@ -61,7 +61,7 @@ func TestJWEEncryptRoundTrip(t *testing.T) { "NewJWEEncrypt should fail with empty recipientPubKeys") singleRecipientNISTPKWError := "jwedecrypt: failed to unwrap cek: [unwrapKey: deriveKEKAndUnwrap:" + - " failed to AES unwrap key: square/go-jose: key wrap input must be 8 byte blocks]" + " failed to AES unwrap key: go-jose/go-jose: key wrap input must be 8 byte blocks]" singleRecipientX25519KWError := "jwedecrypt: failed to unwrap cek: [unwrapKey: deriveKEKAndUnwrap: failed to XC20P " + "unwrap key: unwrap support: OKP unwrap invalid key]" diff --git a/pkg/doc/jose/jwe_test.go b/pkg/doc/jose/jwe_test.go index 952a4a23c..61c3839d2 100644 --- a/pkg/doc/jose/jwe_test.go +++ b/pkg/doc/jose/jwe_test.go @@ -12,7 +12,7 @@ import ( "errors" "testing" - "github.com/square/go-jose/v3" + "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" ) diff --git a/pkg/doc/jose/jwk/jwk.go b/pkg/doc/jose/jwk/jwk.go index 4484c30cb..23ceb43c4 100644 --- a/pkg/doc/jose/jwk/jwk.go +++ b/pkg/doc/jose/jwk/jwk.go @@ -19,7 +19,7 @@ import ( "strings" "github.com/btcsuite/btcd/btcec" - "github.com/square/go-jose/v3" + "github.com/go-jose/go-jose/v3" "golang.org/x/crypto/ed25519" "github.com/hyperledger/aries-framework-go/pkg/crypto/primitive/bbs12381g2pub" diff --git a/pkg/doc/jose/jwk/jwk_test.go b/pkg/doc/jose/jwk/jwk_test.go index fc424e0d8..896934431 100644 --- a/pkg/doc/jose/jwk/jwk_test.go +++ b/pkg/doc/jose/jwk/jwk_test.go @@ -15,8 +15,8 @@ import ( "testing" "github.com/btcsuite/btcd/btcec" - "github.com/square/go-jose/v3" - "github.com/square/go-jose/v3/json" + "github.com/go-jose/go-jose/v3" + "github.com/go-jose/go-jose/v3/json" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/crypto/primitive/bbs12381g2pub" diff --git a/pkg/doc/jose/jwk/jwksupport/jwk.go b/pkg/doc/jose/jwk/jwksupport/jwk.go index eb2b184bc..b53717720 100644 --- a/pkg/doc/jose/jwk/jwksupport/jwk.go +++ b/pkg/doc/jose/jwk/jwksupport/jwk.go @@ -16,7 +16,7 @@ import ( "fmt" "math/big" - "github.com/square/go-jose/v3" + "github.com/go-jose/go-jose/v3" cryptoapi "github.com/hyperledger/aries-framework-go/pkg/crypto" "github.com/hyperledger/aries-framework-go/pkg/crypto/primitive/bbs12381g2pub" diff --git a/pkg/doc/jose/jwk/jwksupport/jwk_test.go b/pkg/doc/jose/jwk/jwksupport/jwk_test.go index cd7a6ebb6..569353c55 100644 --- a/pkg/doc/jose/jwk/jwksupport/jwk_test.go +++ b/pkg/doc/jose/jwk/jwksupport/jwk_test.go @@ -19,7 +19,7 @@ import ( "strings" "testing" - "github.com/square/go-jose/v3" + "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" cryptoapi "github.com/hyperledger/aries-framework-go/pkg/crypto" diff --git a/pkg/doc/jose/jws.go b/pkg/doc/jose/jws.go index 9dc49417e..07d924d99 100644 --- a/pkg/doc/jose/jws.go +++ b/pkg/doc/jose/jws.go @@ -12,7 +12,7 @@ import ( "fmt" "strings" - "github.com/square/go-jose/v3/json" + "github.com/go-jose/go-jose/v3/json" ) const ( diff --git a/pkg/doc/jwt/jwt.go b/pkg/doc/jwt/jwt.go index 4a0cf6597..e6abf0be5 100644 --- a/pkg/doc/jwt/jwt.go +++ b/pkg/doc/jwt/jwt.go @@ -14,8 +14,8 @@ import ( "reflect" "strings" - "github.com/square/go-jose/v3/json" - "github.com/square/go-jose/v3/jwt" + "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v3/jwt" "github.com/hyperledger/aries-framework-go/pkg/doc/jose" ) diff --git a/pkg/doc/jwt/jwt_test.go b/pkg/doc/jwt/jwt_test.go index 79774b691..35b8e8084 100644 --- a/pkg/doc/jwt/jwt_test.go +++ b/pkg/doc/jwt/jwt_test.go @@ -16,8 +16,8 @@ import ( "testing" "time" - "github.com/square/go-jose/v3/json" - "github.com/square/go-jose/v3/jwt" + "github.com/go-jose/go-jose/v3/json" + "github.com/go-jose/go-jose/v3/jwt" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/jose" diff --git a/pkg/doc/jwt/verifier.go b/pkg/doc/jwt/verifier.go index 7d2d3834d..ae9517b4a 100644 --- a/pkg/doc/jwt/verifier.go +++ b/pkg/doc/jwt/verifier.go @@ -14,7 +14,7 @@ import ( "fmt" "strings" - "github.com/square/go-jose/v3/json" + "github.com/go-jose/go-jose/v3/json" "golang.org/x/crypto/ed25519" "github.com/hyperledger/aries-framework-go/pkg/doc/jose" diff --git a/pkg/doc/jwt/verifier_test.go b/pkg/doc/jwt/verifier_test.go index 339e9e1f3..cf8427031 100644 --- a/pkg/doc/jwt/verifier_test.go +++ b/pkg/doc/jwt/verifier_test.go @@ -19,8 +19,8 @@ import ( "strings" "testing" + "github.com/go-jose/go-jose/v3/json" "github.com/pkg/errors" - "github.com/square/go-jose/v3/json" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/jose" diff --git a/pkg/doc/signature/suite/ecdsasecp256k1signature2019/public_key_verifier_test.go b/pkg/doc/signature/suite/ecdsasecp256k1signature2019/public_key_verifier_test.go index 1d0e1a966..8dd2ad728 100644 --- a/pkg/doc/signature/suite/ecdsasecp256k1signature2019/public_key_verifier_test.go +++ b/pkg/doc/signature/suite/ecdsasecp256k1signature2019/public_key_verifier_test.go @@ -9,7 +9,7 @@ package ecdsasecp256k1signature2019 import ( "testing" - gojose "github.com/square/go-jose/v3" + gojose "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/crypto/tinkcrypto" diff --git a/pkg/doc/signature/suite/jsonwebsignature2020/public_key_verifier_test.go b/pkg/doc/signature/suite/jsonwebsignature2020/public_key_verifier_test.go index b57324dd0..ef7597815 100644 --- a/pkg/doc/signature/suite/jsonwebsignature2020/public_key_verifier_test.go +++ b/pkg/doc/signature/suite/jsonwebsignature2020/public_key_verifier_test.go @@ -12,7 +12,7 @@ import ( "testing" "github.com/btcsuite/btcd/btcec" - gojose "github.com/square/go-jose/v3" + gojose "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/crypto/tinkcrypto" diff --git a/pkg/doc/signature/verifier/public_key_verifier.go b/pkg/doc/signature/verifier/public_key_verifier.go index ca5fb424a..89f9f686d 100644 --- a/pkg/doc/signature/verifier/public_key_verifier.go +++ b/pkg/doc/signature/verifier/public_key_verifier.go @@ -20,7 +20,7 @@ import ( "strings" "github.com/btcsuite/btcd/btcec" - gojose "github.com/square/go-jose/v3" + gojose "github.com/go-jose/go-jose/v3" "github.com/hyperledger/aries-framework-go/pkg/crypto/primitive/bbs12381g2pub" "github.com/hyperledger/aries-framework-go/pkg/doc/jose/jwk" diff --git a/pkg/doc/signature/verifier/public_key_verifier_test.go b/pkg/doc/signature/verifier/public_key_verifier_test.go index e7326e9fe..450e40efa 100644 --- a/pkg/doc/signature/verifier/public_key_verifier_test.go +++ b/pkg/doc/signature/verifier/public_key_verifier_test.go @@ -16,7 +16,7 @@ import ( "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcutil/base58" - gojose "github.com/square/go-jose/v3" + gojose "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/crypto/tinkcrypto" diff --git a/pkg/doc/util/jwkkid/kid_creator.go b/pkg/doc/util/jwkkid/kid_creator.go index 78165ec19..088081533 100644 --- a/pkg/doc/util/jwkkid/kid_creator.go +++ b/pkg/doc/util/jwkkid/kid_creator.go @@ -51,13 +51,6 @@ func CreateKID(keyBytes []byte, kt kms.KeyType) (string, error) { } return x25519KID, nil - case kms.ED25519Type: // go-jose JWK thumbprint of Ed25519 has a bug, manually build it and build its resulting KID. - ed25519KID, err := createED25519KID(keyBytes) - if err != nil { - return "", fmt.Errorf("createKID: %w", err) - } - - return ed25519KID, nil case kms.BLS12381G2Type: // BBS+ as JWK thumbprint. bbsKID, err := createBLS12381G2KID(keyBytes) if err != nil { @@ -182,7 +175,7 @@ func curveSize(crv elliptic.Curve) int { } // BuildJWK builds a go jose JWK from keyBytes with key type kt. -func BuildJWK(keyBytes []byte, kt kms.KeyType) (*jwk.JWK, error) { +func BuildJWK(keyBytes []byte, kt kms.KeyType) (*jwk.JWK, error) { //nolint: gocyclo var ( j *jwk.JWK err error @@ -194,13 +187,11 @@ func BuildJWK(keyBytes []byte, kt kms.KeyType) (*jwk.JWK, error) { if err != nil { return nil, fmt.Errorf("buildJWK: failed to build JWK from ecdsa DER key: %w", err) } - // TODO remove `case kms.ED25519Type` in CreateKID() and uncomment below case when go-jose fixes Ed25519 - // JWK thumbprint. Also remove `createED25519KID(keyBytes []byte)` function further below. - // case kms.ED25519Type: - // j, err = jwksupport.JWKFromKey(ed25519.PublicKey(keyBytes)) - // if err != nil { - // return nil, fmt.Errorf("buildJWK: failed to build JWK from ed25519 key: %w", err) - // } + case kms.ED25519Type: + j, err = jwksupport.JWKFromKey(ed25519.PublicKey(keyBytes)) + if err != nil { + return nil, fmt.Errorf("buildJWK: failed to build JWK from ed25519 key: %w", err) + } case kms.ECDSAP256TypeIEEEP1363, kms.ECDSAP384TypeIEEEP1363, kms.ECDSAP521TypeIEEEP1363, kms.ECDSASecp256k1IEEEP1363: c := getCurveByKMSKeyType(kt) x, y := elliptic.Unmarshal(c, keyBytes) @@ -309,25 +300,6 @@ func createX25519KID(marshalledKey []byte) (string, error) { return base64.RawURLEncoding.EncodeToString(thumbprint), nil } -func createED25519KID(keyBytes []byte) (string, error) { - const ed25519ThumbprintTemplate = `{"crv":"Ed25519","kty":"OKP","x":"%s"}` - - lenKey := len(keyBytes) - - if lenKey > ed25519.PublicKeySize { - return "", errors.New("createED25519KID: invalid Ed25519 key") - } - - pad := make([]byte, ed25519.PublicKeySize-lenKey) - ed25519RawKey := append(pad, keyBytes...) - - j := fmt.Sprintf(ed25519ThumbprintTemplate, base64.RawURLEncoding.EncodeToString(ed25519RawKey)) - - thumbprint := sha256Sum(j) - - return base64.RawURLEncoding.EncodeToString(thumbprint), nil -} - func buildX25519JWK(keyBytes []byte) (string, error) { const x25519ThumbprintTemplate = `{"crv":"X25519","kty":"OKP","x":"%s"}` diff --git a/pkg/doc/util/jwkkid/kid_creator_test.go b/pkg/doc/util/jwkkid/kid_creator_test.go index 5ce142a96..62f0fabc6 100644 --- a/pkg/doc/util/jwkkid/kid_creator_test.go +++ b/pkg/doc/util/jwkkid/kid_creator_test.go @@ -7,7 +7,6 @@ SPDX-License-Identifier: Apache-2.0 package jwkkid import ( - "crypto" "crypto/ecdsa" "crypto/ed25519" "crypto/elliptic" @@ -27,7 +26,6 @@ import ( cryptoapi "github.com/hyperledger/aries-framework-go/pkg/crypto" "github.com/hyperledger/aries-framework-go/pkg/crypto/primitive/bbs12381g2pub" ecdhpb "github.com/hyperledger/aries-framework-go/pkg/crypto/tinkcrypto/primitive/proto/ecdh_aead_go_proto" - "github.com/hyperledger/aries-framework-go/pkg/doc/jose/jwk/jwksupport" "github.com/hyperledger/aries-framework-go/pkg/internal/cryptoutil" "github.com/hyperledger/aries-framework-go/pkg/kms" ) @@ -40,21 +38,8 @@ func TestCreateKID(t *testing.T) { require.NoError(t, err) require.NotEmpty(t, kid) - // now try building go-jose thumbprint and compare its base64URL with kid above - // they should not match since go-jose's thumbprint is built from a wrong Ed25519 JWK. - j, err := jwksupport.JWKFromKey(pubKey) - require.NoError(t, err) - - goJoseTP, err := j.Thumbprint(crypto.SHA256) - require.NoError(t, err) - - goJoseKID := base64.RawURLEncoding.EncodeToString(goJoseTP) - require.NotEqual(t, kid, goJoseKID) - - // now build bad thumbprint and ensure it matches goJoseTP - // TODO remove createBadED25519Thumbprint function when go-jose fixes the Ed25519 JWK template used for Thumbprint. - badTP := createBadED25519Thumbprint(t, pubKey) - require.EqualValues(t, goJoseTP, badTP) + correctEdKID := createED25519KID(t, pubKey) + require.Equal(t, correctEdKID, kid) _, err = CreateKID(nil, kms.ED25519Type) require.EqualError(t, err, "createKID: empty key") @@ -97,7 +82,7 @@ func TestCreateKID(t *testing.T) { _, err = CreateKID(badPubKey, kms.ECDSAP256TypeIEEEP1363) require.EqualError(t, err, "createKID: failed to build jwk: buildJWK: failed to build JWK from ecdsa key "+ - "in IEEE1363 format: create JWK: square/go-jose: invalid EC key (nil, or X/Y missing)") + "in IEEE1363 format: create JWK: go-jose/go-jose: invalid EC key (nil, or X/Y missing)") ecKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) require.NoError(t, err) @@ -221,38 +206,31 @@ func TestBuildJWKX25519(t *testing.T) { }) } -func TestCreateED25519KID_Failure(t *testing.T) { - key := &cryptoapi.PublicKey{ - Curve: "Ed25519", - X: []byte(strings.Repeat("a", ed25519.PublicKeySize+1)), // public key > Ed25519 key size - Y: []byte{}, - Type: ecdhpb.KeyType_OKP.String(), - } - - mKey, err := json.Marshal(key) - require.NoError(t, err) +func TestBuildJWK_Ed25519(t *testing.T) { + t.Run("success", func(t *testing.T) { + pubKey, _, err := ed25519.GenerateKey(rand.Reader) + require.NoError(t, err) - _, err = CreateKID(mKey, kms.ED25519Type) - require.EqualError(t, err, "createKID: createED25519KID: invalid Ed25519 key") + jwk, err := BuildJWK(pubKey, kms.ED25519Type) + require.NoError(t, err) + require.NotNil(t, jwk) + }) } -func createBadED25519Thumbprint(t *testing.T, keyBytes []byte) []byte { // similar to go-jose's Ed25519 bad thumbprint - t.Helper() - - const badED25519ThumbprintTemplate = `{"crv":"Ed25519","kty":"OKP",x":"%s"}` // <- x is missing left double quotes. - - lenKey := len(keyBytes) - require.NotZero(t, lenKey, "createED25519KID: empty Ed25519 key") - - require.LessOrEqual(t, lenKey, ed25519.PublicKeySize, "createED25519KID: invalid Ed25519 key") - - pad := make([]byte, ed25519.PublicKeySize-lenKey) - ed25519RawKey := append(pad, keyBytes...) - - jwk := fmt.Sprintf(badED25519ThumbprintTemplate, base64.RawURLEncoding.EncodeToString(ed25519RawKey)) - - return sha256Sum(jwk) -} +//func TestCreateED25519KID_Failure(t *testing.T) { +// key := &cryptoapi.PublicKey{ +// Curve: "Ed25519", +// X: []byte(strings.Repeat("a", ed25519.PublicKeySize+1)), // public key > Ed25519 key size +// Y: []byte{}, +// Type: ecdhpb.KeyType_OKP.String(), +// } +// +// mKey, err := json.Marshal(key) +// require.NoError(t, err) +// +// _, err = CreateKID(mKey, kms.ED25519Type) +// require.EqualError(t, err, "createKID: createED25519KID: invalid Ed25519 key") +//} func TestCreateBLS12381G2KID(t *testing.T) { seed := make([]byte, 32) @@ -294,3 +272,22 @@ func TestCreateSecp256K1KID(t *testing.T) { require.NotEmpty(t, kid2) }) } + +func createED25519KID(t *testing.T, keyBytes []byte) string { + t.Helper() + + const ed25519ThumbprintTemplate = `{"crv":"Ed25519","kty":"OKP","x":"%s"}` + + lenKey := len(keyBytes) + + require.True(t, lenKey <= ed25519.PublicKeySize, "createED25519KID: invalid Ed25519 key") + + pad := make([]byte, ed25519.PublicKeySize-lenKey) + ed25519RawKey := append(pad, keyBytes...) + + j := fmt.Sprintf(ed25519ThumbprintTemplate, base64.RawURLEncoding.EncodeToString(ed25519RawKey)) + + thumbprint := sha256Sum(j) + + return base64.RawURLEncoding.EncodeToString(thumbprint) +} diff --git a/pkg/doc/util/signature/signer_test.go b/pkg/doc/util/signature/signer_test.go index 0202949d5..05e0ebf3b 100644 --- a/pkg/doc/util/signature/signer_test.go +++ b/pkg/doc/util/signature/signer_test.go @@ -16,7 +16,7 @@ import ( "testing" "github.com/btcsuite/btcd/btcec" - "github.com/square/go-jose/v3" + "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/crypto/tinkcrypto" diff --git a/pkg/doc/verifiable/credential_jws_test.go b/pkg/doc/verifiable/credential_jws_test.go index 4995b142a..1f264c781 100644 --- a/pkg/doc/verifiable/credential_jws_test.go +++ b/pkg/doc/verifiable/credential_jws_test.go @@ -11,8 +11,8 @@ import ( "encoding/json" "testing" - "github.com/square/go-jose/v3" - "github.com/square/go-jose/v3/jwt" + "github.com/go-jose/go-jose/v3" + "github.com/go-jose/go-jose/v3/jwt" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/signature/verifier" diff --git a/pkg/doc/verifiable/credential_jwt.go b/pkg/doc/verifiable/credential_jwt.go index b0faf2e2e..893fd2c93 100644 --- a/pkg/doc/verifiable/credential_jwt.go +++ b/pkg/doc/verifiable/credential_jwt.go @@ -11,7 +11,7 @@ import ( "fmt" "time" - josejwt "github.com/square/go-jose/v3/jwt" + josejwt "github.com/go-jose/go-jose/v3/jwt" "github.com/hyperledger/aries-framework-go/pkg/doc/jwt" jsonutil "github.com/hyperledger/aries-framework-go/pkg/doc/util/json" diff --git a/pkg/doc/verifiable/credential_jwt_test.go b/pkg/doc/verifiable/credential_jwt_test.go index 700bf2db5..0ab07d65f 100644 --- a/pkg/doc/verifiable/credential_jwt_test.go +++ b/pkg/doc/verifiable/credential_jwt_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - josejwt "github.com/square/go-jose/v3/jwt" + josejwt "github.com/go-jose/go-jose/v3/jwt" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/jwt" diff --git a/pkg/doc/verifiable/credential_jwt_unsecured_test.go b/pkg/doc/verifiable/credential_jwt_unsecured_test.go index 667f69e3b..bf955b91d 100644 --- a/pkg/doc/verifiable/credential_jwt_unsecured_test.go +++ b/pkg/doc/verifiable/credential_jwt_unsecured_test.go @@ -9,7 +9,7 @@ import ( "encoding/json" "testing" - "github.com/square/go-jose/v3/jwt" + "github.com/go-jose/go-jose/v3/jwt" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/jose" diff --git a/pkg/doc/verifiable/presentation_jws_test.go b/pkg/doc/verifiable/presentation_jws_test.go index 18f5004f4..976a1cb83 100644 --- a/pkg/doc/verifiable/presentation_jws_test.go +++ b/pkg/doc/verifiable/presentation_jws_test.go @@ -10,8 +10,8 @@ import ( "crypto/rsa" "testing" - "github.com/square/go-jose/v3" - "github.com/square/go-jose/v3/jwt" + "github.com/go-jose/go-jose/v3" + "github.com/go-jose/go-jose/v3/jwt" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/signature/verifier" diff --git a/pkg/doc/verifiable/presentation_jwt_unsecured_test.go b/pkg/doc/verifiable/presentation_jwt_unsecured_test.go index d0d0d9b54..629ba7e43 100644 --- a/pkg/doc/verifiable/presentation_jwt_unsecured_test.go +++ b/pkg/doc/verifiable/presentation_jwt_unsecured_test.go @@ -8,7 +8,7 @@ package verifiable import ( "testing" - "github.com/square/go-jose/v3/jwt" + "github.com/go-jose/go-jose/v3/jwt" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/jose" diff --git a/pkg/doc/verifiable/test-suite/verifiable_suite_test.go b/pkg/doc/verifiable/test-suite/verifiable_suite_test.go index 0f3324f72..ffd97248d 100644 --- a/pkg/doc/verifiable/test-suite/verifiable_suite_test.go +++ b/pkg/doc/verifiable/test-suite/verifiable_suite_test.go @@ -1,3 +1,4 @@ +//go:build testsuite // +build testsuite /* @@ -25,8 +26,8 @@ import ( "os" "path/filepath" + "github.com/go-jose/go-jose/v3" jsonld "github.com/piprate/json-gold/ld" - "github.com/square/go-jose/v3" "github.com/hyperledger/aries-framework-go/component/storageutil/mem" "github.com/hyperledger/aries-framework-go/pkg/common/log" diff --git a/pkg/vdr/fingerprint/fingerprint_test.go b/pkg/vdr/fingerprint/fingerprint_test.go index f8284057a..43bfbd21d 100644 --- a/pkg/vdr/fingerprint/fingerprint_test.go +++ b/pkg/vdr/fingerprint/fingerprint_test.go @@ -16,7 +16,7 @@ import ( "testing" "github.com/btcsuite/btcutil/base58" - "github.com/square/go-jose/v3" + "github.com/go-jose/go-jose/v3" "github.com/stretchr/testify/require" "github.com/hyperledger/aries-framework-go/pkg/doc/jose/jwk" @@ -262,7 +262,7 @@ func TestCreateDIDKeyByJwk(t *testing.T) { jwkKey, err = jwksupport.JWKFromKey(&publicKey) if tc.name == "test EC with invalid curve" { - require.EqualError(t, err, "create JWK: square/go-jose: unsupported/unknown elliptic curve") + require.EqualError(t, err, "create JWK: go-jose/go-jose: unsupported/unknown elliptic curve") jwkKey = &jwk.JWK{ JSONWebKey: jose.JSONWebKey{}, Kty: "EC", diff --git a/test/bdd/go.mod b/test/bdd/go.mod index bdc9af31b..f0e2b80fc 100644 --- a/test/bdd/go.mod +++ b/test/bdd/go.mod @@ -43,6 +43,7 @@ require ( github.com/docker/docker v20.10.0+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect + github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 // indirect github.com/gogo/protobuf v1.3.1 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/golang/protobuf v1.5.2 // indirect diff --git a/test/bdd/go.sum b/test/bdd/go.sum index f64b7fe9a..fe59ff046 100644 --- a/test/bdd/go.sum +++ b/test/bdd/go.sum @@ -113,6 +113,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsouza/go-dockerclient v1.6.6 h1:9e3xkBrVkPb81gzYq23i7iDUEd6sx2ooeJA/gnYU6R4= github.com/fsouza/go-dockerclient v1.6.6/go.mod h1:3/oRIWoe7uT6bwtAayj/EmJmepBjeL4pYvt7ZxC7Rnk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 h1:w5li6eMV6NCHh1YVbKRM/gMCVtZ2w7mnwq78eNnHXQQ= +github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kivik/couchdb v2.0.0+incompatible/go.mod h1:5XJRkAMpBlEVA4q0ktIZjUPYBjoBmRoiWvwUBzP3BOQ= github.com/go-kivik/kivik v2.0.0+incompatible/go.mod h1:nIuJ8z4ikBrVUSk3Ua8NoDqYKULPNjuddjqRvlSUyyQ=