From 05339023ed5c3da63ca07ae476fb8a7dfa6b93fa Mon Sep 17 00:00:00 2001 From: Stas Dmytryshyn Date: Tue, 26 Nov 2024 07:46:31 +0100 Subject: [PATCH] feat: better support for test suites (#1803) * feat: better support for test suites * fix: lint issues * feat: more logic * feat: update vc * fix: lint * fix: verify cred * fix: more tests * fix: more changes * feat: better coverage --- .github/workflows/build.yml | 1 + Makefile | 2 +- api/spec/openapi.gen.go | 154 +++++++------- cmd/vc-rest/go.mod | 2 +- cmd/vc-rest/go.sum | 4 +- component/credentialstatus/go.mod | 2 +- component/credentialstatus/go.sum | 4 +- component/event/go.mod | 2 +- component/event/go.sum | 4 +- component/profile/reader/file/go.mod | 2 +- component/profile/reader/file/go.sum | 4 +- component/profile/reader/file/reader.go | 12 +- component/wallet-cli/go.mod | 2 +- component/wallet-cli/go.sum | 4 +- docs/v1/openapi.yaml | 2 - go.mod | 2 +- go.sum | 4 +- pkg/doc/verifiable/format.go | 7 + pkg/doc/verifiable/format_test.go | 11 + pkg/restapi/resterr/error.go | 4 + pkg/restapi/resterr/error_test.go | 11 + pkg/restapi/v1/issuer/controller.go | 55 ++++- pkg/restapi/v1/issuer/controller_test.go | 79 +++++++ pkg/restapi/v1/verifier/controller.go | 22 +- pkg/restapi/v1/verifier/controller_test.go | 54 +++++ pkg/restapi/v1/verifier/openapi.gen.go | 2 +- .../verifycredential_service.go | 2 +- test/bdd/attestation/go.mod | 2 +- test/bdd/attestation/go.sum | 4 +- .../vc_v1_issue_verify_revoke_api.feature | 20 +- .../krakend-config/settings/endpoint.json | 196 ++++++++++++++++++ test/bdd/fixtures/profile/profiles.json | 94 ++++++++- test/bdd/go.mod | 2 +- test/bdd/go.sum | 4 +- test/bdd/pkg/v1/vc/credential.go | 52 +++-- test/bdd/pkg/v1/vc/stress_steps.go | 18 +- test/bdd/pkg/v1/vc/types.go | 13 ++ test/stress/go.mod | 2 +- test/stress/go.sum | 4 +- 39 files changed, 705 insertions(+), 160 deletions(-) create mode 100644 test/bdd/pkg/v1/vc/types.go diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7bb3bdc28..df5f97c5e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,6 +50,7 @@ jobs: go-version: '${{ env.GO_VERSION }}' - name: Run unit tests run: make unit-test + - run: cat /home/runner/work/vcs/vcs/coverage.out | grep -v "_mock.go" | grep -v "_mocks.go" | grep -v "_mocks_test.go" | grep -v "_mock_test.go" | grep -v "profile/reader/file" > /home/runner/work/vcs/vcs/coverage.out || true - uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} diff --git a/Makefile b/Makefile index 1143be249..48bc41b0a 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ ALPINE_IMAGE ?=alpine OPENSSL_IMAGE ?=frapsoft/openssl GOPROXY ?= https://proxy.golang.org -VC_FRAMEWORK_VERSION = cb8385b93255603591afecbb8cd7774e1e227093 +VC_FRAMEWORK_VERSION = c33f1ff65382cca7cbe086fa8ce09225df0c7358 KMS_FRAMEWORK_VERSION = 8d9510c6bb88df0666fa45c55c0ace699a675b12 DID_GO_VERSION = c010226da5809c82661f476bb82138050cf956f1 SIDE_TREE_VERSION = f4260aff710479ba5fa3f0c61b51d451d9041225 diff --git a/api/spec/openapi.gen.go b/api/spec/openapi.gen.go index bb3c94dcf..89abfbbc7 100644 --- a/api/spec/openapi.gen.go +++ b/api/spec/openapi.gen.go @@ -152,83 +152,83 @@ var swaggerSpec = []string{ "I7e9xFfzQOrE2PaPoC0ic+/Ho99yYnPjGhQ3L/3mn+rzgH5auSw9a3GwsQMgZ9PuxbXCO6AOw4CtU/59", "RaLbpgQk/XEwoc6xpSwwTXJOUKSmQobphIrRkeg2dM9qFJynOX63PgwCZdGaCIGXZOeybVduVlTjW1rV", "teEgdmfBhao31ADw3nlT1Um6ylc6N+bu7qG5x7uUnkTf4eh2g7l679YZlvSGJlRuweeEyl7YR14S7sAk", - "5p5FHKtQLKo4u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", - "Hlz8ePru7XGhnJjM/jvTyiHiTIiJoLLc7YLxpSmHEwRkUa6oNyBPUkUkcZkZ05y/FbH0jmyFycHSf3N6", - "WThWePVvXWgTbbCp/Mxu1E1M0c95ImmWNC7iKGuaGrYKnUD0mPuRBMUVehdGU91imi3Q2i5VMVqGQBcu", - "GjYIlDr69wthwoeVbJGSSNo493fnb/X9m39D2xGbwBJTEbE7yEsxVAy8ThK+pilxAPqFAlGGoRQMJQLw", - "tyjPPkXnJ0enP/988svxybGCRJFU4QqhrbRo66Nq8WdHmgSn1Qp8/SUm/Hz4LziuIseyna6lPY0jmaRr", - "+m9SUNIXApFPGeGUpBF5hNNB6Ty1sdHAWFNgvCbh0NS/104om/Rlrs12DiCfpG1hUDFsED5Fh2aqsn25", - "W2eubMeSYSF0gTeculYR0LDdhsfFi1+qeiXkTRoGrwbruTXt1EowxMygK5+ZbXqMrH6ay3JdKM8o8S2Y", - "bphi/yy31dZtOTW1bMokWuZYSYVEb4BxuqSp+tmchZrWSXyMIpYnseIKOEVYSsWpG+7X3fxOV+wkVOk2", - "+kU7Gp0vgL0uBOoY1T4LoeejpXBmR9VMGk90Vpv+88TyCXyTEFM/88PIpnAToaRdK1d+GNUTcwuWCVUF", - "f7y8PLtAN1Ak893523CH7Q9O6yMoz9nSLbzIjcMJJzje6gYDphxp2coLELXs0GDbEFHdMoObmOjKOIUV", - "+sv/+7//j0ClBowSVtYCaZW05xqUoyEx4F+9+rJFkf002Ww2kwXj60nOE6LfUl+zDRetDpeiDAkguj8L", - "SUlRkLYdywKjQSMyfa+gX3uyRXgBaAGobXzlSmCiki6tbZRTcaue0YTg24Y+JeH6j0VlTbowKAQfegip", - "ZHpTEMMip5MiVZdV4WzkE45s3jcnEaloO32bNNhip12+vu9ZnsYVKwJYDbribMvGC4VaXS2a0RyMc9lW", - "aELflShFG8fTquDI0sDgIuVekX2WcXZXItJJGk+gbGyegQrhlpVZIKyLsKJDLcfr9Dmv3xgwaj2pKUBX", - "09+fJnqz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Q7kP3oCab9o8eXGHHUjRt1wRym3ZVQsibV2JtE+0c+/y02CQ6KX1uJA33VEATheLXghbUQccfLju/2A/", + "kk1cMTRgUF3JR4UxvlL0HseotO3XGL5XELmd67c62rTNQxP3c+6R99pqwAgUa41Uv3+pU4zXMP2CvV8d", + "XTSy2pB8oxfQros9OYjsIrBpvVKrw+j1flfuqfC+2ucuOn1VHZRnpzSIUFxfmAKNuNRKhI3C94DitGbD", + "Tp5X72KnT1iAo07Rj07Qj1GY4+kqrvaN24BbPbzDFJ6/7icl6Pr9hSGDURW8/oHIQq7XCFZpE+rGEdhk", + "VQgkaGCdIICaImkxemGGkPhle/mNH4hFYBJ7oSTPaPwEaPz4r0/4Ps/Jb/sWv5oWFlnPwJreCFynCsX1", + "rcrkp3lXaxGWLQTDhlBo4PlsBn02gz6bQbdONYDCyumWuvALcmhvlhcMDCpn2C7qdE9sJt7f5SeoXZ9g", + "unYEtqoUpkP/Z85IKG+8h4JysBO3oJwrJea23cUOdf67wLwk0hZdKOx4xpluLMxu3ZNpGNBdb/oxeLLL", + "Um3hB9aUaRsYFVhc8PDSarolbreyfGwd8QUU3fp9exNOriqrobsn0JvrJdSqHaX3VUMt2AF933Uzm7pl", + "9yqXWe2f3oML7b+a018XWYs6QTSOHJ79FLWQrs6eAlsrSw5C1id/b/thurvKIzDkPwTF/wh27DWX3yc/", + "rvWpfxKOHOyZPYAnZz54QriqhoFBV2NY2QPrzcFBwiKcrJiQb/7r1d9fjdSFmCmqOKE91BPtBovRmsUk", + "qQRFVfOBR3XMsvvqOU9xjIAnW8fhrQhO5ApBd/JynP6r/uP99f3/CwAA//9p29sM6D0BAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/cmd/vc-rest/go.mod b/cmd/vc-rest/go.mod index 038e912a4..76218d61c 100644 --- a/cmd/vc-rest/go.mod +++ b/cmd/vc-rest/go.mod @@ -25,7 +25,7 @@ require ( github.com/trustbloc/did-go v1.3.1-0.20241122115441-c010226da580 github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 + github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 github.com/trustbloc/vcs v0.0.0 github.com/trustbloc/vcs/component/credentialstatus v0.0.0-00010101000000-000000000000 github.com/trustbloc/vcs/component/echo v0.0.0-00010101000000-000000000000 diff --git a/cmd/vc-rest/go.sum b/cmd/vc-rest/go.sum index 1cc315bfb..a5532951a 100644 --- a/cmd/vc-rest/go.sum +++ b/cmd/vc-rest/go.sum @@ -676,8 +676,8 @@ github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e h1:r0AVM5IL github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e/go.mod h1:AuHbwVcx1Rl6KNG2oFvlUR79egmDM8urblUaJ24p85A= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 h1:zkvZltnfUNDPEHeM2WTE6cFD0Qn9nsPdCKr9153JFEE= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 h1:+A9r9mKaofDng9dVPu4SV896o6as6Ux9M0PQkRW8EHQ= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= diff --git a/component/credentialstatus/go.mod b/component/credentialstatus/go.mod index 1eb0c29cd..d6e6f0321 100644 --- a/component/credentialstatus/go.mod +++ b/component/credentialstatus/go.mod @@ -19,7 +19,7 @@ require ( github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 + github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 github.com/trustbloc/vcs v0.0.0-00010101000000-000000000000 ) diff --git a/component/credentialstatus/go.sum b/component/credentialstatus/go.sum index e893af84c..7fbc77367 100644 --- a/component/credentialstatus/go.sum +++ b/component/credentialstatus/go.sum @@ -472,8 +472,8 @@ github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e h1:r0AVM5IL github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e/go.mod h1:AuHbwVcx1Rl6KNG2oFvlUR79egmDM8urblUaJ24p85A= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 h1:zkvZltnfUNDPEHeM2WTE6cFD0Qn9nsPdCKr9153JFEE= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 h1:+A9r9mKaofDng9dVPu4SV896o6as6Ux9M0PQkRW8EHQ= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= diff --git a/component/event/go.mod b/component/event/go.mod index 410c897a1..238c1a721 100644 --- a/component/event/go.mod +++ b/component/event/go.mod @@ -13,7 +13,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/trustbloc/cmdutil-go v1.0.0 github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e - github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 + github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 github.com/trustbloc/vcs v0.0.0-00010101000000-000000000000 go.opentelemetry.io/otel/trace v1.29.0 ) diff --git a/component/event/go.sum b/component/event/go.sum index c2f20b60b..bda8d4f78 100644 --- a/component/event/go.sum +++ b/component/event/go.sum @@ -454,8 +454,8 @@ github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 h1:k3KNf9tE4TBV github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e h1:r0AVM5ILWbtXLDLBKTL9u2F/EOZH/7JU/owOjfbESME= github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e/go.mod h1:AuHbwVcx1Rl6KNG2oFvlUR79egmDM8urblUaJ24p85A= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 h1:zkvZltnfUNDPEHeM2WTE6cFD0Qn9nsPdCKr9153JFEE= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 h1:+A9r9mKaofDng9dVPu4SV896o6as6Ux9M0PQkRW8EHQ= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= diff --git a/component/profile/reader/file/go.mod b/component/profile/reader/file/go.mod index 74e0ade8d..4cb42ff16 100644 --- a/component/profile/reader/file/go.mod +++ b/component/profile/reader/file/go.mod @@ -125,7 +125,7 @@ require ( github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/sjson v1.2.5 // indirect github.com/trustbloc/bbs-signature-go v1.0.2 // indirect - github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 // indirect + github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect github.com/veraison/go-cose v1.3.0-rc.1 // indirect diff --git a/component/profile/reader/file/go.sum b/component/profile/reader/file/go.sum index bed951689..38b14c5ba 100644 --- a/component/profile/reader/file/go.sum +++ b/component/profile/reader/file/go.sum @@ -476,8 +476,8 @@ github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e h1:r0AVM5IL github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e/go.mod h1:AuHbwVcx1Rl6KNG2oFvlUR79egmDM8urblUaJ24p85A= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 h1:zkvZltnfUNDPEHeM2WTE6cFD0Qn9nsPdCKr9153JFEE= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 h1:+A9r9mKaofDng9dVPu4SV896o6as6Ux9M0PQkRW8EHQ= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= diff --git a/component/profile/reader/file/reader.go b/component/profile/reader/file/reader.go index ab8ea3ea4..2f5374fba 100644 --- a/component/profile/reader/file/reader.go +++ b/component/profile/reader/file/reader.go @@ -165,7 +165,17 @@ func (p *IssuerReader) GetProfile( return nil, resterr.ErrProfileInactive } - return profile, nil + b, err := json.Marshal(profile) // nolint:staticcheck + if err != nil { + return nil, fmt.Errorf("marshal profile: %w", err) + } + + var cloned profileapi.Issuer + if err = json.Unmarshal(b, &cloned); err != nil { + return nil, fmt.Errorf("unmarshal profile: %w", err) + } + + return &cloned, nil } // GetAllProfiles returns all profiles with given organization id. diff --git a/component/wallet-cli/go.mod b/component/wallet-cli/go.mod index 4cdb90478..b16533b2d 100644 --- a/component/wallet-cli/go.mod +++ b/component/wallet-cli/go.mod @@ -27,7 +27,7 @@ require ( github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 + github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 github.com/trustbloc/vcs v0.0.0-00010101000000-000000000000 github.com/valyala/fastjson v1.6.4 github.com/veraison/go-cose v1.3.0-rc.1 diff --git a/component/wallet-cli/go.sum b/component/wallet-cli/go.sum index 47e977c0f..7ace779a6 100644 --- a/component/wallet-cli/go.sum +++ b/component/wallet-cli/go.sum @@ -624,8 +624,8 @@ github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e h1:r0AVM5IL github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e/go.mod h1:AuHbwVcx1Rl6KNG2oFvlUR79egmDM8urblUaJ24p85A= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 h1:zkvZltnfUNDPEHeM2WTE6cFD0Qn9nsPdCKr9153JFEE= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 h1:+A9r9mKaofDng9dVPu4SV896o6as6Ux9M0PQkRW8EHQ= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= diff --git a/docs/v1/openapi.yaml b/docs/v1/openapi.yaml index f2c902e26..7eb4c0ea6 100644 --- a/docs/v1/openapi.yaml +++ b/docs/v1/openapi.yaml @@ -1159,8 +1159,6 @@ components: - type: object description: Credential in jws(string) or jsonld(object) formats. Backward compatibility, use verifiableCredential. deprecated: true - required: - - verifiableCredential CredentialDisplay: title: CredentialDisplay x-tag: diff --git a/go.mod b/go.mod index cca082176..027a12e77 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( github.com/trustbloc/did-go v1.3.1-0.20241122115441-c010226da580 github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e - github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 + github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 github.com/valyala/fastjson v1.6.4 github.com/veraison/go-cose v1.3.0-rc.1 github.com/xeipuuv/gojsonschema v1.2.0 diff --git a/go.sum b/go.sum index 7182062f2..0e7644a00 100644 --- a/go.sum +++ b/go.sum @@ -637,8 +637,8 @@ github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 h1:k3KNf9tE4TBV github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e h1:r0AVM5ILWbtXLDLBKTL9u2F/EOZH/7JU/owOjfbESME= github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e/go.mod h1:AuHbwVcx1Rl6KNG2oFvlUR79egmDM8urblUaJ24p85A= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 h1:zkvZltnfUNDPEHeM2WTE6cFD0Qn9nsPdCKr9153JFEE= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 h1:+A9r9mKaofDng9dVPu4SV896o6as6Ux9M0PQkRW8EHQ= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= diff --git a/pkg/doc/verifiable/format.go b/pkg/doc/verifiable/format.go index 2dabef8bf..2b72cbce8 100644 --- a/pkg/doc/verifiable/format.go +++ b/pkg/doc/verifiable/format.go @@ -39,6 +39,13 @@ const ( func ValidateFormat(data interface{}, formats []Format) ([]byte, error) { strRep, isStr := data.(string) + if !isStr { + if mapped, ok := data.(*string); ok { + strRep = *mapped + isStr = true + } + } + var dataBytes []byte if isStr { diff --git a/pkg/doc/verifiable/format_test.go b/pkg/doc/verifiable/format_test.go index c013c0547..99daab39f 100644 --- a/pkg/doc/verifiable/format_test.go +++ b/pkg/doc/verifiable/format_test.go @@ -9,6 +9,8 @@ package verifiable import ( "reflect" "testing" + + "github.com/samber/lo" ) func TestValidateFormat(t *testing.T) { @@ -31,6 +33,15 @@ func TestValidateFormat(t *testing.T) { want: []byte("some data"), wantErr: false, }, + { + name: "OK JWT (PTR)", + args: args{ + data: lo.ToPtr("some data"), + formats: []Format{Jwt}, + }, + want: []byte("some data"), + wantErr: false, + }, { name: "Error JWT", args: args{ diff --git a/pkg/restapi/resterr/error.go b/pkg/restapi/resterr/error.go index db9e7bb4f..43d479df4 100644 --- a/pkg/restapi/resterr/error.go +++ b/pkg/restapi/resterr/error.go @@ -58,6 +58,7 @@ const ( VCOptionsNotConfigured ErrorCode = "vc-options-not-configured" InvalidIssuerURL ErrorCode = "invalid-issuer-url" InvalidStateTransition ErrorCode = "invalid-state-transition" + BadRequest ErrorCode = "bad-request" ) type Component = string @@ -212,6 +213,9 @@ func (e *CustomError) HTTPCodeMsg() (int, interface{}) { case AlreadyExist: code = http.StatusConflict + case BadRequest: + code = http.StatusBadRequest + case DoesntExist: code = http.StatusNotFound diff --git a/pkg/restapi/resterr/error_test.go b/pkg/restapi/resterr/error_test.go index 53fd05263..eb76e9ef7 100644 --- a/pkg/restapi/resterr/error_test.go +++ b/pkg/restapi/resterr/error_test.go @@ -71,6 +71,17 @@ func TestNewValidationError(t *testing.T) { requireMessage(t, resp, "some error") }) + t.Run("bad request", func(t *testing.T) { + err := NewValidationError(BadRequest, "test.value1", errors.New("some error")) + require.Equal(t, "bad-request[test.value1]: some error", err.Error()) + + httpCode, resp := err.HTTPCodeMsg() + + require.Equal(t, http.StatusBadRequest, httpCode) + requireCode(t, resp, BadRequest.Name()) + requireMessage(t, resp, "some error") + }) + t.Run("Condition not met error", func(t *testing.T) { err := NewValidationError(ConditionNotMet, "test.value1", errors.New("some error")) require.Equal(t, "condition-not-met[test.value1]: some error", err.Error()) diff --git a/pkg/restapi/v1/issuer/controller.go b/pkg/restapi/v1/issuer/controller.go index fbecd50c7..e61922ef2 100644 --- a/pkg/restapi/v1/issuer/controller.go +++ b/pkg/restapi/v1/issuer/controller.go @@ -199,12 +199,18 @@ func (c *Controller) PostIssueCredentials(e echo.Context, profileID, profileVers credential, err := c.issueCredential(ctx, tenantID, &body, profileID, profileVersion) if err != nil { - return err + var customError *resterr.CustomError + if errors.As(err, &customError) { + return err + } + + return resterr.NewValidationError(resterr.BadRequest, "body", err) } return util.WriteOutputWithCode(http.StatusCreated, e)(credential, nil) } +// nolint:gocognit func (c *Controller) ValidateRawCredential( finalCredentials map[string]interface{}, profile *profileapi.Issuer, @@ -250,9 +256,19 @@ func (c *Controller) ValidateRawCredential( } } - if _, credSubOk := finalCredentials["credentialSubject"].(map[string]interface{}); !credSubOk { + credSubjectKind := reflect.TypeOf(finalCredentials["credentialSubject"]).Kind() + if credSubjectKind != reflect.Map && credSubjectKind != reflect.Array && credSubjectKind != reflect.Slice { return resterr.NewValidationError(resterr.InvalidValue, "credential_subject", - errors.New("credential_subject must be an object")) + errors.New("credential_subject must be an object or an array of objects")) + } + + if subjects, subjectsOk := finalCredentials["credentialSubject"].([]interface{}); subjectsOk { + for _, subject := range subjects { + if mappedSubject, ok := subject.(map[string]interface{}); !ok || len(mappedSubject) == 0 { + return resterr.NewValidationError(resterr.InvalidValue, "credential_subject", + errors.New("each credential_subject must have properties")) + } + } } return nil @@ -288,6 +304,12 @@ func (c *Controller) issueCredential( if validationErr := c.ValidateRawCredential(v, profile); validationErr != nil { return nil, validationErr } + + if profile.VCConfig.Model == vcsverifiable.V1_1 { + if _, dateOk := v["issuanceDate"]; !dateOk { + v["issuanceDate"] = utiltime.NewTime(time.Now().UTC()).FormatToString() // vc-api-verifier-test-suite + } + } } } else { credentialTemplate, tmplErr := c.extractCredentialTemplate(profile, body) @@ -320,12 +342,12 @@ func (c *Controller) issueCredential( errors.New("id must be a valid URL")) } - if err = c.validateRelatedResources(credentialParsed); err != nil { - return nil, resterr.NewValidationError(resterr.InvalidValue, "credential", err) + if err = c.ValidateRelatedResources(credentialParsed.CustomField("relatedResource")); err != nil { + return nil, resterr.NewValidationError(resterr.InvalidValue, "credential.relatedResources", err) } if err = c.validateCredentialSchemas(credentialParsed); err != nil { - return nil, resterr.NewValidationError(resterr.InvalidValue, "credential", err) + return nil, resterr.NewValidationError(resterr.InvalidValue, "credential.schemas", err) } content := credentialParsed.Contents() @@ -380,8 +402,9 @@ func (c *Controller) validateCredentialSchemas(cred *verifiable.Credential) erro return nil } -func (c *Controller) validateRelatedResources(cred *verifiable.Credential) error { - relatedResources := cred.CustomField("relatedResource") +func (c *Controller) ValidateRelatedResources( + relatedResources any, +) error { if relatedResources == nil { return nil } @@ -391,17 +414,27 @@ func (c *Controller) validateRelatedResources(cred *verifiable.Credential) error return errors.New("relatedResource must be an array") } + ids := map[string]struct{}{} + for _, relatedResource := range relatedResourcesArray { relatedResourceMap, itemMapOk := relatedResource.(map[string]interface{}) if !itemMapOk { return errors.New("relatedResource must be a map") } - _, ok = relatedResourceMap["id"] - if !ok { + idObj, idOk := relatedResourceMap["id"] + if !idOk { return errors.New("relatedResource must have an id") } + mappedID := fmt.Sprint(idObj) + + if _, ok = ids[mappedID]; ok { + return errors.New("relatedResource must have unique ids") + } + + ids[mappedID] = struct{}{} + _, hasDigest := relatedResourceMap["digestSRI"] _, hasMultiBase := relatedResourceMap["digestMultibase"] @@ -545,7 +578,7 @@ func validateIssueCredOptions( return signingOpts, nil } - if options.CredentialStatus.Type != "" && + if options.CredentialStatus != nil && options.CredentialStatus.Type != "" && options.CredentialStatus.Type != string(profile.VCConfig.Status.Type) { return nil, resterr.NewValidationError(resterr.InvalidValue, "options.credentialStatus", fmt.Errorf("not supported credential status type : %s", options.CredentialStatus.Type)) diff --git a/pkg/restapi/v1/issuer/controller_test.go b/pkg/restapi/v1/issuer/controller_test.go index 588db3392..47ff88721 100644 --- a/pkg/restapi/v1/issuer/controller_test.go +++ b/pkg/restapi/v1/issuer/controller_test.go @@ -3387,6 +3387,85 @@ func Test_sendFailedEvent(t *testing.T) { }) } +func TestValidateRawCredential(t *testing.T) { + c := &Controller{} + + t.Run("validate credentialSubjectType", func(t *testing.T) { + assert.ErrorContains(t, c.ValidateRawCredential(map[string]any{ + "@context": []any{ + "https://www.w3.org/ns/credentials/v2", + }, + "credentialSubject": 1234, + }, &profileapi.Issuer{}), "credential_subject must be an object or an array of objects") + }) + + t.Run("validate credentialSubject properties", func(t *testing.T) { + assert.ErrorContains(t, c.ValidateRawCredential(map[string]any{ + "@context": []interface{}{ + "https://www.w3.org/ns/credentials/v2", + }, + "credentialSubject": []any{ + map[string]any{}, + }, + }, &profileapi.Issuer{}), "each credential_subject must have properties") + }) +} + +func TestValidateRelatedResources(t *testing.T) { + t.Run("success", func(t *testing.T) { + c := &Controller{} + + assert.NoError(t, c.ValidateRelatedResources([]any{ + map[string]any{ + "id": "https://example.com/credential", + "digestSRI": "sha256-1234", + }, + map[string]any{ + "id": "https://example.com/credential1", + "digestSRI": "xxx", + }, + })) + }) + + t.Run("duplicate", func(t *testing.T) { + c := &Controller{} + + assert.ErrorContains(t, c.ValidateRelatedResources([]any{ + map[string]any{ + "id": "https://example.com/credential", + "digestSRI": "sha256-1234", + }, + map[string]any{ + "id": "https://example.com/credential", + "digestSRI": "xxx", + }, + }), "relatedResource must have unique ids") + }) + + t.Run("duplicate", func(t *testing.T) { + c := &Controller{} + + assert.ErrorContains(t, c.ValidateRelatedResources([]any{ + map[string]any{ + "id": "https://example.com/credential", + }, + }), "digestMultibase or digestSRI") + }) + + t.Run("wrong type", func(t *testing.T) { + c := &Controller{} + + assert.ErrorContains(t, c.ValidateRelatedResources(1234), + "relatedResource must be an array") + }) + + t.Run("no records", func(t *testing.T) { + c := &Controller{} + + assert.NoError(t, c.ValidateRelatedResources(nil)) + }) +} + type options struct { tenantID string requestBody []byte diff --git a/pkg/restapi/v1/verifier/controller.go b/pkg/restapi/v1/verifier/controller.go index d27d956b5..3f17ff7ac 100644 --- a/pkg/restapi/v1/verifier/controller.go +++ b/pkg/restapi/v1/verifier/controller.go @@ -216,6 +216,20 @@ func (c *Controller) PostVerifyCredentials(e echo.Context, profileID, profileVer return err } + hasErrors := false + if resp.Checks != nil { + for _, check := range *resp.Checks { + if check.Error != "" { + hasErrors = true + break + } + } + } + + if hasErrors { + return util.WriteOutputWithCode(http.StatusBadRequest, e)(resp, nil) + } + return util.WriteOutput(e)(resp, nil) } @@ -230,6 +244,11 @@ func (c *Controller) verifyCredential( body.VerifiableCredential = body.Credential } + if body.VerifiableCredential == nil { + return nil, resterr.NewValidationError(resterr.InvalidValue, "credential", + errors.New("missing credential")) + } + profile, err := c.accessProfile(profileID, profileVersion, tenantID) if err != nil { return nil, err @@ -237,7 +256,7 @@ func (c *Controller) verifyCredential( credential, err := vc.ValidateCredential( ctx, - body.VerifiableCredential, + *body.VerifiableCredential, profile.Checks.Credential.Format, profile.Checks.Credential.CredentialExpiry, profile.Checks.Credential.Strict, @@ -313,6 +332,7 @@ func (c *Controller) verifyPresentation( verifiable.WithPresProofChecker(c.proofChecker), verifiable.WithPresJSONLDDocumentLoader(c.documentLoader), verifiable.WithPresDataIntegrityVerifier(dataVerifier), + verifiable.WithPresHolderCheck(true), } if body.Options != nil { diff --git a/pkg/restapi/v1/verifier/controller_test.go b/pkg/restapi/v1/verifier/controller_test.go index aab3cd0b6..0c8432c2b 100644 --- a/pkg/restapi/v1/verifier/controller_test.go +++ b/pkg/restapi/v1/verifier/controller_test.go @@ -177,6 +177,43 @@ func TestController_PostVerifyCredentials(t *testing.T) { }) } +func TestController_PostVerifyCredentialsErr(t *testing.T) { + t.Run("HasError", func(t *testing.T) { + mockProfileSvc := NewMockProfileService(gomock.NewController(t)) + mockVerifyCredentialSvc := NewMockVerifyCredentialService(gomock.NewController(t)) + + mockVerifyCredentialSvc.EXPECT(). + VerifyCredential(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). + AnyTimes(). + Return([]verifycredential.CredentialsVerificationCheckResult{ + { + Error: "error", + }, + }, nil) + + mockProfileSvc.EXPECT().GetProfile(profileID, profileVersion).AnyTimes(). + Return(&profileapi.Verifier{ + ID: profileID, + Version: profileVersion, + OrganizationID: "orgID1", + Checks: verificationChecks, + }, nil) + + controller := NewController(&Config{ + VerifyCredentialSvc: mockVerifyCredentialSvc, + ProfileSvc: mockProfileSvc, + DocumentLoader: testutil.DocumentLoader(t), + VDR: &vdrmock.VDRegistry{}, + Tracer: nooptracer.NewTracerProvider().Tracer(""), + }) + + c := createContextWithBody([]byte(sampleVCJsonLDReq)) + err := controller.PostVerifyCredentials(c, profileID, profileVersion) + assert.NoError(t, err) + assert.EqualValues(t, c.Response().Status, http.StatusBadRequest) + }) +} + func TestController_VerifyCredentials(t *testing.T) { mockProfileSvc := NewMockProfileService(gomock.NewController(t)) verificationResult := []verifycredential.CredentialsVerificationCheckResult{{}} @@ -215,6 +252,22 @@ func TestController_VerifyCredentials(t *testing.T) { assert.Equal(t, &VerifyCredentialResponse{Checks: &[]VerifyCredentialCheckResult{{}}}, rsp) }) + t.Run("Missing credential", func(t *testing.T) { + c := createContextWithBody([]byte(sampleVCJsonLDReq)) + + var body VerifyCredentialData + + err := util.ReadBody(c, &body) + assert.NoError(t, err) + + body.VerifiableCredential = nil + body.Credential = nil + + rsp, err := controller.verifyCredential(c.Request().Context(), &body, profileID, profileVersion, tenantID) + assert.ErrorContains(t, err, "missing credential") + assert.Nil(t, rsp) + }) + t.Run("Success JWT", func(t *testing.T) { c := createContextWithBody([]byte(sampleVCJWTReq)) @@ -426,6 +479,7 @@ func createVP( ) require.NoError(t, err) + vp.Holder = vp.Credentials()[0].Contents().Issuer.ID err = vp.Credentials()[0].AddLinkedDataProof(ldpContext, ldprocessor.WithDocumentLoader(testutil.DocumentLoader(t))) require.NoError(t, err) diff --git a/pkg/restapi/v1/verifier/openapi.gen.go b/pkg/restapi/v1/verifier/openapi.gen.go index e99a676be..372a58b84 100644 --- a/pkg/restapi/v1/verifier/openapi.gen.go +++ b/pkg/restapi/v1/verifier/openapi.gen.go @@ -70,7 +70,7 @@ type VerifyCredentialData struct { Options *VerifyCredentialOptions `json:"options,omitempty"` // Credential in jws(string) or jsonld(object) formats. - VerifiableCredential interface{} `json:"verifiableCredential"` + VerifiableCredential *interface{} `json:"verifiableCredential,omitempty"` } // Options for verify credential. diff --git a/pkg/service/verifycredential/verifycredential_service.go b/pkg/service/verifycredential/verifycredential_service.go index 8ace4d474..efd51f42b 100644 --- a/pkg/service/verifycredential/verifycredential_service.go +++ b/pkg/service/verifycredential/verifycredential_service.go @@ -92,7 +92,7 @@ func (s *Service) VerifyCredential(ctx context.Context, credential *verifiable.C opts.Challenge, opts.Domain, false, - !credential.IsJWT() && !credential.IsCWT()) + checks.Strict) if err != nil { result = append(result, CredentialsVerificationCheckResult{ Check: "proof", diff --git a/test/bdd/attestation/go.mod b/test/bdd/attestation/go.mod index b15256c6c..a0e31f469 100644 --- a/test/bdd/attestation/go.mod +++ b/test/bdd/attestation/go.mod @@ -14,7 +14,7 @@ require ( github.com/samber/lo v1.47.0 github.com/trustbloc/cmdutil-go v1.0.0 github.com/trustbloc/did-go v1.3.1-0.20241122115441-c010226da580 - github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 + github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b ) diff --git a/test/bdd/attestation/go.sum b/test/bdd/attestation/go.sum index 395b30ab1..cb9f4209b 100644 --- a/test/bdd/attestation/go.sum +++ b/test/bdd/attestation/go.sum @@ -238,8 +238,8 @@ github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 h1:k3KNf9tE4TBV github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e h1:r0AVM5ILWbtXLDLBKTL9u2F/EOZH/7JU/owOjfbESME= github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e/go.mod h1:AuHbwVcx1Rl6KNG2oFvlUR79egmDM8urblUaJ24p85A= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 h1:zkvZltnfUNDPEHeM2WTE6cFD0Qn9nsPdCKr9153JFEE= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 h1:+A9r9mKaofDng9dVPu4SV896o6as6Ux9M0PQkRW8EHQ= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= github.com/veraison/go-cose v1.1.1-0.20240126165338-2300d5c96dbd h1:QhdCHSW1/oosJbzBTEYLU6xcKxXbQzzqFnhCtW2UWbA= github.com/veraison/go-cose v1.1.1-0.20240126165338-2300d5c96dbd/go.mod h1:D1wnviyjdmcF8AO5Y9kVGU6OGuvXUMGiE0Auo/fYRYo= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= 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 d3cc1132c..e0f8e70ba 100644 --- a/test/bdd/features/vc_v1_issue_verify_revoke_api.feature +++ b/test/bdd/features/vc_v1_issue_verify_revoke_api.feature @@ -21,12 +21,12 @@ Feature: Using VC REST API And V1 revoked credential is unable to be verified under "" profile 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 | - | i_myprofile_ud_di_ecdsa-2019/v1.0 | v_myprofile_ldp/v1.0 | crude_product.json | - | i_myprofile_cmtr_p256_ldp_v2/v1.0 | v_myprofile_ldp/v1.0 | crude_product_vcdm2.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_no_strict/v1.0 | crude_product.json | + | i_myprofile_ud_di_ecdsa-2019/v1.0 | v_myprofile_ldp/v1.0 | crude_product.json | + | i_myprofile_cmtr_p256_ldp_v2/v1.0 | v_myprofile_ldp/v1.0 | crude_product_vcdm2.json | @e2e_ldp_jwt_sdjwt_revoke_err Scenario Outline: Unsuccessful attempt to revoke credential from wrong issuer (LDP, JWT, SD-JWT). @@ -41,10 +41,10 @@ Feature: Using VC REST API And V1 verifiable credential is verified under "" profile Examples: - | issuerProfile | wrongIssuerProfile | verifierProfile | credential | - | i_myprofile_ud_P256k1/v1.0 | i_myprofile_ud_es256_jwt/v1.0 | v_myprofile_ldp/v1.0 | certified_mill_test_report.json | - | i_myprofile_ud_es256k_jwt/v1.0 | i_myprofile_ud_es256_sdjwt/v1.0 | v_myprofile_jwt/v1.0 | permanent_resident_card.json | - | i_myprofile_ud_es256k_sdjwt/v1.0 | i_myprofile_ud_P256k1/v1.0 | v_myprofile_jwt/v1.0 | crude_product.json | + | issuerProfile | wrongIssuerProfile | verifierProfile | credential | + | i_myprofile_ud_P256k1/v1.0 | i_myprofile_ud_es256_jwt/v1.0 | v_myprofile_ldp/v1.0 | certified_mill_test_report.json | + | i_myprofile_ud_es256k_jwt/v1.0 | i_myprofile_ud_es256_sdjwt/v1.0 | v_myprofile_jwt/v1.0 | permanent_resident_card.json | + | i_myprofile_ud_es256k_sdjwt/v1.0 | i_myprofile_ud_P256k1/v1.0 | v_myprofile_jwt_no_strict/v1.0 | crude_product.json | @e2e_ldp_jwt_sdjwt_verify_format_err Scenario Outline: Credential verification failed due to unsupported credential format by verifier (LDP, JWT, SD-JWT). diff --git a/test/bdd/fixtures/krakend-config/settings/endpoint.json b/test/bdd/fixtures/krakend-config/settings/endpoint.json index e87dfa2c8..d65786d47 100644 --- a/test/bdd/fixtures/krakend-config/settings/endpoint.json +++ b/test/bdd/fixtures/krakend-config/settings/endpoint.json @@ -273,6 +273,202 @@ { "endpoint": "/version/system", "method": "GET" + }, + { + "endpoint": "/issuer/profiles/ecdsa-test-suite-issuer/v1.0/credentials/issue", + "method": "POST", + "protected": false, + "backend_extra_config": { + "modifier/martian": { + "fifo.Group" : { + "scope": [ + "request" + ], + "aggregateErrors": true, + "modifiers": [ + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-API-Key", + "value": "rw_token" + } + }, + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-Tenant-ID", + "value": "00000000-0000-0000-0000-000000000001" + } + } + ] + } + }, + "input_headers": [ + "X-Tenant-ID", + "Content-Type" + ] + } + }, + { + "endpoint": "/verifier/profiles/ecdsa-test-suite-verifier/v1.0/credentials/verify", + "method": "POST", + "protected": false, + "backend_extra_config": { + "modifier/martian": { + "fifo.Group" : { + "scope": [ + "request" + ], + "aggregateErrors": true, + "modifiers": [ + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-API-Key", + "value": "rw_token" + } + }, + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-Tenant-ID", + "value": "00000000-0000-0000-0000-000000000001" + } + } + ] + } + }, + "input_headers": [ + "X-Tenant-ID", + "Content-Type" + ] + } + }, + + { + "endpoint": "/issuer/profiles/vc-data-model-test-suite-issuer/v1.0/credentials/issue", + "method": "POST", + "protected": false, + "backend_extra_config": { + "modifier/martian": { + "fifo.Group" : { + "scope": [ + "request" + ], + "aggregateErrors": true, + "modifiers": [ + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-API-Key", + "value": "rw_token" + } + }, + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-Tenant-ID", + "value": "00000000-0000-0000-0000-000000000001" + } + } + ] + } + }, + "input_headers": [ + "X-Tenant-ID", + "Content-Type" + ] + } + }, + { + "endpoint": "/verifier/profiles/vc-data-model-test-suite-verifier/v1.0/credentials/verify", + "method": "POST", + "protected": false, + "backend_extra_config": { + "modifier/martian": { + "fifo.Group" : { + "scope": [ + "request" + ], + "aggregateErrors": true, + "modifiers": [ + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-API-Key", + "value": "rw_token" + } + }, + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-Tenant-ID", + "value": "00000000-0000-0000-0000-000000000001" + } + } + ] + } + }, + "input_headers": [ + "X-Tenant-ID", + "Content-Type" + ] + } + }, + { + "endpoint": "/verifier/profiles/vc-data-model-test-suite-verifier/v1.0/presentations/verify", + "method": "POST", + "protected": false, + "backend_extra_config": { + "modifier/martian": { + "fifo.Group" : { + "scope": [ + "request" + ], + "aggregateErrors": true, + "modifiers": [ + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-API-Key", + "value": "rw_token" + } + }, + { + "header.Modifier": { + "scope": [ + "request" + ], + "name": "X-Tenant-ID", + "value": "00000000-0000-0000-0000-000000000001" + } + } + ] + } + }, + "input_headers": [ + "X-Tenant-ID", + "Content-Type" + ] + } } ] } diff --git a/test/bdd/fixtures/profile/profiles.json b/test/bdd/fixtures/profile/profiles.json index f416d999a..70bd67e64 100644 --- a/test/bdd/fixtures/profile/profiles.json +++ b/test/bdd/fixtures/profile/profiles.json @@ -134,7 +134,8 @@ } }, "createDID": true - },{ + }, + { "issuer": { "id": "playground_issuer", "version": "v1.0", @@ -2275,9 +2276,9 @@ "vcConfig": { "model": "w3c-vc-2.0", "refreshServiceEnabled": false, - "signingAlgorithm": "Ed25519Signature2018", + "signingAlgorithm": "JsonWebSignature2020", "signatureRepresentation": 0, - "keyType": "ED25519", + "keyType": "ECDSAP256DER", "format": "ldp", "didMethod": "ion", "status": { @@ -3981,6 +3982,60 @@ } }, "createDID": true + }, + { + "issuer": { + "id": "ecdsa-test-suite-issuer", + "version": "v1.0", + "groupID": "ecdsa-test-suite-issuer", + "name": "ecdsa-test-suite-issuer", + "organizationID": "00000000-0000-0000-0000-000000000001", + "url": "http://vc-rest-echo.trustbloc.local:8075", + "webHook": "http://vcs.webhook.example.com:8180", + "active": true, + "vcConfig": { + "model": "w3c-vc-2.0", + "refreshServiceEnabled": false, + "signingAlgorithm": "ES384", + "signatureRepresentation": 0, + "keyType": "ECDSAP384DER", + "format": "ldp", + "didMethod": "key", + "status": { + "type": "StatusList2021Entry", + "disable": true + }, + "dataIntegrityProof": { + "enable": true, + "suiteType": "ecdsa-rdfc-2019" + } + }, + "oidcConfig": { + "client_id": "7d4u50e7w6nfq8tfayhzplgjf", + "client_secret_handle": "282ks4fkuqfosus5k0x30abnv", + "redirect_uri": "https://api-gateway.trustbloc.local:5566/oidc/redirect", + "issuer_well_known": "http://cognito-mock.trustbloc.local:9229/local_5a9GzRvB/.well-known/openid-configuration", + "scopes_supported": [ + "openid", + "profile" + ], + "grant_types_supported": [ + "authorization_code", + "urn:ietf:params:oauth:grant-type:pre-authorized_code" + ], + "response_types_supported": [ + "code" + ], + "token_endpoint_auth_methods_supported": [ + "none" + ], + "enable_dynamic_client_registration": true, + "wallet_initiated_auth_flow_supported": true, + "pre-authorized_grant_anonymous_access_supported": true, + "claims_endpoint": "https://mock-login-consent.example.com:8099/claim-data?credentialType=PermanentResidentCard" + } + }, + "createDID": true } ], "verifiers": [ @@ -5672,6 +5727,39 @@ ] }, "createDID": true + }, + { + "verifier": { + "id": "ecdsa-test-suite-verifier", + "version": "v1.0", + "name": "ecdsa-test-suite-verifier", + "organizationID": "00000000-0000-0000-0000-000000000001", + "url": "https://test-verifier.com", + "active": true, + "webHook": "http://vcs.webhook.example.com:8180", + "checks": { + "credential": { + "format": [ + "ldp" + ], + "proof": true, + "status": false + }, + "presentation": { + "format": [ + "ldp" + ], + "vcSubject": true, + "proof": true + } + }, + "oidcConfig": { + "roSigningAlgorithm": "EcdsaSecp256k1Signature2019", + "keyType": "ECDSASecp256k1DER", + "didMethod": "ion" + } + }, + "createDID": true } ] } diff --git a/test/bdd/go.mod b/test/bdd/go.mod index d04b71fd2..9aee7a00a 100644 --- a/test/bdd/go.mod +++ b/test/bdd/go.mod @@ -29,7 +29,7 @@ require ( github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 + github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 github.com/trustbloc/vcs v0.1.9-0.20230210204445-f2870a36f0ea github.com/trustbloc/vcs/component/wallet-cli v0.0.0-20240103173902-7fbe030659b2 github.com/trustbloc/vcs/test/stress v0.0.0-00010101000000-000000000000 diff --git a/test/bdd/go.sum b/test/bdd/go.sum index 04147e464..8fa3b97d1 100644 --- a/test/bdd/go.sum +++ b/test/bdd/go.sum @@ -790,8 +790,8 @@ github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e h1:r0AVM5IL github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e/go.mod h1:AuHbwVcx1Rl6KNG2oFvlUR79egmDM8urblUaJ24p85A= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 h1:zkvZltnfUNDPEHeM2WTE6cFD0Qn9nsPdCKr9153JFEE= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 h1:+A9r9mKaofDng9dVPu4SV896o6as6Ux9M0PQkRW8EHQ= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= diff --git a/test/bdd/pkg/v1/vc/credential.go b/test/bdd/pkg/v1/vc/credential.go index b7444ad1e..e3abca036 100644 --- a/test/bdd/pkg/v1/vc/credential.go +++ b/test/bdd/pkg/v1/vc/credential.go @@ -15,6 +15,7 @@ import ( "strings" "github.com/google/uuid" + "github.com/samber/lo" "github.com/trustbloc/vc-go/verifiable" @@ -159,7 +160,16 @@ func getIssueCredentialRequestData(vc *verifiable.Credential, desiredFormat vcsv func (e *Steps) verifyVC(profileVersionedID string) error { chunks := strings.Split(profileVersionedID, "/") profileID, profileVersion := chunks[0], chunks[1] - result, err := e.getVerificationResult(credentialServiceURL, profileID, profileVersion) + respBytes, err := e.getVerificationResult(credentialServiceURL, profileID, profileVersion, []int{ + http.StatusOK, + }) + if err != nil { + return err + } + + result := &model.VerifyCredentialResponse{} + + err = json.Unmarshal(respBytes, &result) if err != nil { return err } @@ -174,7 +184,16 @@ func (e *Steps) verifyVC(profileVersionedID string) error { func (e *Steps) verifyRevokedVC(profileVersionedID string) error { chunks := strings.Split(profileVersionedID, "/") profileID, profileVersion := chunks[0], chunks[1] - result, err := e.getVerificationResult(credentialServiceURL, profileID, profileVersion) + respBytes, err := e.getVerificationResult(credentialServiceURL, profileID, profileVersion, []int{ + http.StatusBadRequest, + }) + if err != nil { + return err + } + + result := &model.VerifyCredentialResponse{} + + err = json.Unmarshal(respBytes, &result) if err != nil { return err } @@ -197,16 +216,11 @@ func (e *Steps) verifyRevokedVC(profileVersionedID string) error { func (e *Steps) verifyVCWithExpectedError(verifierProfileVersionedID, errorMsg string) error { chunks := strings.Split(verifierProfileVersionedID, "/") profileID, profileVersion := chunks[0], chunks[1] - result, err := e.getVerificationResult(credentialServiceURL, profileID, profileVersion) - if result != nil { - return fmt.Errorf("verification result should be nil") - } + bytesResp, err := e.getVerificationResult(credentialServiceURL, profileID, profileVersion, []int{ + http.StatusBadRequest, + }) - if err == nil { - return fmt.Errorf("error expected, but got nil") - } - - if !strings.Contains(err.Error(), errorMsg) { + if !strings.Contains(string(bytesResp), errorMsg) { return fmt.Errorf("unexpected error %s should contain %s", err.Error(), errorMsg) } @@ -286,7 +300,8 @@ func (e *Steps) getVerificationResult( verifyCredentialURL, profileID, profileVersion string, -) (*model.VerifyCredentialResponse, error) { + expectedCodes []int, +) ([]byte, error) { loader, err := bddutil.DocumentLoader() if err != nil { return nil, err @@ -325,18 +340,11 @@ func (e *Steps) getVerificationResult( return nil, err } - if resp.StatusCode != http.StatusOK { - return nil, bddutil.ExpectedStatusCodeError(http.StatusOK, resp.StatusCode, respBytes) - } - - payload := &model.VerifyCredentialResponse{} - - err = json.Unmarshal(respBytes, &payload) - if err != nil { - return nil, err + if !lo.Contains(expectedCodes, resp.StatusCode) { + return nil, bddutil.ExpectedStatusCodeError(expectedCodes[0], resp.StatusCode, respBytes) } - return payload, nil + return respBytes, nil } func (e *Steps) checkVC(vcBytes []byte, profileVersionedID string, checkProof bool) error { diff --git a/test/bdd/pkg/v1/vc/stress_steps.go b/test/bdd/pkg/v1/vc/stress_steps.go index f248566ac..11af2ce41 100644 --- a/test/bdd/pkg/v1/vc/stress_steps.go +++ b/test/bdd/pkg/v1/vc/stress_steps.go @@ -6,8 +6,10 @@ SPDX-License-Identifier: Apache-2.0 package vc import ( + "encoding/json" "errors" "fmt" + "net/http" "os" "strconv" "strings" @@ -18,6 +20,7 @@ import ( "github.com/trustbloc/vcs/internal/logfields" "github.com/trustbloc/vcs/test/bdd/pkg/bddutil" + "github.com/trustbloc/vcs/test/bdd/pkg/v1/model" ) var logger = log.New("vc-steps") @@ -171,13 +174,22 @@ func (r *stressRequest) Invoke() (string, interface{}, error) { startTime = time.Now() - res, err := r.steps.getVerificationResult( - r.verifyUrl, r.verifyProfileName, r.issuerProfileVersion) + respBytes, err := r.steps.getVerificationResult( + r.verifyUrl, r.verifyProfileName, r.issuerProfileVersion, []int{ + http.StatusOK, + }) if err != nil { return credentialID, nil, err } - if res.Checks != nil { + payload := &model.VerifyCredentialResponse{} + + err = json.Unmarshal(respBytes, &payload) + if err != nil { + return "", nil, err + } + + if payload.Checks != nil { return credentialID, nil, fmt.Errorf("credential verification failed") } diff --git a/test/bdd/pkg/v1/vc/types.go b/test/bdd/pkg/v1/vc/types.go new file mode 100644 index 000000000..0e03198b0 --- /dev/null +++ b/test/bdd/pkg/v1/vc/types.go @@ -0,0 +1,13 @@ +/* +Copyright SecureKey Technologies Inc. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + +package vc + +type VerificationResult struct { + Code string `json:"code"` + Message string `json:"message"` + IncorrectValue string `json:"incorrect_value"` +} diff --git a/test/stress/go.mod b/test/stress/go.mod index 950f28c3f..d437abf14 100644 --- a/test/stress/go.mod +++ b/test/stress/go.mod @@ -21,7 +21,7 @@ require ( github.com/trustbloc/kms-go v1.1.3-0.20241001141623-8d9510c6bb88 github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 + github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 github.com/trustbloc/vcs v0.1.9-0.20230210204445-f2870a36f0ea github.com/trustbloc/vcs/component/wallet-cli v0.0.0-20240103173902-7fbe030659b2 github.com/trustbloc/vcs/test/bdd v0.0.0-00010101000000-000000000000 diff --git a/test/stress/go.sum b/test/stress/go.sum index 611376fb5..cdf60c6ed 100644 --- a/test/stress/go.sum +++ b/test/stress/go.sum @@ -642,8 +642,8 @@ github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e h1:r0AVM5IL github.com/trustbloc/logutil-go v1.0.1-0.20241105212510-19307a43016e/go.mod h1:AuHbwVcx1Rl6KNG2oFvlUR79egmDM8urblUaJ24p85A= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 h1:0IW4muaGvhjJ4OkG6/PQG3DGf5POWxlA1wwEYsxWQ+4= github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104/go.mod h1:3yChjB5KOT7B9eZe0W1XaIx3MNUuC1Oe9nR/GCtI1W0= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255 h1:zkvZltnfUNDPEHeM2WTE6cFD0Qn9nsPdCKr9153JFEE= -github.com/trustbloc/vc-go v1.2.1-0.20241122170326-cb8385b93255/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382 h1:+A9r9mKaofDng9dVPu4SV896o6as6Ux9M0PQkRW8EHQ= +github.com/trustbloc/vc-go v1.2.1-0.20241125142751-c33f1ff65382/go.mod h1:bBE54VGTHhLpFW4guWqxsnz2gmCDq1QkTeIRHc2olO4= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=