From 5687fe336b3a47f99a6646255395c62fed0e526a Mon Sep 17 00:00:00 2001 From: mishasizov-SK <109598497+mishasizov-SK@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:19:06 +0300 Subject: [PATCH] feat: data integrity proof support (#1390) Signed-off-by: Mykhailo Sizov --- cmd/vc-rest/go.mod | 6 +- cmd/vc-rest/go.sum | 12 +- component/credentialstatus/go.mod | 7 +- component/credentialstatus/go.sum | 14 +- component/event/go.mod | 6 +- component/event/go.sum | 12 +- component/profile/reader/file/go.mod | 7 +- component/profile/reader/file/go.sum | 14 +- component/wallet-cli/go.mod | 6 +- component/wallet-cli/go.sum | 12 +- go.mod | 6 +- go.sum | 12 +- pkg/doc/vc/crypto/crypto.go | 9 +- pkg/doc/vc/crypto/crypto_test.go | 74 ++++++- pkg/doc/vc/crypto/dataIntegrity.go | 93 +++++++++ pkg/doc/vc/crypto/dataIntegrity_test.go | 186 ++++++++++++++++++ pkg/doc/vc/dataIntegrity.go | 15 ++ pkg/doc/vc/signer.go | 9 +- pkg/doc/vc/vcutil/vcutil.go | 2 +- .../contexts/vc-data-integrity-v1.jsonld | 74 +++++++ pkg/internal/testutil/document_loader.go | 6 + .../verifycredential_wrapper.go | 3 +- pkg/profile/api.go | 1 + pkg/restapi/v1/verifier/controller.go | 4 +- .../issuecredential_service.go | 1 + .../verifycredential_service.go | 68 +++++-- .../verifycredential_service_test.go | 166 +++++++++++++++- test/bdd/bddtests_test.go | 2 +- .../vc_v1_issue_verify_revoke_api.feature | 9 +- .../bdd/fixtures/file-server/ld-contexts.json | 77 ++++++++ test/bdd/fixtures/profile/profiles.json | 28 ++- test/bdd/go.mod | 6 +- test/bdd/go.sum | 12 +- .../contexts/vc-data-integrity-v1.jsonld | 74 +++++++ test/bdd/pkg/bddutil/util.go | 6 + test/stress/go.mod | 6 +- test/stress/go.sum | 12 +- 37 files changed, 948 insertions(+), 109 deletions(-) create mode 100644 pkg/doc/vc/crypto/dataIntegrity.go create mode 100644 pkg/doc/vc/crypto/dataIntegrity_test.go create mode 100644 pkg/doc/vc/dataIntegrity.go create mode 100644 pkg/internal/testutil/contexts/vc-data-integrity-v1.jsonld create mode 100644 test/bdd/pkg/bddutil/contexts/vc-data-integrity-v1.jsonld diff --git a/cmd/vc-rest/go.mod b/cmd/vc-rest/go.mod index 5b3841231..abfdddf4c 100644 --- a/cmd/vc-rest/go.mod +++ b/cmd/vc-rest/go.mod @@ -15,7 +15,7 @@ require ( github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk v0.0.0-20221213152252-f0c83a5a922c github.com/hyperledger/aries-framework-go-ext/component/vdr/longform v0.0.0-20221213152252-f0c83a5a922c github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221213152252-f0c83a5a922c - github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 + github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 github.com/labstack/echo/v4 v4.10.2 github.com/ory/dockertest/v3 v3.9.1 @@ -119,11 +119,11 @@ require ( github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/hashicorp/go-version v1.2.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 // indirect + github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 // indirect github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 // indirect github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 // indirect - github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 // indirect + github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c // indirect github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/hyperledger/aries-framework-go/spi v0.0.0-20230517133327-301aa0597250 // indirect diff --git a/cmd/vc-rest/go.sum b/cmd/vc-rest/go.sum index e53fc1066..88488c795 100644 --- a/cmd/vc-rest/go.sum +++ b/cmd/vc-rest/go.sum @@ -585,8 +585,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 h1:Eg5haDYVi6SjyUsoITVxUsE6cmT+euGHKQTlu9/U0uk= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 h1:Ck8yXjqw+M7Lc0UtS6fO60Uz5Qy8LhaY62ZhAbczVm0= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 h1:8ja6Vnp5EUsh8Oe4mI8ZNwpJtiM7c87X/b9sO/hEFiY= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149/go.mod h1:GDANCnJONcCqBvv6QgKuk5Y2FWHyD/Hu26kyc7NTyfY= github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk v0.0.0-20221213152252-f0c83a5a922c h1:74wqdvAd3S9BuKolIV0obbG8PhbChtF9sQrE/ov2se0= @@ -599,12 +599,12 @@ github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3. github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122/go.mod h1:kHGEwgl2Wo1dYj0rs6u8Kk/GjHmmwZI7445lU+9CJtI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 h1:6pkyx5TMJEZpau/HsDNSndZy+MrX9hJmWAtGM1UaGuI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4/go.mod h1:SCS+CWl/U4qRgy540BAKvSlLHAUXrw29pmuhp3nMzbY= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 h1:x7Lt4FAPmMNyKQCUhnUOYeDpskaHnRNrtZj4rKfSKfU= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857/go.mod h1:xgNlHAVQjqwoknzHbXkeHkAJgUxRWKfHXPT3nhVhH3Q= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c h1:4XItY3Af3ioolP+Ow3bEQ+weq+VBk+4IaEHCWJgI50A= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c/go.mod h1:nmT2WqhIs9Eyncdr9feYrUIy7ggf00bWnTzCN6/t8PY= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 h1:x5qFQraTX86z9GCwF28IxfnPm6QH5YgHaX+4x97Jwvw= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3/go.mod h1:CvYs4l8X2NrrF93weLOu5RTOIJeVdoZITtjEflyuTyM= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 h1:W8F1CA8P/bNb92P/JMYG2nWqv0bxLL58/Q8Rw9nsNyI= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968/go.mod h1:AJkRLmQB1/umL5GfXw/XIarGaH/XCQOL/6wlGtqdDpA= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 h1:mEusaX1RvHx5aYhYPsqKnPMv4w+0NeYMCwTm0fZic24= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28/go.mod h1:Vd22w/OAXZy61UQd6Dxo/BzJdafg8xhb/RsPwXzAn6Q= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 h1:JGYA9l5zTlvsvfnXT9hYPpCokAjmVKX0/r7njba7OX4= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3/go.mod h1:aSG2dWjYVzu2PVBtOqsYghaChA5+UUXnBbL+MfVceYQ= github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 h1:QvqSk3CuNXZetpr/hP0bH7VUOzjJUtG16OxknXjdaYE= diff --git a/component/credentialstatus/go.mod b/component/credentialstatus/go.mod index 3b38c3932..3ad53a32c 100644 --- a/component/credentialstatus/go.mod +++ b/component/credentialstatus/go.mod @@ -9,9 +9,10 @@ go 1.21 require ( github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 + github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 github.com/hyperledger/aries-framework-go-ext/component/vdr/longform v0.0.0-20221201213446-c4c1e76daa49 - github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 - github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 + github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c + github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 github.com/hyperledger/aries-framework-go/spi v0.0.0-20230517133327-301aa0597250 github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f @@ -70,7 +71,6 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 // indirect github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 // indirect @@ -118,6 +118,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect + github.com/samber/lo v1.38.1 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.9.5 // indirect diff --git a/component/credentialstatus/go.sum b/component/credentialstatus/go.sum index e980dbb45..5a056780b 100644 --- a/component/credentialstatus/go.sum +++ b/component/credentialstatus/go.sum @@ -523,8 +523,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 h1:Eg5haDYVi6SjyUsoITVxUsE6cmT+euGHKQTlu9/U0uk= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 h1:Ck8yXjqw+M7Lc0UtS6fO60Uz5Qy8LhaY62ZhAbczVm0= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 h1:8ja6Vnp5EUsh8Oe4mI8ZNwpJtiM7c87X/b9sO/hEFiY= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149/go.mod h1:GDANCnJONcCqBvv6QgKuk5Y2FWHyD/Hu26kyc7NTyfY= github.com/hyperledger/aries-framework-go-ext/component/vdr/longform v0.0.0-20221201213446-c4c1e76daa49 h1:MbWVC1HQEAn5yw5DLs4D7kdcM06y6ZiN4r3ZtvDzxWE= @@ -533,12 +533,12 @@ github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.202 github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49/go.mod h1:nBzEBfVKX/+N9tHyDYwlOMxA55FdSiU6Y2cVdtNVN7I= github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 h1:lLClFk/2sgr8B15E854dtgxK9b6R+B8qPJXin4mgTFo= github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122/go.mod h1:kHGEwgl2Wo1dYj0rs6u8Kk/GjHmmwZI7445lU+9CJtI= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 h1:x7Lt4FAPmMNyKQCUhnUOYeDpskaHnRNrtZj4rKfSKfU= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857/go.mod h1:xgNlHAVQjqwoknzHbXkeHkAJgUxRWKfHXPT3nhVhH3Q= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c h1:4XItY3Af3ioolP+Ow3bEQ+weq+VBk+4IaEHCWJgI50A= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c/go.mod h1:nmT2WqhIs9Eyncdr9feYrUIy7ggf00bWnTzCN6/t8PY= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 h1:x5qFQraTX86z9GCwF28IxfnPm6QH5YgHaX+4x97Jwvw= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3/go.mod h1:CvYs4l8X2NrrF93weLOu5RTOIJeVdoZITtjEflyuTyM= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 h1:W8F1CA8P/bNb92P/JMYG2nWqv0bxLL58/Q8Rw9nsNyI= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968/go.mod h1:AJkRLmQB1/umL5GfXw/XIarGaH/XCQOL/6wlGtqdDpA= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 h1:mEusaX1RvHx5aYhYPsqKnPMv4w+0NeYMCwTm0fZic24= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28/go.mod h1:Vd22w/OAXZy61UQd6Dxo/BzJdafg8xhb/RsPwXzAn6Q= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 h1:JGYA9l5zTlvsvfnXT9hYPpCokAjmVKX0/r7njba7OX4= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3/go.mod h1:aSG2dWjYVzu2PVBtOqsYghaChA5+UUXnBbL+MfVceYQ= github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 h1:QvqSk3CuNXZetpr/hP0bH7VUOzjJUtG16OxknXjdaYE= @@ -883,6 +883,8 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= +github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b/go.mod h1:am+Fp8Bt506lA3Rk3QCmSqmYmLMnPDhdDUcosQCAx+I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= diff --git a/component/event/go.mod b/component/event/go.mod index 36472ce71..084b6e07a 100644 --- a/component/event/go.mod +++ b/component/event/go.mod @@ -6,7 +6,7 @@ module github.com/trustbloc/vcs/component/event go 1.21 require ( - github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 + github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f github.com/samber/lo v1.38.1 github.com/spf13/cobra v1.7.0 @@ -68,11 +68,11 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 // indirect + github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 // indirect github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 // indirect - github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 // indirect + github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c // indirect github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 // indirect diff --git a/component/event/go.sum b/component/event/go.sum index 3ff27157d..c66d53dff 100644 --- a/component/event/go.sum +++ b/component/event/go.sum @@ -523,20 +523,20 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 h1:Eg5haDYVi6SjyUsoITVxUsE6cmT+euGHKQTlu9/U0uk= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 h1:Ck8yXjqw+M7Lc0UtS6fO60Uz5Qy8LhaY62ZhAbczVm0= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 h1:8ja6Vnp5EUsh8Oe4mI8ZNwpJtiM7c87X/b9sO/hEFiY= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149/go.mod h1:GDANCnJONcCqBvv6QgKuk5Y2FWHyD/Hu26kyc7NTyfY= github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49 h1:AiQyIn1EJd8FN/2nxk3Z3zIMI5ZOgqV+HWRK2uN2Ktg= github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49/go.mod h1:nBzEBfVKX/+N9tHyDYwlOMxA55FdSiU6Y2cVdtNVN7I= github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 h1:lLClFk/2sgr8B15E854dtgxK9b6R+B8qPJXin4mgTFo= github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122/go.mod h1:kHGEwgl2Wo1dYj0rs6u8Kk/GjHmmwZI7445lU+9CJtI= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 h1:x7Lt4FAPmMNyKQCUhnUOYeDpskaHnRNrtZj4rKfSKfU= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857/go.mod h1:xgNlHAVQjqwoknzHbXkeHkAJgUxRWKfHXPT3nhVhH3Q= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c h1:4XItY3Af3ioolP+Ow3bEQ+weq+VBk+4IaEHCWJgI50A= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c/go.mod h1:nmT2WqhIs9Eyncdr9feYrUIy7ggf00bWnTzCN6/t8PY= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 h1:x5qFQraTX86z9GCwF28IxfnPm6QH5YgHaX+4x97Jwvw= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3/go.mod h1:CvYs4l8X2NrrF93weLOu5RTOIJeVdoZITtjEflyuTyM= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 h1:W8F1CA8P/bNb92P/JMYG2nWqv0bxLL58/Q8Rw9nsNyI= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968/go.mod h1:AJkRLmQB1/umL5GfXw/XIarGaH/XCQOL/6wlGtqdDpA= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 h1:mEusaX1RvHx5aYhYPsqKnPMv4w+0NeYMCwTm0fZic24= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28/go.mod h1:Vd22w/OAXZy61UQd6Dxo/BzJdafg8xhb/RsPwXzAn6Q= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 h1:JGYA9l5zTlvsvfnXT9hYPpCokAjmVKX0/r7njba7OX4= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3/go.mod h1:aSG2dWjYVzu2PVBtOqsYghaChA5+UUXnBbL+MfVceYQ= github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 h1:QvqSk3CuNXZetpr/hP0bH7VUOzjJUtG16OxknXjdaYE= diff --git a/component/profile/reader/file/go.mod b/component/profile/reader/file/go.mod index fe4797b2e..2e959abf4 100644 --- a/component/profile/reader/file/go.mod +++ b/component/profile/reader/file/go.mod @@ -10,8 +10,8 @@ require ( github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk v0.0.0-20221213152252-f0c83a5a922c github.com/hyperledger/aries-framework-go-ext/component/vdr/longform v0.0.0-20221213152252-f0c83a5a922c github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221213152252-f0c83a5a922c - github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 - github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 + github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c + github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 github.com/hyperledger/aries-framework-go/spi v0.0.0-20230517133327-301aa0597250 github.com/spf13/cobra v1.7.0 @@ -71,7 +71,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 // indirect + github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 // indirect github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 // indirect github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect @@ -119,6 +119,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect + github.com/samber/lo v1.38.1 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.9.5 // indirect diff --git a/component/profile/reader/file/go.sum b/component/profile/reader/file/go.sum index d0693a352..8e30b48a4 100644 --- a/component/profile/reader/file/go.sum +++ b/component/profile/reader/file/go.sum @@ -524,8 +524,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 h1:Eg5haDYVi6SjyUsoITVxUsE6cmT+euGHKQTlu9/U0uk= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 h1:Ck8yXjqw+M7Lc0UtS6fO60Uz5Qy8LhaY62ZhAbczVm0= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 h1:8ja6Vnp5EUsh8Oe4mI8ZNwpJtiM7c87X/b9sO/hEFiY= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149/go.mod h1:GDANCnJONcCqBvv6QgKuk5Y2FWHyD/Hu26kyc7NTyfY= github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk v0.0.0-20221213152252-f0c83a5a922c h1:74wqdvAd3S9BuKolIV0obbG8PhbChtF9sQrE/ov2se0= @@ -536,12 +536,12 @@ github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.202 github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221213152252-f0c83a5a922c/go.mod h1:nBzEBfVKX/+N9tHyDYwlOMxA55FdSiU6Y2cVdtNVN7I= github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 h1:lLClFk/2sgr8B15E854dtgxK9b6R+B8qPJXin4mgTFo= github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122/go.mod h1:kHGEwgl2Wo1dYj0rs6u8Kk/GjHmmwZI7445lU+9CJtI= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 h1:x7Lt4FAPmMNyKQCUhnUOYeDpskaHnRNrtZj4rKfSKfU= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857/go.mod h1:xgNlHAVQjqwoknzHbXkeHkAJgUxRWKfHXPT3nhVhH3Q= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c h1:4XItY3Af3ioolP+Ow3bEQ+weq+VBk+4IaEHCWJgI50A= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c/go.mod h1:nmT2WqhIs9Eyncdr9feYrUIy7ggf00bWnTzCN6/t8PY= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 h1:x5qFQraTX86z9GCwF28IxfnPm6QH5YgHaX+4x97Jwvw= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3/go.mod h1:CvYs4l8X2NrrF93weLOu5RTOIJeVdoZITtjEflyuTyM= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 h1:W8F1CA8P/bNb92P/JMYG2nWqv0bxLL58/Q8Rw9nsNyI= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968/go.mod h1:AJkRLmQB1/umL5GfXw/XIarGaH/XCQOL/6wlGtqdDpA= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 h1:mEusaX1RvHx5aYhYPsqKnPMv4w+0NeYMCwTm0fZic24= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28/go.mod h1:Vd22w/OAXZy61UQd6Dxo/BzJdafg8xhb/RsPwXzAn6Q= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 h1:JGYA9l5zTlvsvfnXT9hYPpCokAjmVKX0/r7njba7OX4= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3/go.mod h1:aSG2dWjYVzu2PVBtOqsYghaChA5+UUXnBbL+MfVceYQ= github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 h1:QvqSk3CuNXZetpr/hP0bH7VUOzjJUtG16OxknXjdaYE= @@ -886,6 +886,8 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= +github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b/go.mod h1:am+Fp8Bt506lA3Rk3QCmSqmYmLMnPDhdDUcosQCAx+I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= diff --git a/component/wallet-cli/go.mod b/component/wallet-cli/go.mod index be5990007..89a4125e3 100644 --- a/component/wallet-cli/go.mod +++ b/component/wallet-cli/go.mod @@ -16,8 +16,8 @@ require ( github.com/hyperledger/aries-framework-go-ext/component/vdr/longform v0.0.0-20221201213446-c4c1e76daa49 github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49 github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 - github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 - github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 + github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c + github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 github.com/hyperledger/aries-framework-go/component/storage/leveldb v0.0.0-20221202141134-083803ecf0a3 github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 @@ -86,7 +86,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 // indirect + github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 // indirect github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2 // indirect diff --git a/component/wallet-cli/go.sum b/component/wallet-cli/go.sum index ce8855136..3da3fcd9b 100644 --- a/component/wallet-cli/go.sum +++ b/component/wallet-cli/go.sum @@ -557,8 +557,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 h1:Eg5haDYVi6SjyUsoITVxUsE6cmT+euGHKQTlu9/U0uk= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 h1:Ck8yXjqw+M7Lc0UtS6fO60Uz5Qy8LhaY62ZhAbczVm0= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 h1:8ja6Vnp5EUsh8Oe4mI8ZNwpJtiM7c87X/b9sO/hEFiY= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149/go.mod h1:GDANCnJONcCqBvv6QgKuk5Y2FWHyD/Hu26kyc7NTyfY= github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk v0.0.0-20221213152252-f0c83a5a922c h1:74wqdvAd3S9BuKolIV0obbG8PhbChtF9sQrE/ov2se0= @@ -571,12 +571,12 @@ github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3. github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122/go.mod h1:kHGEwgl2Wo1dYj0rs6u8Kk/GjHmmwZI7445lU+9CJtI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 h1:6pkyx5TMJEZpau/HsDNSndZy+MrX9hJmWAtGM1UaGuI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4/go.mod h1:SCS+CWl/U4qRgy540BAKvSlLHAUXrw29pmuhp3nMzbY= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 h1:x7Lt4FAPmMNyKQCUhnUOYeDpskaHnRNrtZj4rKfSKfU= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857/go.mod h1:xgNlHAVQjqwoknzHbXkeHkAJgUxRWKfHXPT3nhVhH3Q= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c h1:4XItY3Af3ioolP+Ow3bEQ+weq+VBk+4IaEHCWJgI50A= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c/go.mod h1:nmT2WqhIs9Eyncdr9feYrUIy7ggf00bWnTzCN6/t8PY= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 h1:x5qFQraTX86z9GCwF28IxfnPm6QH5YgHaX+4x97Jwvw= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3/go.mod h1:CvYs4l8X2NrrF93weLOu5RTOIJeVdoZITtjEflyuTyM= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 h1:W8F1CA8P/bNb92P/JMYG2nWqv0bxLL58/Q8Rw9nsNyI= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968/go.mod h1:AJkRLmQB1/umL5GfXw/XIarGaH/XCQOL/6wlGtqdDpA= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 h1:mEusaX1RvHx5aYhYPsqKnPMv4w+0NeYMCwTm0fZic24= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28/go.mod h1:Vd22w/OAXZy61UQd6Dxo/BzJdafg8xhb/RsPwXzAn6Q= github.com/hyperledger/aries-framework-go/component/storage/leveldb v0.0.0-20221202141134-083803ecf0a3 h1:GF7p/WrgKrhq7d0d9b6nkuW/sidMOwla9Muj4g+BgSY= github.com/hyperledger/aries-framework-go/component/storage/leveldb v0.0.0-20221202141134-083803ecf0a3/go.mod h1:i/bnCdoiv0a9fgHQtd+EiAxmCdaJKE3JYrgDUACKgyE= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 h1:JGYA9l5zTlvsvfnXT9hYPpCokAjmVKX0/r7njba7OX4= diff --git a/go.mod b/go.mod index 368845714..11bc998fb 100644 --- a/go.mod +++ b/go.mod @@ -21,11 +21,12 @@ require ( github.com/golang/mock v1.6.0 github.com/google/tink/go v1.7.0 github.com/google/uuid v1.3.0 + github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49 github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 - github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 - github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 + github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c + github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 github.com/hyperledger/aries-framework-go/spi v0.0.0-20230517133327-301aa0597250 @@ -125,7 +126,6 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 // indirect github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2 // indirect diff --git a/go.sum b/go.sum index 4aad9e6cd..b85ab6022 100644 --- a/go.sum +++ b/go.sum @@ -577,8 +577,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 h1:Eg5haDYVi6SjyUsoITVxUsE6cmT+euGHKQTlu9/U0uk= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 h1:Ck8yXjqw+M7Lc0UtS6fO60Uz5Qy8LhaY62ZhAbczVm0= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 h1:8ja6Vnp5EUsh8Oe4mI8ZNwpJtiM7c87X/b9sO/hEFiY= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149/go.mod h1:GDANCnJONcCqBvv6QgKuk5Y2FWHyD/Hu26kyc7NTyfY= github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49 h1:AiQyIn1EJd8FN/2nxk3Z3zIMI5ZOgqV+HWRK2uN2Ktg= @@ -587,12 +587,12 @@ github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3. github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122/go.mod h1:kHGEwgl2Wo1dYj0rs6u8Kk/GjHmmwZI7445lU+9CJtI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 h1:6pkyx5TMJEZpau/HsDNSndZy+MrX9hJmWAtGM1UaGuI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4/go.mod h1:SCS+CWl/U4qRgy540BAKvSlLHAUXrw29pmuhp3nMzbY= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 h1:x7Lt4FAPmMNyKQCUhnUOYeDpskaHnRNrtZj4rKfSKfU= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857/go.mod h1:xgNlHAVQjqwoknzHbXkeHkAJgUxRWKfHXPT3nhVhH3Q= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c h1:4XItY3Af3ioolP+Ow3bEQ+weq+VBk+4IaEHCWJgI50A= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c/go.mod h1:nmT2WqhIs9Eyncdr9feYrUIy7ggf00bWnTzCN6/t8PY= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 h1:x5qFQraTX86z9GCwF28IxfnPm6QH5YgHaX+4x97Jwvw= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3/go.mod h1:CvYs4l8X2NrrF93weLOu5RTOIJeVdoZITtjEflyuTyM= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 h1:W8F1CA8P/bNb92P/JMYG2nWqv0bxLL58/Q8Rw9nsNyI= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968/go.mod h1:AJkRLmQB1/umL5GfXw/XIarGaH/XCQOL/6wlGtqdDpA= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 h1:mEusaX1RvHx5aYhYPsqKnPMv4w+0NeYMCwTm0fZic24= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28/go.mod h1:Vd22w/OAXZy61UQd6Dxo/BzJdafg8xhb/RsPwXzAn6Q= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 h1:JGYA9l5zTlvsvfnXT9hYPpCokAjmVKX0/r7njba7OX4= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3/go.mod h1:aSG2dWjYVzu2PVBtOqsYghaChA5+UUXnBbL+MfVceYQ= github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 h1:QvqSk3CuNXZetpr/hP0bH7VUOzjJUtG16OxknXjdaYE= diff --git a/pkg/doc/vc/crypto/crypto.go b/pkg/doc/vc/crypto/crypto.go index cd5a7fb1a..3c7e842a0 100644 --- a/pkg/doc/vc/crypto/crypto.go +++ b/pkg/doc/vc/crypto/crypto.go @@ -158,6 +158,10 @@ func (c *Crypto) SignCredential( case vcsverifiable.Jwt: return c.signCredentialJWT(signerData, vc, opts...) case vcsverifiable.Ldp: + if signerData.DataIntegrityProof.Enable { + return c.signCredentialLDPDataIntegrity(signerData, vc, opts...) + } + return c.signCredentialLDP(signerData, vc, opts...) default: return nil, fmt.Errorf("unknown signature format %s", signerData.Format) @@ -212,7 +216,7 @@ func (c *Crypto) signCredentialJWT( signatureType = signOpts.SignatureType } - s, _, err := c.getSigner(signerData.KMSKeyID, signerData.KMS, signOpts, signatureType) + s, _, err := c.getSigner(signerData.KMSKeyID, signerData.KMS, signatureType) if err != nil { return nil, fmt.Errorf("getting signer for JWS: %w", err) } @@ -331,7 +335,7 @@ func (c *Crypto) SignPresentation(signerData *vc.Signer, vp *verifiable.Presenta func (c *Crypto) getLinkedDataProofContext(signerData *vc.Signer, km keyManager, signatureType vcsverifiable.SignatureType, proofPurpose string, signRep verifiable.SignatureRepresentation, opts *signingOpts) (*verifiable.LinkedDataProofContext, error) { - s, _, err := c.getSigner(signerData.KMSKeyID, km, opts, signatureType) + s, _, err := c.getSigner(signerData.KMSKeyID, km, signatureType) if err != nil { return nil, err } @@ -399,7 +403,6 @@ func (c *Crypto) getLinkedDataProofContext(signerData *vc.Signer, km keyManager, func (c *Crypto) getSigner( kmsKeyID string, km keyManager, - _ *signingOpts, signatureType vcsverifiable.SignatureType, ) (vc.SignerAlgorithm, string, error) { s, err := km.NewVCSigner(kmsKeyID, signatureType) diff --git a/pkg/doc/vc/crypto/crypto_test.go b/pkg/doc/vc/crypto/crypto_test.go index e24791d9f..89cc9d811 100644 --- a/pkg/doc/vc/crypto/crypto_test.go +++ b/pkg/doc/vc/crypto/crypto_test.go @@ -17,10 +17,12 @@ import ( "time" "github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/tinkcrypto" + "github.com/hyperledger/aries-framework-go/component/kmscrypto/doc/util/jwkkid" "github.com/hyperledger/aries-framework-go/component/kmscrypto/kms/localkms" cryptomock "github.com/hyperledger/aries-framework-go/component/kmscrypto/mock/crypto" mockkms "github.com/hyperledger/aries-framework-go/component/kmscrypto/mock/kms" "github.com/hyperledger/aries-framework-go/component/kmscrypto/secretlock/noop" + "github.com/hyperledger/aries-framework-go/component/models/dataintegrity/suite/ecdsa2019" "github.com/hyperledger/aries-framework-go/component/models/did" "github.com/hyperledger/aries-framework-go/component/models/did/endpoint" "github.com/hyperledger/aries-framework-go/component/models/sdjwt/common" @@ -649,6 +651,63 @@ func TestSignCredential(t *testing.T) { require.Equal(t, 1, len(signedVC.Proofs)) require.Empty(t, signedVC.JWT) }) + t.Run("sign credential LDP Data Integrity - success", func(t *testing.T) { + customKMS := createKMS(t) + + _, keyBytes, err := customKMS.CreateAndExportPubKeyBytes(kms.ECDSAP256IEEEP1363) + require.NoError(t, err) + + key, err := jwkkid.BuildJWK(keyBytes, kms.ECDSAP256IEEEP1363) + require.NoError(t, err) + + const signingDID = "did:foo:bar" + + const vmID = "#key1" + + verificationMethod, err := did.NewVerificationMethodFromJWK(vmID, "JsonWebKey2020", signingDID, key) + require.NoError(t, err) + + c := New( + &vdrmock.VDRegistry{ + ResolveFunc: func(didID string, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error) { + return makeMockDIDResolution(signingDID, verificationMethod, did.Authentication), nil + }}, + testutil.DocumentLoader(t), + ) + + unsignedVc := verifiable.Credential{ + ID: "http://example.edu/credentials/1872", + Context: []string{verifiable.ContextURI}, + Types: []string{verifiable.VCType}, + Subject: verifiable.Subject{ + ID: "did:example:ebfeb1f712ebc6f1c276e12ec21", + CustomFields: map[string]interface{}{ + "spouse": "did:example:c276e12ec21ebfeb1f712ebc6f1", + "name": "Jayden Doe", + "degree": map[string]interface{}{ + "type": "BachelorDegree", + "degree": "MIT", + }, + }, + }, + Issued: &utiltime.TimeWrapper{ + Time: time.Now(), + }, + Issuer: verifiable.Issuer{ + ID: "did:example:76e12ec712ebc6f1c221ebfeb1f", + }, + CustomFields: map[string]interface{}{ + "first_name": "First name", + "last_name": "Last name", + "info": "Info", + }, + } + + signedVC, err := c.SignCredential(getTestLDPDataIntegritySigner(), &unsignedVc) + require.NoError(t, err) + require.Equal(t, 1, len(signedVC.Proofs)) + require.Empty(t, signedVC.JWT) + }) t.Run("sign credential LDP - error", func(t *testing.T) { c := New( &vdrmock.VDRegistry{ResolveValue: nil}, @@ -765,9 +824,22 @@ func getTestLDPSigner() *vc.Signer { kms: &mockkms.KeyManager{}, }, Format: vcsverifiable.Ldp, + DataIntegrityProof: vc.DataIntegrityProofConfig{ + Enable: false, + }, } } +func getTestLDPDataIntegritySigner() *vc.Signer { + s := getTestLDPSigner() + s.DataIntegrityProof = vc.DataIntegrityProofConfig{ + Enable: true, + SuiteType: ecdsa2019.SuiteType, + } + + return s +} + func getJWTSigner( customCrypto ariescrypto.Crypto, customKMS kms.KeyManager, @@ -861,7 +933,7 @@ func createDIDDoc(didID string, opts ...opt) *did.Doc { Service: []did.Service{service}, Created: &createdTime, AssertionMethod: []did.Verification{{VerificationMethod: signingKey}}, - Authentication: []did.Verification{{VerificationMethod: signingKey}}, + Authentication: []did.Verification{{VerificationMethod: signingKey, Relationship: did.Authentication}}, CapabilityInvocation: []did.Verification{{VerificationMethod: signingKey}}, CapabilityDelegation: []did.Verification{{VerificationMethod: signingKey}}, } diff --git a/pkg/doc/vc/crypto/dataIntegrity.go b/pkg/doc/vc/crypto/dataIntegrity.go new file mode 100644 index 000000000..34d114e51 --- /dev/null +++ b/pkg/doc/vc/crypto/dataIntegrity.go @@ -0,0 +1,93 @@ +/* +Copyright SecureKey Technologies Inc. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + +package crypto + +import ( + "fmt" + + "github.com/hyperledger/aries-framework-go/component/models/dataintegrity" + dataintegritysuite "github.com/hyperledger/aries-framework-go/component/models/dataintegrity/suite" + "github.com/hyperledger/aries-framework-go/component/models/dataintegrity/suite/ecdsa2019" + "github.com/hyperledger/aries-framework-go/component/models/verifiable" + "github.com/samber/lo" + + "github.com/trustbloc/vcs/pkg/doc/vc" +) + +const ( + dataIntegrityProofContext = "https://w3id.org/security/data-integrity/v1" +) + +// signCredentialLDP adds verifiable.DataIntegrityProofContext to the VC. +func (c *Crypto) signCredentialLDPDataIntegrity(signerData *vc.Signer, + vc *verifiable.Credential, opts ...SigningOpts) (*verifiable.Credential, error) { + signOpts := &signingOpts{} + // apply opts + for _, opt := range opts { + opt(signOpts) + } + + if signOpts.Purpose == "" { + signOpts.Purpose = Authentication + } + + signatureType := signerData.SignatureType + if signOpts.SignatureType != "" { + signatureType = signOpts.SignatureType + } + + ariesSigner, _, err := c.getSigner(signerData.KMSKeyID, signerData.KMS, signatureType) + if err != nil { + return nil, err + } + + signerSuite, err := c.getDataIntegritySignerInitializer(signerData.DataIntegrityProof.SuiteType, ariesSigner) + if err != nil { + return nil, fmt.Errorf("get data integrity signer initializer: %w", err) + } + + diSigner, err := dataintegrity.NewSigner(&dataintegrity.Options{ + DIDResolver: c.vdr, + }, signerSuite) + if err != nil { + return nil, fmt.Errorf("get data integority signer: %w", err) + } + + signingCtx := &verifiable.DataIntegrityProofContext{ + SigningKeyID: signerData.Creator, + CryptoSuite: signerData.DataIntegrityProof.SuiteType, + ProofPurpose: signOpts.Purpose, + Created: signOpts.Created, + Domain: signOpts.Domain, + Challenge: signOpts.Challenge, + } + + // Update VC context for Data Integrity. + if !lo.Contains(vc.Context, dataIntegrityProofContext) { + vc.Context = append(vc.Context, dataIntegrityProofContext) + } + + err = vc.AddDataIntegrityProof(signingCtx, diSigner) + if err != nil { + return nil, fmt.Errorf("add data integrity proof: %w", err) + } + + return vc, nil +} + +func (c *Crypto) getDataIntegritySignerInitializer( + dataIntegritySuiteType string, signer vc.SignerAlgorithm) (dataintegritysuite.SignerInitializer, error) { + switch dataIntegritySuiteType { //nolint: exhaustive + case ecdsa2019.SuiteType: + return ecdsa2019.NewSignerInitializer(&ecdsa2019.SignerInitializerOptions{ + SignerGetter: ecdsa2019.WithStaticSigner(signer), + LDDocumentLoader: c.documentLoader, + }), nil + default: + return nil, fmt.Errorf("data integrity suite \"%s\" unsupported", dataIntegritySuiteType) + } +} diff --git a/pkg/doc/vc/crypto/dataIntegrity_test.go b/pkg/doc/vc/crypto/dataIntegrity_test.go new file mode 100644 index 000000000..8facd676a --- /dev/null +++ b/pkg/doc/vc/crypto/dataIntegrity_test.go @@ -0,0 +1,186 @@ +package crypto + +import ( + _ "embed" + "errors" + "testing" + "time" + + "github.com/hyperledger/aries-framework-go/component/kmscrypto/doc/util/jwkkid" + cryptomock "github.com/hyperledger/aries-framework-go/component/kmscrypto/mock/crypto" + mockkms "github.com/hyperledger/aries-framework-go/component/kmscrypto/mock/kms" + "github.com/hyperledger/aries-framework-go/component/models/did" + utiltime "github.com/hyperledger/aries-framework-go/component/models/util/time" + "github.com/hyperledger/aries-framework-go/component/models/verifiable" + vdrapi "github.com/hyperledger/aries-framework-go/component/vdr/api" + vdrmock "github.com/hyperledger/aries-framework-go/component/vdr/mock" + kmsapi "github.com/hyperledger/aries-framework-go/spi/kms" + "github.com/stretchr/testify/require" + + "github.com/trustbloc/vcs/pkg/internal/testutil" +) + +func TestCrypto_SignCredentialLDPDataIntegrity(t *testing.T) { //nolint:gocognit + customKMS := createKMS(t) + + _, keyBytes, err := customKMS.CreateAndExportPubKeyBytes(kmsapi.ECDSAP256IEEEP1363) + require.NoError(t, err) + + key, err := jwkkid.BuildJWK(keyBytes, kmsapi.ECDSAP256IEEEP1363) + require.NoError(t, err) + + const signingDID = "did:foo:bar" + + const vmID = "#key1" + + verificationMethod, err := did.NewVerificationMethodFromJWK(vmID, "JsonWebKey2020", signingDID, key) + require.NoError(t, err) + + c := New( + &vdrmock.VDRegistry{ + ResolveFunc: func(didID string, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error) { + return makeMockDIDResolution(signingDID, verificationMethod, did.Authentication), nil + }}, + testutil.DocumentLoader(t), + ) + + testSigner := getTestLDPDataIntegritySigner() + + unsignedVc := verifiable.Credential{ + ID: "http://example.edu/credentials/1872", + Context: []string{verifiable.ContextURI}, + Types: []string{verifiable.VCType}, + Subject: verifiable.Subject{ + ID: "did:example:ebfeb1f712ebc6f1c276e12ec21", + CustomFields: map[string]interface{}{ + "spouse": "did:example:c276e12ec21ebfeb1f712ebc6f1", + "name": "Jayden Doe", + "degree": map[string]interface{}{ + "type": "BachelorDegree", + "degree": "MIT", + }, + }, + }, + Issued: &utiltime.TimeWrapper{ + Time: time.Now(), + }, + Issuer: verifiable.Issuer{ + ID: "did:example:76e12ec712ebc6f1c221ebfeb1f", + }, + CustomFields: map[string]interface{}{ + "first_name": "First name", + "last_name": "Last name", + "info": "Info", + }, + } + + t.Run("Success", func(t *testing.T) { + signedVC, err := c.signCredentialLDPDataIntegrity(testSigner, &unsignedVc) + require.NoError(t, err) + require.Equal(t, 1, len(signedVC.Proofs)) + + require.Equal(t, "DataIntegrityProof", signedVC.Proofs[0]["type"]) + require.Equal(t, "ecdsa-2019", signedVC.Proofs[0]["cryptosuite"]) + require.Equal(t, "#key1", signedVC.Proofs[0]["verificationMethod"]) + require.Equal(t, "authentication", signedVC.Proofs[0]["proofPurpose"]) + require.Empty(t, signedVC.Proofs[0]["challenge"]) + require.Empty(t, signedVC.Proofs[0]["domain"]) + require.NotEmpty(t, signedVC.Proofs[0]["proofValue"]) + }) + + t.Run("Success with options", func(t *testing.T) { + testCrypto := New( + &vdrmock.VDRegistry{ + ResolveFunc: func(didID string, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error) { + return makeMockDIDResolution(signingDID, verificationMethod, did.AssertionMethod), nil + }}, + testutil.DocumentLoader(t), + ) + now := time.Now() + + signedVC, err := testCrypto.signCredentialLDPDataIntegrity(testSigner, &unsignedVc, + WithDomain("example.com"), + WithChallenge("challenge"), + WithCreated(&now), + WithPurpose(AssertionMethod), + WithSignatureType("JsonWebSignature2020"), + ) + require.NoError(t, err) + require.Equal(t, 1, len(signedVC.Proofs)) + + require.Equal(t, "DataIntegrityProof", signedVC.Proofs[0]["type"]) + require.Equal(t, "ecdsa-2019", signedVC.Proofs[0]["cryptosuite"]) + require.Equal(t, "#key1", signedVC.Proofs[0]["verificationMethod"]) + require.Equal(t, "assertionMethod", signedVC.Proofs[0]["proofPurpose"]) + require.Equal(t, "challenge", signedVC.Proofs[0]["challenge"]) + require.Equal(t, "example.com", signedVC.Proofs[0]["domain"]) + require.NotEmpty(t, signedVC.Proofs[0]["proofValue"]) + }) + + t.Run("Error invalid suite", func(t *testing.T) { + testCredentials := &verifiable.Credential{ID: "http://example.edu/credentials/1872"} + + ariesSigner := getTestLDPDataIntegritySigner() + ariesSigner.DataIntegrityProof.SuiteType = "undefined" + + signedVC, err := c.signCredentialLDPDataIntegrity(ariesSigner, testCredentials) + require.Nil(t, signedVC) + require.ErrorContains(t, err, "get data integrity signer initializer: data integrity suite \"undefined\" unsupported") + }) + + t.Run("Error get signer", func(t *testing.T) { + ariesSigner := getTestLDPDataIntegritySigner() + + ariesSigner.KMS = &mockVCSKeyManager{ + crypto: &cryptomock.Crypto{}, + kms: &mockkms.KeyManager{ + GetKeyErr: errors.New("some error"), + }, + } + + signedVC, err := c.signCredentialLDPDataIntegrity(ariesSigner, &unsignedVc) + require.Nil(t, signedVC) + require.Error(t, err) + require.ErrorContains(t, err, "some error") + }) + + t.Run("Error add proof", func(t *testing.T) { + testCredentials := &verifiable.Credential{ID: "http://example.edu/credentials/1872"} + + testCrypto := New( + &vdrmock.VDRegistry{ + ResolveFunc: func(didID string, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error) { + return nil, errors.New("some error") + }}, + testutil.DocumentLoader(t), + ) + + signedVC, err := testCrypto.signCredentialLDPDataIntegrity(testSigner, testCredentials) + require.Nil(t, signedVC) + require.ErrorContains(t, err, "add data integrity proof: failed to resolve verification method") + }) +} + +func makeMockDIDResolution(id string, vm *did.VerificationMethod, vr did.VerificationRelationship) *did.DocResolution { + ver := []did.Verification{{ + VerificationMethod: *vm, + Relationship: vr, + }} + + doc := &did.Doc{ + ID: id, + } + + switch vr { //nolint:exhaustive + case did.VerificationRelationshipGeneral: + doc.VerificationMethod = []did.VerificationMethod{*vm} + case did.Authentication: + doc.Authentication = ver + case did.AssertionMethod: + doc.AssertionMethod = ver + } + + return &did.DocResolution{ + DIDDocument: doc, + } +} diff --git a/pkg/doc/vc/dataIntegrity.go b/pkg/doc/vc/dataIntegrity.go new file mode 100644 index 000000000..3b33e4bba --- /dev/null +++ b/pkg/doc/vc/dataIntegrity.go @@ -0,0 +1,15 @@ +/* +Copyright SecureKey Technologies Inc. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + +package vc + +// DataIntegrityProofConfig represents the Data Integrity LDP config. +type DataIntegrityProofConfig struct { + // Enable flag enables Data Integrity Proof feature. + Enable bool `json:"enable"` + // SuiteType is the data integrity Type identifier for the suite. + SuiteType string `json:"suiteType"` +} diff --git a/pkg/doc/vc/signer.go b/pkg/doc/vc/signer.go index d0166cf9f..02c385b88 100644 --- a/pkg/doc/vc/signer.go +++ b/pkg/doc/vc/signer.go @@ -24,14 +24,15 @@ type SignerAlgorithm interface { // Signer contains information about vc signer, usually this is credential issuer. type Signer struct { - DID string - Creator string - KMSKeyID string - SignatureType vcsverifiable.SignatureType + DID string // didResolution.DIDDocument.ID. + Creator string // didResolution.DIDDocument.ID + "#" + authentication.ID. + KMSKeyID string // authentication.ID. + SignatureType vcsverifiable.SignatureType // issuer.vcConfig.signingAlgorithm. KeyType kms.KeyType Format vcsverifiable.Format // VC format - LDP/JWT. SignatureRepresentation verifiable.SignatureRepresentation // For LDP only - proof/JWS. KMS keyManager VCStatusListType StatusType // Type of VC status list SDJWT SDJWT + DataIntegrityProof DataIntegrityProofConfig } diff --git a/pkg/doc/vc/vcutil/vcutil.go b/pkg/doc/vc/vcutil/vcutil.go index 5ab443c09..7e33b517a 100644 --- a/pkg/doc/vc/vcutil/vcutil.go +++ b/pkg/doc/vc/vcutil/vcutil.go @@ -103,7 +103,7 @@ func UpdateIssuer(credential *verifiable.Credential, issuerDID, issuerName strin } } -// UpdateSignatureTypeContext updates context for JSONWebSignature2020. +// UpdateSignatureTypeContext updates context for JSONWebSignature2020 and BbsBlsSignature2020. func UpdateSignatureTypeContext(credential *verifiable.Credential, signatureType vcsverifiable.SignatureType) { if signatureType == vcsverifiable.JSONWebSignature2020 { credential.Context = append(credential.Context, jsonWebSignature2020Context) diff --git a/pkg/internal/testutil/contexts/vc-data-integrity-v1.jsonld b/pkg/internal/testutil/contexts/vc-data-integrity-v1.jsonld new file mode 100644 index 000000000..d8a50543e --- /dev/null +++ b/pkg/internal/testutil/contexts/vc-data-integrity-v1.jsonld @@ -0,0 +1,74 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "@protected": true, + "proof": { + "@id": "https://w3id.org/security#proof", + "@type": "@id", + "@container": "@graph" + }, + "DataIntegrityProof": { + "@id": "https://w3id.org/security#DataIntegrityProof", + "@context": { + "@protected": true, + "id": "@id", + "type": "@type", + "challenge": "https://w3id.org/security#challenge", + "created": { + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + }, + "domain": "https://w3id.org/security#domain", + "expires": { + "@id": "https://w3id.org/security#expiration", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + }, + "nonce": "https://w3id.org/security#nonce", + "proofPurpose": { + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": { + "@protected": true, + "id": "@id", + "type": "@type", + "assertionMethod": { + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set" + }, + "authentication": { + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set" + }, + "capabilityInvocation": { + "@id": "https://w3id.org/security#capabilityInvocationMethod", + "@type": "@id", + "@container": "@set" + }, + "capabilityDelegation": { + "@id": "https://w3id.org/security#capabilityDelegationMethod", + "@type": "@id", + "@container": "@set" + }, + "keyAgreement": { + "@id": "https://w3id.org/security#keyAgreementMethod", + "@type": "@id", + "@container": "@set" + } + } + }, + "cryptosuite": "https://w3id.org/security#cryptosuite", + "proofValue": { + "@id": "https://w3id.org/security#proofValue", + "@type": "https://w3id.org/security#multibase" + }, + "verificationMethod": { + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id" + } + } + } + } +} \ No newline at end of file diff --git a/pkg/internal/testutil/document_loader.go b/pkg/internal/testutil/document_loader.go index 75e945eeb..f14c1fa74 100644 --- a/pkg/internal/testutil/document_loader.go +++ b/pkg/internal/testutil/document_loader.go @@ -31,6 +31,8 @@ var ( jws2020 []byte //go:embed contexts/vc-status-list-2021-v1.jsonld vcStatusList2021 []byte + //go:embed contexts/vc-data-integrity-v1.jsonld + vcDataIntegrity []byte ) type mockLDStoreProvider struct { @@ -81,6 +83,10 @@ func DocumentLoader(t *testing.T, extraContexts ...ldcontext.Document) *ld.Docum URL: "https://w3id.org/vc-status-list-2021/v1", Content: vcStatusList2021, }, + ldcontext.Document{ + URL: "https://w3id.org/security/data-integrity/v1", + Content: vcDataIntegrity, + }, } loader, err := ld.NewDocumentLoader(ldStore, diff --git a/pkg/observability/tracing/wrappers/verifycredential/verifycredential_wrapper.go b/pkg/observability/tracing/wrappers/verifycredential/verifycredential_wrapper.go index 5100fd8fe..2a80ad132 100644 --- a/pkg/observability/tracing/wrappers/verifycredential/verifycredential_wrapper.go +++ b/pkg/observability/tracing/wrappers/verifycredential/verifycredential_wrapper.go @@ -50,7 +50,8 @@ func (w *Wrapper) VerifyCredential(ctx context.Context, credential *verifiable.C return res, nil } -func (w *Wrapper) ValidateCredentialProof(ctx context.Context, vcByte []byte, proofChallenge, proofDomain string, vcInVPValidation, isJWT bool) error { +func (w *Wrapper) ValidateCredentialProof(ctx context.Context, + vcByte []byte, proofChallenge, proofDomain string, vcInVPValidation, isJWT bool) error { ctx, span := w.tracer.Start(ctx, "verifycredential.ValidateCredentialProof") defer span.End() diff --git a/pkg/profile/api.go b/pkg/profile/api.go index e7c5ce9b1..bd731b4ad 100644 --- a/pkg/profile/api.go +++ b/pkg/profile/api.go @@ -107,6 +107,7 @@ type VCConfig struct { Status StatusConfig `json:"status,omitempty"` Context []string `json:"context,omitempty"` SDJWT vc.SDJWT `json:"sdjwt,omitempty"` + DataIntegrityProof vc.DataIntegrityProofConfig `json:"dataIntegrityProof,omitempty"` } // StatusConfig represents the VC status configuration. diff --git a/pkg/restapi/v1/verifier/controller.go b/pkg/restapi/v1/verifier/controller.go index 62e71101e..43fec38e6 100644 --- a/pkg/restapi/v1/verifier/controller.go +++ b/pkg/restapi/v1/verifier/controller.go @@ -220,9 +220,7 @@ func (c *Controller) verifyCredential( profile.Checks.Credential.CredentialExpiry, profile.Checks.Credential.Strict, c.documentLoader, - verifiable.WithPublicKeyFetcher( - verifiable.NewVDRKeyResolver(c.vdr).PublicKeyFetcher(), - ), + verifiable.WithDisabledProofCheck(), verifiable.WithJSONLDDocumentLoader(c.documentLoader), ) diff --git a/pkg/service/issuecredential/issuecredential_service.go b/pkg/service/issuecredential/issuecredential_service.go index 02fb4d699..3487883aa 100644 --- a/pkg/service/issuecredential/issuecredential_service.go +++ b/pkg/service/issuecredential/issuecredential_service.go @@ -82,6 +82,7 @@ func (s *Service) IssueCredential( SignatureRepresentation: profile.VCConfig.SignatureRepresentation, VCStatusListType: profile.VCConfig.Status.Type, SDJWT: profile.VCConfig.SDJWT, + DataIntegrityProof: profile.VCConfig.DataIntegrityProof, } var statusListEntry *credentialstatus.StatusListEntry diff --git a/pkg/service/verifycredential/verifycredential_service.go b/pkg/service/verifycredential/verifycredential_service.go index e1603cf7f..600b85bfe 100644 --- a/pkg/service/verifycredential/verifycredential_service.go +++ b/pkg/service/verifycredential/verifycredential_service.go @@ -4,7 +4,7 @@ Copyright SecureKey Technologies Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ -//go:generate mockgen -destination service_mocks_test.go -self_package mocks -package verifycredential -source=verifycredential_service.go -mock_names statusListVCURIResolver=MockStatusListVCResolver +//go:generate mockgen -destination service_mocks_test.go -self_package mocks -package verifycredential -source=verifycredential_service.go -mock_names statusListVCURIResolver=MockStatusListVCResolver,kmsRegistry=MockKMSRegistry package verifycredential @@ -17,6 +17,8 @@ import ( "github.com/piprate/json-gold/ld" + "github.com/hyperledger/aries-framework-go/component/models/dataintegrity" + "github.com/hyperledger/aries-framework-go/component/models/dataintegrity/suite/ecdsa2019" "github.com/hyperledger/aries-framework-go/component/models/verifiable" vdrapi "github.com/hyperledger/aries-framework-go/component/vdr/api" @@ -110,35 +112,54 @@ func (s *Service) VerifyCredential(ctx context.Context, credential *verifiable.C return result, nil } -func (s *Service) parseAndVerifyVC(vcBytes []byte, isJWT bool) (*verifiable.Credential, error) { - opts := []verifiable.CredentialOpt{ +func (s *Service) parseAndVerifyLDPVC(vcBytes []byte) (*verifiable.Credential, error) { + diVerifier, err := s.getDataIntegrityVerifier() + if err != nil { + return nil, fmt.Errorf("get data integrity verifier: %w", err) + } + + cred, err := verifiable.ParseCredential(vcBytes, verifiable.WithPublicKeyFetcher( verifiable.NewVDRKeyResolver(s.vdr).PublicKeyFetcher(), ), verifiable.WithJSONLDDocumentLoader(s.documentLoader), + verifiable.WithStrictValidation(), + verifiable.WithDataIntegrityVerifier(diVerifier), + // Use empty domain and challenge in order to skip the validation. + // See usage of vcInVPValidation variable in ValidateCredentialProof method. + // TODO: define verifier purpose field. + verifiable.WithExpectedDataIntegrityFields(crypto.Authentication, "", ""), + ) + if err != nil { + return nil, fmt.Errorf("verifiable credential proof validation error : %w", err) } - if !isJWT { - opts = append(opts, verifiable.WithStrictValidation()) + return cred, nil +} + +func (s *Service) parseAndVerifyJWTVC(vcBytes []byte) error { + _, err := verifiable.ParseCredential(vcBytes, + verifiable.WithPublicKeyFetcher( + verifiable.NewVDRKeyResolver(s.vdr).PublicKeyFetcher(), + ), + verifiable.WithJSONLDDocumentLoader(s.documentLoader)) + if err != nil { + return fmt.Errorf("verifiable credential proof validation error : %w", err) } - cred, err := verifiable.ParseCredential( - vcBytes, - opts..., - ) - return cred, err + return nil } // ValidateCredentialProof validate credential proof. func (s *Service) ValidateCredentialProof(_ context.Context, vcByte []byte, proofChallenge, proofDomain string, vcInVPValidation, isJWT bool) error { // nolint: lll,gocyclo - credential, err := s.parseAndVerifyVC(vcByte, isJWT) - if err != nil { - return fmt.Errorf("verifiable credential proof validation error : %w", err) + if isJWT { + return s.parseAndVerifyJWTVC(vcByte) } - if len(credential.JWT) > 0 { - return nil + credential, err := s.parseAndVerifyLDPVC(vcByte) + if err != nil { + return err } if len(credential.Proofs) == 0 { @@ -178,7 +199,7 @@ func (s *Service) ValidateCredentialProof(_ context.Context, vcByte []byte, proo } // validate proof purpose - if err := crypto.ValidateProof(proof, verificationMethod, didDoc); err != nil { + if err = crypto.ValidateProof(proof, verificationMethod, didDoc); err != nil { return fmt.Errorf("verifiable credential proof purpose validation error : %w", err) } @@ -235,3 +256,18 @@ func (s *Service) ValidateVCStatus(ctx context.Context, vcStatus *verifiable.Typ return nil } + +func (s *Service) getDataIntegrityVerifier() (*dataintegrity.Verifier, error) { + verifySuite := ecdsa2019.NewVerifierInitializer(&ecdsa2019.VerifierInitializerOptions{ + LDDocumentLoader: s.documentLoader, + }) + + verifier, err := dataintegrity.NewVerifier(&dataintegrity.Options{ + DIDResolver: s.vdr, + }, verifySuite) + if err != nil { + return nil, fmt.Errorf("new verifier: %w", err) + } + + return verifier, nil +} diff --git a/pkg/service/verifycredential/verifycredential_service_test.go b/pkg/service/verifycredential/verifycredential_service_test.go index f8204361d..2032d587f 100644 --- a/pkg/service/verifycredential/verifycredential_service_test.go +++ b/pkg/service/verifycredential/verifycredential_service_test.go @@ -13,10 +13,21 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/tinkcrypto" + "github.com/hyperledger/aries-framework-go/component/kmscrypto/doc/util/jwkkid" + "github.com/hyperledger/aries-framework-go/component/kmscrypto/kms/localkms" + mockkms "github.com/hyperledger/aries-framework-go/component/kmscrypto/mock/kms" + "github.com/hyperledger/aries-framework-go/component/kmscrypto/secretlock/noop" + "github.com/hyperledger/aries-framework-go/component/models/dataintegrity" + "github.com/hyperledger/aries-framework-go/component/models/dataintegrity/suite/ecdsa2019" + "github.com/hyperledger/aries-framework-go/component/models/did" "github.com/hyperledger/aries-framework-go/component/models/verifiable" + ariesmockstorage "github.com/hyperledger/aries-framework-go/component/storageutil/mock/storage" + vdrapi "github.com/hyperledger/aries-framework-go/component/vdr/api" vdrmock "github.com/hyperledger/aries-framework-go/component/vdr/mock" kmskeytypes "github.com/hyperledger/aries-framework-go/spi/kms" - "github.com/stretchr/testify/require" "github.com/trustbloc/vcs/pkg/doc/vc" "github.com/trustbloc/vcs/pkg/doc/vc/crypto" @@ -639,6 +650,7 @@ func TestService_ValidateCredentialProof(t *testing.T) { proofChallenge string proofDomain string vcInVPValidation bool + isJWT bool } tests := []struct { @@ -673,6 +685,21 @@ func TestService_ValidateCredentialProof(t *testing.T) { }, wantErr: true, }, + { + name: "ProofDomain JWT invalid value", + args: args{ + getVcByte: func() []byte { + vc := *signedVC + b, _ := vc.MarshalJSON() + return b + }, + proofChallenge: crypto.Challenge, + proofDomain: "some value", + vcInVPValidation: false, + isJWT: true, + }, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -686,9 +713,144 @@ func TestService_ValidateCredentialProof(t *testing.T) { tt.args.proofChallenge, tt.args.proofDomain, tt.args.vcInVPValidation, - true); (err != nil) != tt.wantErr { + tt.args.isJWT); (err != nil) != tt.wantErr { t.Errorf("ValidateCredentialProof() error = %v, wantErr %v", err, tt.wantErr) } }) } } + +func Test_DataIntegrity_SignVerify(t *testing.T) { + vcJSON := ` + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + "https://w3id.org/security/data-integrity/v1" + ], + "id": "https://example.com/credentials/1872", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "did:foo:bar", + "issuanceDate": "2020-01-17T15:14:09.724Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree" + }, + "name": "Jayden Doe", + "spouse": "did:example:c276e12ec21ebfeb1f712ebc6f1" + } + } + ` + mockKMS := createKMS(t) + + mockCrypto, err := tinkcrypto.New() + require.NoError(t, err) + + _, keyBytes, err := mockKMS.CreateAndExportPubKeyBytes(kmskeytypes.ECDSAP256IEEEP1363) + require.NoError(t, err) + + key, err := jwkkid.BuildJWK(keyBytes, kmskeytypes.ECDSAP256IEEEP1363) + require.NoError(t, err) + + const signingDID = "did:foo:bar" + + const vmID = "#key-1" + + docLoader := testutil.DocumentLoader(t) + + verificationMethod, err := did.NewVerificationMethodFromJWK(signingDID+vmID, "JsonWebKey2020", signingDID, key) + require.NoError(t, err) + + didResolver := &vdrmock.VDRegistry{ + ResolveFunc: func(didID string, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error) { + return makeMockDIDResolution(signingDID, verificationMethod, did.Authentication), nil + }} + + signerSuite := ecdsa2019.NewSignerInitializer(&ecdsa2019.SignerInitializerOptions{ + SignerGetter: ecdsa2019.WithLocalKMSSigner(mockKMS, mockCrypto), + LDDocumentLoader: docLoader, + }) + + diSigner, err := dataintegrity.NewSigner(&dataintegrity.Options{ + DIDResolver: didResolver, + }, signerSuite) + require.NoError(t, err) + + signContext := &verifiable.DataIntegrityProofContext{ + SigningKeyID: signingDID + vmID, + ProofPurpose: crypto.Authentication, + CryptoSuite: ecdsa2019.SuiteType, + Created: nil, + Domain: "mock-domain", + Challenge: "mock-challenge", + } + + var vcParsed *verifiable.Credential + vcParsed, err = verifiable.ParseCredential([]byte(vcJSON), + verifiable.WithDisabledProofCheck(), + verifiable.WithJSONLDDocumentLoader(docLoader)) + require.NoError(t, err) + + err = vcParsed.AddDataIntegrityProof(signContext, diSigner) + require.NoError(t, err) + + vcBytes, e := vcParsed.MarshalJSON() + require.NoError(t, e) + + t.Run("success", func(t *testing.T) { + s := &Service{ + documentLoader: docLoader, + vdr: didResolver, + } + + if err = s.ValidateCredentialProof( + context.Background(), + vcBytes, + "mock-challenge", + "mock-domain", + false, + false); err != nil { + t.Errorf("ValidateCredentialProof() error = %v", err) + } + }) +} + +func makeMockDIDResolution(id string, vm *did.VerificationMethod, vr did.VerificationRelationship) *did.DocResolution { + ver := []did.Verification{{ + VerificationMethod: *vm, + Relationship: vr, + }} + + doc := &did.Doc{ + ID: id, + } + + switch vr { //nolint:exhaustive + case did.VerificationRelationshipGeneral: + doc.VerificationMethod = []did.VerificationMethod{*vm} + case did.Authentication: + doc.Authentication = ver + case did.AssertionMethod: + doc.AssertionMethod = ver + } + + return &did.DocResolution{ + DIDDocument: doc, + } +} + +func createKMS(t *testing.T) *localkms.LocalKMS { + t.Helper() + + p, err := mockkms.NewProviderForKMS(ariesmockstorage.NewMockStoreProvider(), &noop.NoLock{}) + require.NoError(t, err) + + k, err := localkms.New("local-lock://custom/primary/key/", p) + require.NoError(t, err) + + return k +} diff --git a/test/bdd/bddtests_test.go b/test/bdd/bddtests_test.go index b2c3c0534..b6cc5e175 100644 --- a/test/bdd/bddtests_test.go +++ b/test/bdd/bddtests_test.go @@ -39,7 +39,7 @@ var logger = log.New("vcs-bdd") func TestMain(m *testing.M) { // default is to run all tests with tag @all but excluding those marked with @wip - tags := "@oidc4vc_rest && ~@wip" + tags := "@all && ~@wip" if os.Getenv("TAGS") != "" { tags = os.Getenv("TAGS") diff --git a/test/bdd/features/vc_v1_issue_verify_revoke_api.feature b/test/bdd/features/vc_v1_issue_verify_revoke_api.feature index b830a59db..b6aa87ae0 100644 --- a/test/bdd/features/vc_v1_issue_verify_revoke_api.feature +++ b/test/bdd/features/vc_v1_issue_verify_revoke_api.feature @@ -20,10 +20,11 @@ Feature: Using VC REST API And V1 revoked credential is unable to be verified under "" profile for organization "test_org" Examples: - | issuerProfile | verifierProfile | credential | - | i_myprofile_cmtr_p256_ldp/v1.0 | v_myprofile_ldp/v1.0 | certified_mill_test_report.json | - | i_myprofile_ud_es256k_jwt/v1.0 | v_myprofile_jwt/v1.0 | permanent_resident_card.json | - | i_myprofile_ud_es256k_sdjwt/v1.0 | v_myprofile_jwt/v1.0 | crude_product.json | + | issuerProfile | verifierProfile | credential | + | i_myprofile_cmtr_p256_ldp/v1.0 | v_myprofile_ldp/v1.0 | certified_mill_test_report.json | + | i_myprofile_ud_es256k_jwt/v1.0 | v_myprofile_jwt/v1.0 | permanent_resident_card.json | + | i_myprofile_ud_es256k_sdjwt/v1.0 | v_myprofile_jwt/v1.0 | crude_product.json | + | i_myprofile_ud_di_ecdsa-2019/v1.0 | v_myprofile_ldp/v1.0 | crude_product.json | @e2e_ldp_jwt_sdjwt_revoke_err Scenario Outline: Unsuccessful attempt to revoke credential from wrong issuer (LDP, JWT, SD-JWT). diff --git a/test/bdd/fixtures/file-server/ld-contexts.json b/test/bdd/fixtures/file-server/ld-contexts.json index 8400f9d47..cf29d1a2c 100644 --- a/test/bdd/fixtures/file-server/ld-contexts.json +++ b/test/bdd/fixtures/file-server/ld-contexts.json @@ -84,6 +84,83 @@ } } }, + { + "url": "https://w3id.org/security/data-integrity/v1", + "content" : { + "@context": { + "id": "@id", + "type": "@type", + "@protected": true, + "proof": { + "@id": "https://w3id.org/security#proof", + "@type": "@id", + "@container": "@graph" + }, + "DataIntegrityProof": { + "@id": "https://w3id.org/security#DataIntegrityProof", + "@context": { + "@protected": true, + "id": "@id", + "type": "@type", + "challenge": "https://w3id.org/security#challenge", + "created": { + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + }, + "domain": "https://w3id.org/security#domain", + "expires": { + "@id": "https://w3id.org/security#expiration", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + }, + "nonce": "https://w3id.org/security#nonce", + "proofPurpose": { + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": { + "@protected": true, + "id": "@id", + "type": "@type", + "assertionMethod": { + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set" + }, + "authentication": { + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set" + }, + "capabilityInvocation": { + "@id": "https://w3id.org/security#capabilityInvocationMethod", + "@type": "@id", + "@container": "@set" + }, + "capabilityDelegation": { + "@id": "https://w3id.org/security#capabilityDelegationMethod", + "@type": "@id", + "@container": "@set" + }, + "keyAgreement": { + "@id": "https://w3id.org/security#keyAgreementMethod", + "@type": "@id", + "@container": "@set" + } + } + }, + "cryptosuite": "https://w3id.org/security#cryptosuite", + "proofValue": { + "@id": "https://w3id.org/security#proofValue", + "@type": "https://w3id.org/security#multibase" + }, + "verificationMethod": { + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id" + } + } + } + } + } + }, { "url": "https://www.w3.org/2018/credentials/examples/v1", "content": { diff --git a/test/bdd/fixtures/profile/profiles.json b/test/bdd/fixtures/profile/profiles.json index e29439cca..4e1e5d3b7 100644 --- a/test/bdd/fixtures/profile/profiles.json +++ b/test/bdd/fixtures/profile/profiles.json @@ -24,6 +24,32 @@ "didDomain": "https://testnet.orb.local", "didServiceAuthToken": "tk1" }, + { + "issuer": { + "id": "i_myprofile_ud_di_ecdsa-2019", + "version": "v1.0", + "groupID": "i_myprofile_ud_di_ecdsa-2019", + "name": "i_myprofile_ud_di_ecdsa-2019", + "organizationID": "f13d1va9lp403pb9lyj89vk55", + "url": "http://vc-rest-echo.trustbloc.local:8075", + "active": true, + "vcConfig": { + "signingAlgorithm": "JsonWebSignature2020", + "signatureRepresentation": 0, + "keyType": "ECDSAP256DER", + "format": "ldp", + "didMethod": "ion", + "status": { + "type": "StatusList2021Entry" + }, + "dataIntegrityProof": { + "enable": true, + "suiteType": "ecdsa-2019" + } + } + }, + "createDID": true + }, { "issuer": { "id": "i_myprofile_ud_es256_jwt", @@ -854,7 +880,7 @@ "type": "StatusList2021Entry" }, "sdjwt": { - "version" : 5, + "version": 5, "enable": true, "hashAlg": 6 } diff --git a/test/bdd/go.mod b/test/bdd/go.mod index 7c7306775..64053acad 100644 --- a/test/bdd/go.mod +++ b/test/bdd/go.mod @@ -12,7 +12,7 @@ require ( github.com/gorilla/mux v1.8.0 github.com/greenpau/go-calculator v1.0.1 github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49 - github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 + github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 github.com/hyperledger/aries-framework-go/component/vdr v0.0.0-20230622171716-43af8054a539 github.com/hyperledger/aries-framework-go/spi v0.0.0-20230517133327-301aa0597250 @@ -91,13 +91,13 @@ require ( github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/henvic/httpretty v0.1.0 // indirect - github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 // indirect + github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 // indirect github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk v0.0.0-20221213152252-f0c83a5a922c // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/longform v0.0.0-20221201213446-c4c1e76daa49 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 // indirect github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 // indirect - github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 // indirect + github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c // indirect github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/hyperledger/aries-framework-go/component/storage/leveldb v0.0.0-20221202141134-083803ecf0a3 // indirect github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2 // indirect diff --git a/test/bdd/go.sum b/test/bdd/go.sum index 98c125f87..2f2d656e1 100644 --- a/test/bdd/go.sum +++ b/test/bdd/go.sum @@ -590,8 +590,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 h1:Eg5haDYVi6SjyUsoITVxUsE6cmT+euGHKQTlu9/U0uk= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 h1:Ck8yXjqw+M7Lc0UtS6fO60Uz5Qy8LhaY62ZhAbczVm0= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 h1:8ja6Vnp5EUsh8Oe4mI8ZNwpJtiM7c87X/b9sO/hEFiY= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149/go.mod h1:GDANCnJONcCqBvv6QgKuk5Y2FWHyD/Hu26kyc7NTyfY= github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk v0.0.0-20221213152252-f0c83a5a922c h1:74wqdvAd3S9BuKolIV0obbG8PhbChtF9sQrE/ov2se0= @@ -604,12 +604,12 @@ github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3. github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122/go.mod h1:kHGEwgl2Wo1dYj0rs6u8Kk/GjHmmwZI7445lU+9CJtI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 h1:6pkyx5TMJEZpau/HsDNSndZy+MrX9hJmWAtGM1UaGuI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4/go.mod h1:SCS+CWl/U4qRgy540BAKvSlLHAUXrw29pmuhp3nMzbY= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 h1:x7Lt4FAPmMNyKQCUhnUOYeDpskaHnRNrtZj4rKfSKfU= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857/go.mod h1:xgNlHAVQjqwoknzHbXkeHkAJgUxRWKfHXPT3nhVhH3Q= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c h1:4XItY3Af3ioolP+Ow3bEQ+weq+VBk+4IaEHCWJgI50A= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c/go.mod h1:nmT2WqhIs9Eyncdr9feYrUIy7ggf00bWnTzCN6/t8PY= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 h1:x5qFQraTX86z9GCwF28IxfnPm6QH5YgHaX+4x97Jwvw= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3/go.mod h1:CvYs4l8X2NrrF93weLOu5RTOIJeVdoZITtjEflyuTyM= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 h1:W8F1CA8P/bNb92P/JMYG2nWqv0bxLL58/Q8Rw9nsNyI= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968/go.mod h1:AJkRLmQB1/umL5GfXw/XIarGaH/XCQOL/6wlGtqdDpA= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 h1:mEusaX1RvHx5aYhYPsqKnPMv4w+0NeYMCwTm0fZic24= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28/go.mod h1:Vd22w/OAXZy61UQd6Dxo/BzJdafg8xhb/RsPwXzAn6Q= github.com/hyperledger/aries-framework-go/component/storage/leveldb v0.0.0-20221202141134-083803ecf0a3 h1:GF7p/WrgKrhq7d0d9b6nkuW/sidMOwla9Muj4g+BgSY= github.com/hyperledger/aries-framework-go/component/storage/leveldb v0.0.0-20221202141134-083803ecf0a3/go.mod h1:i/bnCdoiv0a9fgHQtd+EiAxmCdaJKE3JYrgDUACKgyE= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 h1:JGYA9l5zTlvsvfnXT9hYPpCokAjmVKX0/r7njba7OX4= diff --git a/test/bdd/pkg/bddutil/contexts/vc-data-integrity-v1.jsonld b/test/bdd/pkg/bddutil/contexts/vc-data-integrity-v1.jsonld new file mode 100644 index 000000000..d8a50543e --- /dev/null +++ b/test/bdd/pkg/bddutil/contexts/vc-data-integrity-v1.jsonld @@ -0,0 +1,74 @@ +{ + "@context": { + "id": "@id", + "type": "@type", + "@protected": true, + "proof": { + "@id": "https://w3id.org/security#proof", + "@type": "@id", + "@container": "@graph" + }, + "DataIntegrityProof": { + "@id": "https://w3id.org/security#DataIntegrityProof", + "@context": { + "@protected": true, + "id": "@id", + "type": "@type", + "challenge": "https://w3id.org/security#challenge", + "created": { + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + }, + "domain": "https://w3id.org/security#domain", + "expires": { + "@id": "https://w3id.org/security#expiration", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + }, + "nonce": "https://w3id.org/security#nonce", + "proofPurpose": { + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": { + "@protected": true, + "id": "@id", + "type": "@type", + "assertionMethod": { + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set" + }, + "authentication": { + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set" + }, + "capabilityInvocation": { + "@id": "https://w3id.org/security#capabilityInvocationMethod", + "@type": "@id", + "@container": "@set" + }, + "capabilityDelegation": { + "@id": "https://w3id.org/security#capabilityDelegationMethod", + "@type": "@id", + "@container": "@set" + }, + "keyAgreement": { + "@id": "https://w3id.org/security#keyAgreementMethod", + "@type": "@id", + "@container": "@set" + } + } + }, + "cryptosuite": "https://w3id.org/security#cryptosuite", + "proofValue": { + "@id": "https://w3id.org/security#proofValue", + "@type": "https://w3id.org/security#multibase" + }, + "verificationMethod": { + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id" + } + } + } + } +} \ No newline at end of file diff --git a/test/bdd/pkg/bddutil/util.go b/test/bdd/pkg/bddutil/util.go index 9766098ad..9768c9949 100644 --- a/test/bdd/pkg/bddutil/util.go +++ b/test/bdd/pkg/bddutil/util.go @@ -282,6 +282,8 @@ var ( odrl []byte //go:embed contexts/revocation-list-2021.jsonld revocationList2021 []byte + //go:embed contexts/vc-data-integrity-v1.jsonld + vcDataIntegrity []byte ) var extraContexts = []ldcontext.Document{ //nolint:gochecknoglobals @@ -315,6 +317,10 @@ var extraContexts = []ldcontext.Document{ //nolint:gochecknoglobals DocumentURL: "https://raw.githubusercontent.com/w3c-ccg/vc-status-list-2021/343b8b59cddba4525e1ef355356ae760fc75904e/contexts/v1.jsonld", Content: revocationList2021, }, + ldcontext.Document{ + URL: "https://w3id.org/security/data-integrity/v1", + Content: vcDataIntegrity, + }, } type ldStoreProvider struct { diff --git a/test/stress/go.mod b/test/stress/go.mod index 9fac7fe7d..ac8a9383c 100644 --- a/test/stress/go.mod +++ b/test/stress/go.mod @@ -9,7 +9,7 @@ go 1.21 require ( github.com/google/uuid v1.3.0 github.com/greenpau/go-calculator v1.0.1 - github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 + github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 github.com/imroc/req/v3 v3.34.0 github.com/joho/godotenv v1.4.0 github.com/labstack/echo/v4 v4.9.0 @@ -83,14 +83,14 @@ require ( github.com/hashicorp/go-retryablehttp v0.7.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/henvic/httpretty v0.1.0 // indirect - github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 // indirect + github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 // indirect github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk v0.0.0-20221213152252-f0c83a5a922c // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/longform v0.0.0-20221201213446-c4c1e76daa49 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v1.0.0-rc5.0.20221201213446-c4c1e76daa49 // indirect github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122 // indirect github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 // indirect - github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 // indirect + github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c // indirect github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/hyperledger/aries-framework-go/component/storage/leveldb v0.0.0-20221202141134-083803ecf0a3 // indirect github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 // indirect diff --git a/test/stress/go.sum b/test/stress/go.sum index e9522b6e7..ca781dd74 100644 --- a/test/stress/go.sum +++ b/test/stress/go.sum @@ -573,8 +573,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968 h1:Eg5haDYVi6SjyUsoITVxUsE6cmT+euGHKQTlu9/U0uk= -github.com/hyperledger/aries-framework-go v0.3.3-0.20230810150537-71e132ba5968/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28 h1:Ck8yXjqw+M7Lc0UtS6fO60Uz5Qy8LhaY62ZhAbczVm0= +github.com/hyperledger/aries-framework-go v0.3.3-0.20230828151543-984699876d28/go.mod h1:uH0Od/EyS1bQkW1BWo8qqz8szU3VEpNK1YXR1SJgqK4= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149 h1:8ja6Vnp5EUsh8Oe4mI8ZNwpJtiM7c87X/b9sO/hEFiY= github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20220728172020-0a8903e45149/go.mod h1:GDANCnJONcCqBvv6QgKuk5Y2FWHyD/Hu26kyc7NTyfY= github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk v0.0.0-20221213152252-f0c83a5a922c h1:74wqdvAd3S9BuKolIV0obbG8PhbChtF9sQrE/ov2se0= @@ -587,12 +587,12 @@ github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3. github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree v1.0.0-rc3.0.20221104150937-07bfbe450122/go.mod h1:kHGEwgl2Wo1dYj0rs6u8Kk/GjHmmwZI7445lU+9CJtI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4 h1:6pkyx5TMJEZpau/HsDNSndZy+MrX9hJmWAtGM1UaGuI= github.com/hyperledger/aries-framework-go/component/didconfig v0.0.0-20230622211121-852ce35730b4/go.mod h1:SCS+CWl/U4qRgy540BAKvSlLHAUXrw29pmuhp3nMzbY= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857 h1:x7Lt4FAPmMNyKQCUhnUOYeDpskaHnRNrtZj4rKfSKfU= -github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230622082138-3ffab1691857/go.mod h1:xgNlHAVQjqwoknzHbXkeHkAJgUxRWKfHXPT3nhVhH3Q= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c h1:4XItY3Af3ioolP+Ow3bEQ+weq+VBk+4IaEHCWJgI50A= +github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230822161205-69119012ed5c/go.mod h1:nmT2WqhIs9Eyncdr9feYrUIy7ggf00bWnTzCN6/t8PY= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 h1:x5qFQraTX86z9GCwF28IxfnPm6QH5YgHaX+4x97Jwvw= github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3/go.mod h1:CvYs4l8X2NrrF93weLOu5RTOIJeVdoZITtjEflyuTyM= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968 h1:W8F1CA8P/bNb92P/JMYG2nWqv0bxLL58/Q8Rw9nsNyI= -github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230810150537-71e132ba5968/go.mod h1:AJkRLmQB1/umL5GfXw/XIarGaH/XCQOL/6wlGtqdDpA= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28 h1:mEusaX1RvHx5aYhYPsqKnPMv4w+0NeYMCwTm0fZic24= +github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230828151543-984699876d28/go.mod h1:Vd22w/OAXZy61UQd6Dxo/BzJdafg8xhb/RsPwXzAn6Q= github.com/hyperledger/aries-framework-go/component/storage/leveldb v0.0.0-20221202141134-083803ecf0a3 h1:GF7p/WrgKrhq7d0d9b6nkuW/sidMOwla9Muj4g+BgSY= github.com/hyperledger/aries-framework-go/component/storage/leveldb v0.0.0-20221202141134-083803ecf0a3/go.mod h1:i/bnCdoiv0a9fgHQtd+EiAxmCdaJKE3JYrgDUACKgyE= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 h1:JGYA9l5zTlvsvfnXT9hYPpCokAjmVKX0/r7njba7OX4=