diff --git a/cmd/vc-rest/go.mod b/cmd/vc-rest/go.mod index 017c54e62..7a035ed70 100644 --- a/cmd/vc-rest/go.mod +++ b/cmd/vc-rest/go.mod @@ -22,10 +22,10 @@ require ( github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 github.com/trustbloc/cmdutil-go v1.0.0 - github.com/trustbloc/did-go v1.3.0 + github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 github.com/trustbloc/logutil-go v1.0.0 github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.0 + github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 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 490349111..c35b567e6 100644 --- a/cmd/vc-rest/go.sum +++ b/cmd/vc-rest/go.sum @@ -668,16 +668,16 @@ github.com/trustbloc/bbs-signature-go v1.0.2 h1:gepEsbLiZHv/vva9FKG5gF38mGtOIyGe github.com/trustbloc/bbs-signature-go v1.0.2/go.mod h1:xYotcXHAbcE0TO+SteW0J6XI3geQaXq4wdnXR2k+XCU= github.com/trustbloc/cmdutil-go v1.0.0 h1:QCe7wVEIASWmy9ZDD0l0tsQCEsX6fx+kBFX5UqCVRdk= github.com/trustbloc/cmdutil-go v1.0.0/go.mod h1:o/v7C1z6d/5UrjaC6GAUc1hk0XVuE3M4tpyvsMMUw5k= -github.com/trustbloc/did-go v1.3.0 h1:vfiY/dewd9cORo3U5c+eoWgNIQnKsuQYn5PV0CRu1o0= -github.com/trustbloc/did-go v1.3.0/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 h1:5GOoXZcKYDTsobaTCeFUEBjbognYbjBh38fCjkvClU4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= github.com/trustbloc/kms-go v1.1.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwys= github.com/trustbloc/kms-go v1.1.2/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYttMypcE= github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc= 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.0 h1:/2blMr1hnw4xwQSO7RwMQC3boVC9ADm39MS+NAAtGoA= -github.com/trustbloc/vc-go v1.2.0/go.mod h1:o14xyB2I5GgJlsrH+Doh6NbKDStGmJ1R5nnlEV781IE= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 h1:SUz/V2k+Urckdr8Dqg1OJLl0RqkkXW84a0qoopP/i2w= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo= 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 7dcbbaf2e..ff3198104 100644 --- a/component/credentialstatus/go.mod +++ b/component/credentialstatus/go.mod @@ -14,11 +14,11 @@ require ( github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - github.com/trustbloc/did-go v1.3.0 + github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 github.com/trustbloc/kms-go v1.1.2 github.com/trustbloc/logutil-go v1.0.0 github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.0 + github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 github.com/trustbloc/vcs v0.0.0-00010101000000-000000000000 ) diff --git a/component/credentialstatus/go.sum b/component/credentialstatus/go.sum index d9d08c03c..ef7e23eea 100644 --- a/component/credentialstatus/go.sum +++ b/component/credentialstatus/go.sum @@ -464,16 +464,16 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/trustbloc/bbs-signature-go v1.0.2 h1:gepEsbLiZHv/vva9FKG5gF38mGtOIyGez7desZxiI1o= github.com/trustbloc/bbs-signature-go v1.0.2/go.mod h1:xYotcXHAbcE0TO+SteW0J6XI3geQaXq4wdnXR2k+XCU= -github.com/trustbloc/did-go v1.3.0 h1:vfiY/dewd9cORo3U5c+eoWgNIQnKsuQYn5PV0CRu1o0= -github.com/trustbloc/did-go v1.3.0/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 h1:5GOoXZcKYDTsobaTCeFUEBjbognYbjBh38fCjkvClU4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= github.com/trustbloc/kms-go v1.1.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwys= github.com/trustbloc/kms-go v1.1.2/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYttMypcE= github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc= 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.0 h1:/2blMr1hnw4xwQSO7RwMQC3boVC9ADm39MS+NAAtGoA= -github.com/trustbloc/vc-go v1.2.0/go.mod h1:o14xyB2I5GgJlsrH+Doh6NbKDStGmJ1R5nnlEV781IE= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 h1:SUz/V2k+Urckdr8Dqg1OJLl0RqkkXW84a0qoopP/i2w= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo= 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 5b29085a2..fc2956512 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.0 - github.com/trustbloc/vc-go v1.2.0 + github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 github.com/trustbloc/vcs v0.0.0-00010101000000-000000000000 go.opentelemetry.io/otel/trace v1.29.0 ) @@ -116,7 +116,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/did-go v1.3.0 // indirect + github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 // indirect github.com/trustbloc/kms-go v1.1.2 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect diff --git a/component/event/go.sum b/component/event/go.sum index a48a22601..e3b09c2ce 100644 --- a/component/event/go.sum +++ b/component/event/go.sum @@ -448,14 +448,14 @@ github.com/trustbloc/bbs-signature-go v1.0.2 h1:gepEsbLiZHv/vva9FKG5gF38mGtOIyGe github.com/trustbloc/bbs-signature-go v1.0.2/go.mod h1:xYotcXHAbcE0TO+SteW0J6XI3geQaXq4wdnXR2k+XCU= github.com/trustbloc/cmdutil-go v1.0.0 h1:QCe7wVEIASWmy9ZDD0l0tsQCEsX6fx+kBFX5UqCVRdk= github.com/trustbloc/cmdutil-go v1.0.0/go.mod h1:o/v7C1z6d/5UrjaC6GAUc1hk0XVuE3M4tpyvsMMUw5k= -github.com/trustbloc/did-go v1.3.0 h1:vfiY/dewd9cORo3U5c+eoWgNIQnKsuQYn5PV0CRu1o0= -github.com/trustbloc/did-go v1.3.0/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 h1:5GOoXZcKYDTsobaTCeFUEBjbognYbjBh38fCjkvClU4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= github.com/trustbloc/kms-go v1.1.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwys= github.com/trustbloc/kms-go v1.1.2/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYttMypcE= github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc= -github.com/trustbloc/vc-go v1.2.0 h1:/2blMr1hnw4xwQSO7RwMQC3boVC9ADm39MS+NAAtGoA= -github.com/trustbloc/vc-go v1.2.0/go.mod h1:o14xyB2I5GgJlsrH+Doh6NbKDStGmJ1R5nnlEV781IE= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 h1:SUz/V2k+Urckdr8Dqg1OJLl0RqkkXW84a0qoopP/i2w= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo= 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 b110a4936..7fe4253c6 100644 --- a/component/profile/reader/file/go.mod +++ b/component/profile/reader/file/go.mod @@ -13,7 +13,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 github.com/trustbloc/cmdutil-go v1.0.0 - github.com/trustbloc/did-go v1.3.0 + github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 github.com/trustbloc/kms-go v1.1.2 github.com/trustbloc/logutil-go v1.0.0 github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 @@ -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.0 // indirect + github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 // 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 8c994a929..0435b09cd 100644 --- a/component/profile/reader/file/go.sum +++ b/component/profile/reader/file/go.sum @@ -468,16 +468,16 @@ github.com/trustbloc/bbs-signature-go v1.0.2 h1:gepEsbLiZHv/vva9FKG5gF38mGtOIyGe github.com/trustbloc/bbs-signature-go v1.0.2/go.mod h1:xYotcXHAbcE0TO+SteW0J6XI3geQaXq4wdnXR2k+XCU= github.com/trustbloc/cmdutil-go v1.0.0 h1:QCe7wVEIASWmy9ZDD0l0tsQCEsX6fx+kBFX5UqCVRdk= github.com/trustbloc/cmdutil-go v1.0.0/go.mod h1:o/v7C1z6d/5UrjaC6GAUc1hk0XVuE3M4tpyvsMMUw5k= -github.com/trustbloc/did-go v1.3.0 h1:vfiY/dewd9cORo3U5c+eoWgNIQnKsuQYn5PV0CRu1o0= -github.com/trustbloc/did-go v1.3.0/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 h1:5GOoXZcKYDTsobaTCeFUEBjbognYbjBh38fCjkvClU4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= github.com/trustbloc/kms-go v1.1.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwys= github.com/trustbloc/kms-go v1.1.2/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYttMypcE= github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc= 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.0 h1:/2blMr1hnw4xwQSO7RwMQC3boVC9ADm39MS+NAAtGoA= -github.com/trustbloc/vc-go v1.2.0/go.mod h1:o14xyB2I5GgJlsrH+Doh6NbKDStGmJ1R5nnlEV781IE= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 h1:SUz/V2k+Urckdr8Dqg1OJLl0RqkkXW84a0qoopP/i2w= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo= 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/wallet-cli/go.mod b/component/wallet-cli/go.mod index 1b2787522..b474d5648 100644 --- a/component/wallet-cli/go.mod +++ b/component/wallet-cli/go.mod @@ -24,11 +24,11 @@ require ( github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.0 - github.com/trustbloc/did-go v1.3.0 + github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 github.com/trustbloc/kms-go v1.1.2 github.com/trustbloc/logutil-go v1.0.0 github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.0 + github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 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 6521b23a4..884f4c1d3 100644 --- a/component/wallet-cli/go.sum +++ b/component/wallet-cli/go.sum @@ -616,16 +616,16 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/trustbloc/bbs-signature-go v1.0.2 h1:gepEsbLiZHv/vva9FKG5gF38mGtOIyGez7desZxiI1o= github.com/trustbloc/bbs-signature-go v1.0.2/go.mod h1:xYotcXHAbcE0TO+SteW0J6XI3geQaXq4wdnXR2k+XCU= -github.com/trustbloc/did-go v1.3.0 h1:vfiY/dewd9cORo3U5c+eoWgNIQnKsuQYn5PV0CRu1o0= -github.com/trustbloc/did-go v1.3.0/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 h1:5GOoXZcKYDTsobaTCeFUEBjbognYbjBh38fCjkvClU4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= github.com/trustbloc/kms-go v1.1.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwys= github.com/trustbloc/kms-go v1.1.2/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYttMypcE= github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc= 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.0 h1:/2blMr1hnw4xwQSO7RwMQC3boVC9ADm39MS+NAAtGoA= -github.com/trustbloc/vc-go v1.2.0/go.mod h1:o14xyB2I5GgJlsrH+Doh6NbKDStGmJ1R5nnlEV781IE= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 h1:SUz/V2k+Urckdr8Dqg1OJLl0RqkkXW84a0qoopP/i2w= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo= 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/go.mod b/go.mod index 6d8fc660f..561561d27 100644 --- a/go.mod +++ b/go.mod @@ -42,10 +42,10 @@ require ( github.com/tidwall/gjson v1.17.3 github.com/tidwall/sjson v1.2.5 github.com/trustbloc/bbs-signature-go v1.0.2 - github.com/trustbloc/did-go v1.3.0 + github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 github.com/trustbloc/kms-go v1.1.2 - github.com/trustbloc/logutil-go v1.0.0 - github.com/trustbloc/vc-go v1.2.0 + github.com/trustbloc/logutil-go v1.0.0-rc1 + github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 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 216177a38..59e1f207a 100644 --- a/go.sum +++ b/go.sum @@ -631,14 +631,14 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/trustbloc/bbs-signature-go v1.0.2 h1:gepEsbLiZHv/vva9FKG5gF38mGtOIyGez7desZxiI1o= github.com/trustbloc/bbs-signature-go v1.0.2/go.mod h1:xYotcXHAbcE0TO+SteW0J6XI3geQaXq4wdnXR2k+XCU= -github.com/trustbloc/did-go v1.3.0 h1:vfiY/dewd9cORo3U5c+eoWgNIQnKsuQYn5PV0CRu1o0= -github.com/trustbloc/did-go v1.3.0/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 h1:5GOoXZcKYDTsobaTCeFUEBjbognYbjBh38fCjkvClU4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= github.com/trustbloc/kms-go v1.1.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwys= github.com/trustbloc/kms-go v1.1.2/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= -github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYttMypcE= -github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc= -github.com/trustbloc/vc-go v1.2.0 h1:/2blMr1hnw4xwQSO7RwMQC3boVC9ADm39MS+NAAtGoA= -github.com/trustbloc/vc-go v1.2.0/go.mod h1:o14xyB2I5GgJlsrH+Doh6NbKDStGmJ1R5nnlEV781IE= +github.com/trustbloc/logutil-go v1.0.0-rc1 h1:rRJbvgQfrlUfyej+mY0nuQJymGqjRW4oZEwKi544F4c= +github.com/trustbloc/logutil-go v1.0.0-rc1/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 h1:SUz/V2k+Urckdr8Dqg1OJLl0RqkkXW84a0qoopP/i2w= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo= 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/internal/logfields/fields.go b/internal/logfields/fields.go index 183c01082..8f22f8295 100644 --- a/internal/logfields/fields.go +++ b/internal/logfields/fields.go @@ -39,6 +39,9 @@ const ( FieldCredentialTemplateID = "credentialTemplateID" //nolint:gosec FieldJSONSchemaID = "jsonSchemaID" FieldJSONSchema = "jsonSchema" + FieldContext = "context" + FieldIssuerID = "issuerID" + FieldStatusListIssuerID = "statusListIssuerID" ) // WithAdditionalMessage sets the AdditionalMessage field. @@ -176,3 +179,18 @@ func WithJSONSchemaID(value string) zap.Field { func WithJSONSchema(value string) zap.Field { return zap.String(FieldJSONSchema, value) } + +// WithContext sets the context field. +func WithContext(ctx []string) zap.Field { + return zap.Strings(FieldContext, ctx) +} + +// WithIssuerID sets the issuerID field. +func WithIssuerID(value string) zap.Field { + return zap.String(FieldIssuerID, value) +} + +// WithStatusListIssuerID sets the statusListIssuerID field. +func WithStatusListIssuerID(value string) zap.Field { + return zap.String(FieldStatusListIssuerID, value) +} diff --git a/internal/logfields/fields_test.go b/internal/logfields/fields_test.go index c87054878..6cbe2a455 100644 --- a/internal/logfields/fields_test.go +++ b/internal/logfields/fields_test.go @@ -52,6 +52,8 @@ func TestStandardFields(t *testing.T) { credentialTemplateID := "someCredentialTemplateID" jsonSchemaID := "someSchemaID" jsonSchema := "someSchema" + issuer1 := "issuer_1" + issuer2 := "issuer_2" logger.Info( "Some message", @@ -77,6 +79,8 @@ func TestStandardFields(t *testing.T) { WithCredentialTemplateID(credentialTemplateID), WithJSONSchemaID(jsonSchemaID), WithJSONSchema(jsonSchema), + WithIssuerID(issuer1), + WithStatusListIssuerID(issuer2), ) l := unmarshalLogData(t, stdOut.Bytes()) @@ -102,6 +106,8 @@ func TestStandardFields(t *testing.T) { require.Equal(t, credentialTemplateID, l.CredentialTemplateID) require.Equal(t, jsonSchemaID, l.JSONSchemaID) require.Equal(t, jsonSchema, l.JSONSchema) + require.Equal(t, issuer1, l.Issuer) + require.Equal(t, issuer2, l.StatusListIssuerID) }) } @@ -140,6 +146,8 @@ type logData struct { CredentialTemplateID string `json:"credentialTemplateID"` JSONSchemaID string `json:"JSONSchemaID"` JSONSchema string `json:"JSONSchema"` + Issuer string `json:"issuerID"` + StatusListIssuerID string `json:"statusListIssuerID"` } func unmarshalLogData(t *testing.T, b []byte) *logData { diff --git a/pkg/doc/vc/crypto/crypto_test.go b/pkg/doc/vc/crypto/crypto_test.go index 103c14a42..4d11f0e0f 100644 --- a/pkg/doc/vc/crypto/crypto_test.go +++ b/pkg/doc/vc/crypto/crypto_test.go @@ -289,7 +289,7 @@ func TestCrypto_SignCredentialLDP(t *testing.T) { //nolint:gocognit func TestCrypto_SignCredentialJWT(t *testing.T) { unsignedVc, err := verifiable.CreateCredential(verifiable.CredentialContents{ ID: "http://example.edu/credentials/1872", - Context: []string{verifiable.ContextURI}, + Context: []string{verifiable.V1ContextURI}, Types: []string{verifiable.VCType}, Subject: []verifiable.Subject{{ ID: "did:example:ebfeb1f712ebc6f1c276e12ec21", @@ -317,7 +317,7 @@ func TestCrypto_SignCredentialJWT(t *testing.T) { unsignedVcNoSub, err := verifiable.CreateCredential(verifiable.CredentialContents{ ID: "http://example.edu/credentials/1872", - Context: []string{verifiable.ContextURI}, + Context: []string{verifiable.V1ContextURI}, Types: []string{verifiable.VCType}, Issued: &utiltime.TimeWrapper{ Time: time.Now(), @@ -692,7 +692,7 @@ func TestSignCredential(t *testing.T) { unsignedVC := createVCWithCF(t, verifiable.CredentialContents{ ID: "http://example.edu/credentials/1872", - Context: []string{verifiable.ContextURI}, + Context: []string{verifiable.V1ContextURI}, Types: []string{verifiable.VCType}, Subject: []verifiable.Subject{{ ID: "did:example:ebfeb1f712ebc6f1c276e12ec21", diff --git a/pkg/doc/vc/crypto/dataIntegrity_test.go b/pkg/doc/vc/crypto/dataIntegrity_test.go index 13dfcd3fe..def255e27 100644 --- a/pkg/doc/vc/crypto/dataIntegrity_test.go +++ b/pkg/doc/vc/crypto/dataIntegrity_test.go @@ -1,3 +1,9 @@ +/* +Copyright Gen Digital Inc. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + package crypto import ( @@ -47,7 +53,7 @@ func TestCrypto_SignCredentialLDPDataIntegrity(t *testing.T) { //nolint:gocognit unsignedVc, err := verifiable.CreateCredential(verifiable.CredentialContents{ ID: "http://example.edu/credentials/1872", - Context: []string{verifiable.ContextURI}, + Context: []string{verifiable.V1ContextURI}, Types: []string{verifiable.VCType}, Subject: []verifiable.Subject{{ ID: "did:example:ebfeb1f712ebc6f1c276e12ec21", diff --git a/pkg/internal/testutil/contexts/citizenship-v2.jsonld b/pkg/internal/testutil/contexts/citizenship-v2.jsonld new file mode 100644 index 000000000..1eae7290c --- /dev/null +++ b/pkg/internal/testutil/contexts/citizenship-v2.jsonld @@ -0,0 +1,50 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + + "identifier": "http://schema.org/identifier", + "image": {"@id": "http://schema.org/image", "@type": "@id"}, + + "PermanentResidentCard": { + "@id": "https://w3id.org/citizenship#PermanentResidentCard", + "@context": { + "@version": 1.1, + "@protected": true, + + "id": "@id", + "type": "@type", + + "identifier": "http://schema.org/identifier", + "image": {"@id": "http://schema.org/image", "@type": "@id"} + } + }, + + "PermanentResident": { + "@id": "https://w3id.org/citizenship#PermanentResident", + "@context": { + "@version": 1.1, + "@protected": true, + + "id": "@id", + "type": "@type", + + "ctzn": "https://w3id.org/citizenship#", + "schema": "http://schema.org/", + "xsd": "http://www.w3.org/2001/XMLSchema#", + + "birthCountry": "ctzn:birthCountry", + "birthDate": {"@id": "schema:birthDate", "@type": "xsd:dateTime"}, + "commuterClassification": "ctzn:commuterClassification", + "familyName": "schema:familyName", + "gender": "schema:gender", + "givenName": "schema:givenName", + "lprCategory": "ctzn:lprCategory", + "lprNumber": "ctzn:lprNumber", + "residentSince": {"@id": "ctzn:residentSince", "@type": "xsd:dateTime"} + } + }, + + "Person": "http://schema.org/Person" + } +} \ No newline at end of file diff --git a/pkg/internal/testutil/contexts/credentials-examples_v2.jsonld b/pkg/internal/testutil/contexts/credentials-examples_v2.jsonld new file mode 100644 index 000000000..f9b42be26 --- /dev/null +++ b/pkg/internal/testutil/contexts/credentials-examples_v2.jsonld @@ -0,0 +1,5 @@ +{ + "@context": { + "@vocab": "https://www.w3.org/ns/credentials/examples#" + } +} \ No newline at end of file diff --git a/pkg/internal/testutil/document_loader.go b/pkg/internal/testutil/document_loader.go index 65b93ceb2..6af664431 100644 --- a/pkg/internal/testutil/document_loader.go +++ b/pkg/internal/testutil/document_loader.go @@ -35,6 +35,8 @@ var ( vcDataIntegrity []byte //go:embed contexts/wallet_attestation_vc_v1.jsonld walletAttestationVC []byte + //go:embed contexts/citizenship-v2.jsonld + citizenshipV2 []byte ) type mockLDStoreProvider struct { @@ -93,6 +95,14 @@ func DocumentLoader(t *testing.T, extraContexts ...ldcontext.Document) *ld.Docum URL: "https://www.w3.org/2022/credentials/walletAttestation/v1", Content: walletAttestationVC, }, + { + URL: "https://www.w3.org/ns/credentials/examples/v2", + Content: credentialExamples, + }, + { + URL: "https://w3id.org/citizenship/v2", + Content: citizenshipV2, + }, } loader, err := ld.NewDocumentLoader(ldStore, diff --git a/pkg/kms/aws/service_mocks.go b/pkg/kms/aws/service_mocks.go index bf804e464..3973e662b 100644 --- a/pkg/kms/aws/service_mocks.go +++ b/pkg/kms/aws/service_mocks.go @@ -357,4 +357,4 @@ func (m *MockmetricsProvider) VerifyTime(value time.Duration) { func (mr *MockmetricsProviderMockRecorder) VerifyTime(value interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyTime", reflect.TypeOf((*MockmetricsProvider)(nil).VerifyTime), value) -} \ No newline at end of file +} diff --git a/pkg/kms/mocks/kms_mocks.go b/pkg/kms/mocks/kms_mocks.go index 455d902b3..8ca0def08 100644 --- a/pkg/kms/mocks/kms_mocks.go +++ b/pkg/kms/mocks/kms_mocks.go @@ -48,33 +48,9 @@ func (m *MockVCSKeyManager) CreateCryptoKey(keyType kms.KeyType) (string, interf } // CreateCryptoKey indicates an expected call of CreateCryptoKey. -func (mr *MockVCSKeyManagerMockRecorder) CreateCryptoKey(keyType interface{}) *VCSKeyManagerCreateCryptoKeyCall { +func (mr *MockVCSKeyManagerMockRecorder) CreateCryptoKey(keyType interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCryptoKey", reflect.TypeOf((*MockVCSKeyManager)(nil).CreateCryptoKey), keyType) - return &VCSKeyManagerCreateCryptoKeyCall{Call: call} -} - -// VCSKeyManagerCreateCryptoKeyCall wrap *gomock.Call -type VCSKeyManagerCreateCryptoKeyCall struct { - *gomock.Call -} - -// Return rewrite *gomock.Call.Return -func (c *VCSKeyManagerCreateCryptoKeyCall) Return(arg0 string, arg1 interface{}, arg2 error) *VCSKeyManagerCreateCryptoKeyCall { - c.Call = c.Call.Return(arg0, arg1, arg2) - return c -} - -// Do rewrite *gomock.Call.Do -func (c *VCSKeyManagerCreateCryptoKeyCall) Do(f func(kms.KeyType) (string, interface{}, error)) *VCSKeyManagerCreateCryptoKeyCall { - c.Call = c.Call.Do(f) - return c -} - -// DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *VCSKeyManagerCreateCryptoKeyCall) DoAndReturn(f func(kms.KeyType) (string, interface{}, error)) *VCSKeyManagerCreateCryptoKeyCall { - c.Call = c.Call.DoAndReturn(f) - return c + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCryptoKey", reflect.TypeOf((*MockVCSKeyManager)(nil).CreateCryptoKey), keyType) } // CreateJWKKey mocks base method. @@ -88,33 +64,9 @@ func (m *MockVCSKeyManager) CreateJWKKey(keyType kms.KeyType) (string, *jwk.JWK, } // CreateJWKKey indicates an expected call of CreateJWKKey. -func (mr *MockVCSKeyManagerMockRecorder) CreateJWKKey(keyType interface{}) *VCSKeyManagerCreateJWKKeyCall { +func (mr *MockVCSKeyManagerMockRecorder) CreateJWKKey(keyType interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateJWKKey", reflect.TypeOf((*MockVCSKeyManager)(nil).CreateJWKKey), keyType) - return &VCSKeyManagerCreateJWKKeyCall{Call: call} -} - -// VCSKeyManagerCreateJWKKeyCall wrap *gomock.Call -type VCSKeyManagerCreateJWKKeyCall struct { - *gomock.Call -} - -// Return rewrite *gomock.Call.Return -func (c *VCSKeyManagerCreateJWKKeyCall) Return(arg0 string, arg1 *jwk.JWK, arg2 error) *VCSKeyManagerCreateJWKKeyCall { - c.Call = c.Call.Return(arg0, arg1, arg2) - return c -} - -// Do rewrite *gomock.Call.Do -func (c *VCSKeyManagerCreateJWKKeyCall) Do(f func(kms.KeyType) (string, *jwk.JWK, error)) *VCSKeyManagerCreateJWKKeyCall { - c.Call = c.Call.Do(f) - return c -} - -// DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *VCSKeyManagerCreateJWKKeyCall) DoAndReturn(f func(kms.KeyType) (string, *jwk.JWK, error)) *VCSKeyManagerCreateJWKKeyCall { - c.Call = c.Call.DoAndReturn(f) - return c + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateJWKKey", reflect.TypeOf((*MockVCSKeyManager)(nil).CreateJWKKey), keyType) } // NewVCSigner mocks base method. @@ -127,33 +79,9 @@ func (m *MockVCSKeyManager) NewVCSigner(creator string, signatureType verifiable } // NewVCSigner indicates an expected call of NewVCSigner. -func (mr *MockVCSKeyManagerMockRecorder) NewVCSigner(creator, signatureType interface{}) *VCSKeyManagerNewVCSignerCall { +func (mr *MockVCSKeyManagerMockRecorder) NewVCSigner(creator, signatureType interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewVCSigner", reflect.TypeOf((*MockVCSKeyManager)(nil).NewVCSigner), creator, signatureType) - return &VCSKeyManagerNewVCSignerCall{Call: call} -} - -// VCSKeyManagerNewVCSignerCall wrap *gomock.Call -type VCSKeyManagerNewVCSignerCall struct { - *gomock.Call -} - -// Return rewrite *gomock.Call.Return -func (c *VCSKeyManagerNewVCSignerCall) Return(arg0 vc.SignerAlgorithm, arg1 error) *VCSKeyManagerNewVCSignerCall { - c.Call = c.Call.Return(arg0, arg1) - return c -} - -// Do rewrite *gomock.Call.Do -func (c *VCSKeyManagerNewVCSignerCall) Do(f func(string, verifiable.SignatureType) (vc.SignerAlgorithm, error)) *VCSKeyManagerNewVCSignerCall { - c.Call = c.Call.Do(f) - return c -} - -// DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *VCSKeyManagerNewVCSignerCall) DoAndReturn(f func(string, verifiable.SignatureType) (vc.SignerAlgorithm, error)) *VCSKeyManagerNewVCSignerCall { - c.Call = c.Call.DoAndReturn(f) - return c + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewVCSigner", reflect.TypeOf((*MockVCSKeyManager)(nil).NewVCSigner), creator, signatureType) } // SupportedKeyTypes mocks base method. @@ -165,31 +93,7 @@ func (m *MockVCSKeyManager) SupportedKeyTypes() []kms.KeyType { } // SupportedKeyTypes indicates an expected call of SupportedKeyTypes. -func (mr *MockVCSKeyManagerMockRecorder) SupportedKeyTypes() *VCSKeyManagerSupportedKeyTypesCall { +func (mr *MockVCSKeyManagerMockRecorder) SupportedKeyTypes() *gomock.Call { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SupportedKeyTypes", reflect.TypeOf((*MockVCSKeyManager)(nil).SupportedKeyTypes)) - return &VCSKeyManagerSupportedKeyTypesCall{Call: call} -} - -// VCSKeyManagerSupportedKeyTypesCall wrap *gomock.Call -type VCSKeyManagerSupportedKeyTypesCall struct { - *gomock.Call -} - -// Return rewrite *gomock.Call.Return -func (c *VCSKeyManagerSupportedKeyTypesCall) Return(arg0 []kms.KeyType) *VCSKeyManagerSupportedKeyTypesCall { - c.Call = c.Call.Return(arg0) - return c -} - -// Do rewrite *gomock.Call.Do -func (c *VCSKeyManagerSupportedKeyTypesCall) Do(f func() []kms.KeyType) *VCSKeyManagerSupportedKeyTypesCall { - c.Call = c.Call.Do(f) - return c -} - -// DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *VCSKeyManagerSupportedKeyTypesCall) DoAndReturn(f func() []kms.KeyType) *VCSKeyManagerSupportedKeyTypesCall { - c.Call = c.Call.DoAndReturn(f) - return c + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SupportedKeyTypes", reflect.TypeOf((*MockVCSKeyManager)(nil).SupportedKeyTypes)) } diff --git a/pkg/restapi/v1/issuer/controller.go b/pkg/restapi/v1/issuer/controller.go index 0f3e8aad4..e0cc82fef 100644 --- a/pkg/restapi/v1/issuer/controller.go +++ b/pkg/restapi/v1/issuer/controller.go @@ -334,7 +334,6 @@ func (c *Controller) parseCredential( enforceStrictValidation bool, issuerProfileVCFormat vcsverifiable.Format, ) (*verifiable.Credential, error) { - vcSchema := verifiable.JSONSchemaLoader(verifiable.WithDisableRequiredField("issuanceDate")) credential, err := vc.ValidateCredential( ctx, cred, @@ -343,7 +342,13 @@ func (c *Controller) parseCredential( enforceStrictValidation, c.documentLoader, verifiable.WithDisabledProofCheck(), - verifiable.WithSchema(vcSchema), + verifiable.WithDefaultSchemaLoader(func(vcc *verifiable.CredentialContents) string { + if verifiable.IsBaseContext(vcc.Context, verifiable.V2ContextURI) { + return verifiable.JSONSchemaLoaderV2() + } + + return verifiable.JSONSchemaLoaderV1(verifiable.WithDisableRequiredField("issuanceDate")) + }), verifiable.WithJSONLDDocumentLoader(c.documentLoader)) if err != nil { return nil, resterr.NewValidationError(resterr.InvalidValue, "credential", err) @@ -719,7 +724,7 @@ func (c *Controller) prepareClaimDataAuthorizationRequest( func (c *Controller) accessProfile(profileID, profileVersion string) (*profileapi.Issuer, error) { profile, err := c.profileSvc.GetProfile(profileID, profileVersion) if err != nil { - if strings.Contains(err.Error(), "not found") { + if errors.Is(err, resterr.ErrProfileNotFound) { return nil, resterr.NewCustomError(resterr.ProfileNotFound, fmt.Errorf("profile with given id %s_%s, doesn't exist", profileID, profileVersion)) } @@ -728,6 +733,9 @@ func (c *Controller) accessProfile(profileID, profileVersion string) (*profileap } if profile == nil { + logger.Debug("Received null profile from profile service", log.WithError(err), + logfields.WithProfileID(profileID), logfields.WithProfileVersion(profileVersion)) + return nil, resterr.NewCustomError(resterr.ProfileNotFound, fmt.Errorf("profile with given id %s_%s, doesn't exist", profileID, profileVersion)) } @@ -743,6 +751,9 @@ func (c *Controller) accessOIDCProfile(profileID, profileVersion, tenantID strin // Profiles of other organization is not visible. if profile.OrganizationID != tenantID { + logger.Debug("Profile's owning org does not match the current tenant ID", + logfields.WithProfileID(profileID), logfields.WithProfileVersion(profileVersion)) + return nil, resterr.NewCustomError(resterr.ProfileNotFound, fmt.Errorf("profile with given id %s_%s, doesn't exist", profileID, profileVersion)) } @@ -961,6 +972,7 @@ func (c *Controller) issueSingleCredential( index int, ) (*PrepareCredentialResult, error) { if err := c.validateClaims( + ctx, credentialData.Credential, credentialData.CredentialTemplate, credentialData.EnforceStrictValidation, @@ -1111,25 +1123,33 @@ func (c *Controller) parseTime(t *utiltime.TimeWrapper) *string { } func (c *Controller) validateClaims( //nolint:gocognit + ctx context.Context, cred *verifiable.Credential, credentialTemplate *profileapi.CredentialTemplate, validateJSONLD bool, ) error { subjects, err := getCredentialSubjects(cred.Contents().Subject) if err != nil { - return err + return fmt.Errorf("get credential subjects: %w", err) } for _, sub := range subjects { if validateJSONLD { if err := c.validateJSONLD(cred, sub); err != nil { - return err + logger.Infoc(ctx, "Credential failed validation against JSONLD schema", log.WithError(err), + logfields.WithCredentialID(cred.Contents().ID), logfields.WithContext(cred.Contents().Context)) + + return fmt.Errorf("validate JSONLD: %w", err) } } if credentialTemplate != nil && credentialTemplate.JSONSchemaID != "" { if err := c.validateJSONSchema(cred, credentialTemplate, sub); err != nil { - return err + logger.Infoc(ctx, "Credential failed validation against JSON schema", log.WithError(err), + logfields.WithCredentialID(cred.Contents().ID), + logfields.WithJSONSchemaID(credentialTemplate.JSONSchemaID)) + + return fmt.Errorf("validate JSON schema: %w", err) } } } diff --git a/pkg/restapi/v1/issuer/controller_test.go b/pkg/restapi/v1/issuer/controller_test.go index 8ccd3117d..19d162a64 100644 --- a/pkg/restapi/v1/issuer/controller_test.go +++ b/pkg/restapi/v1/issuer/controller_test.go @@ -52,6 +52,8 @@ const ( var ( //go:embed testdata/sample_vc.jsonld sampleVCJsonLD string + //go:embed testdata/sample_vc_v2.jsonld + sampleVCJsonLDV2 []byte //go:embed testdata/sample_vc.jwt sampleVCJWT string //go:embed testdata/sample_vc_university_degree.jsonld @@ -60,6 +62,8 @@ var ( sampleVCInvalidUniversityDegree []byte //go:embed testdata/universitydegree.schema.json universityDegreeSchema []byte + //go:embed testdata/sample_invalid_vc_v2.jsonld + sampleInvalidVCJsonLDV2 []byte ) func TestController_PostIssueCredentials(t *testing.T) { @@ -427,6 +431,36 @@ func TestController_IssueCredentials(t *testing.T) { require.NoError(t, err) }) + t.Run("Success JSON-LD V2.0", func(t *testing.T) { + mockProfileSvc.EXPECT().GetProfile(profileID, profileVersion).Times(1). + Return(&profileapi.Issuer{ + OrganizationID: orgID, + ID: "testId", + VCConfig: &profileapi.VCConfig{ + Format: vcsverifiable.Ldp, + }, + }, nil) + + controller := NewController(&Config{ + ProfileSvc: mockProfileSvc, + DocumentLoader: testutil.DocumentLoader(t), + IssueCredentialService: mockIssueCredentialSvc, + Tracer: nooptracer.NewTracerProvider().Tracer(""), + }) + + c := echoContext(withRequestBody(sampleVCJsonLDV2)) + + var body IssueCredentialData + + err := util.ReadBody(c, &body) + require.NoError(t, err) + + verifiableCredentials, err := controller.issueCredential( + c.Request().Context(), orgID, &body, profileID, profileVersion) + require.NoError(t, err) + require.NotNil(t, verifiableCredentials) + }) + t.Run("Success JWT", func(t *testing.T) { mockProfileSvc.EXPECT().GetProfile(profileID, profileVersion).Times(1). Return(&profileapi.Issuer{ @@ -1066,7 +1100,7 @@ func TestController_InitiateCredentialIssuance(t *testing.T) { { name: "Profile does not exist in the underlying storage", setup: func() { - mockProfileSvc.EXPECT().GetProfile(profileID, profileVersion).Times(1).Return(nil, errors.New("not found")) + mockProfileSvc.EXPECT().GetProfile(profileID, profileVersion).Times(1).Return(nil, resterr.ErrProfileNotFound) mockOIDC4CISvc.EXPECT().InitiateIssuance(gomock.Any(), gomock.Any(), gomock.Any()).Times(0) mockEventSvc.EXPECT().Publish(gomock.Any(), spi.IssuerEventTopic, gomock.Any()).Times(1) c = echoContext(withRequestBody(req)) @@ -2153,7 +2187,7 @@ func TestController_PrepareCredential(t *testing.T) { assert.ErrorContains(t, c.PrepareCredential(ctx), "rand-code: rand") }) - t.Run("claims schema validation error", func(t *testing.T) { + t.Run("claims JSON schema validation error", func(t *testing.T) { invalidVC, err := verifiable.ParseCredential( sampleVCInvalidUniversityDegree, verifiable.WithDisabledProofCheck(), @@ -2220,7 +2254,71 @@ func TestController_PrepareCredential(t *testing.T) { ctx := echoContext(withRequestBody([]byte(req))) err = c.PrepareCredential(ctx) - assert.EqualError(t, err, "invalid-claims: validation error") + assert.EqualError(t, err, "invalid-claims: validate JSON schema: validation error") + }) + + t.Run("claims JSONLD schema validation error", func(t *testing.T) { + invalidVC, err := verifiable.ParseCredential( + sampleInvalidVCJsonLDV2, + verifiable.WithDisabledProofCheck(), + verifiable.WithJSONLDDocumentLoader(testutil.DocumentLoader(t)), + ) + require.NoError(t, err) + + mockProfileSvc := NewMockProfileService(gomock.NewController(t)) + mockProfileSvc.EXPECT().GetProfile(profileID, profileVersion).Times(1).Return( + &profileapi.Issuer{ + OrganizationID: orgID, + ID: profileID, + VCConfig: &profileapi.VCConfig{ + Format: vcsverifiable.Ldp, + }, + }, nil) + + mockIssueCredentialSvc := NewMockIssueCredentialService(gomock.NewController(t)) + mockOIDC4CIService := NewMockOIDC4CIService(gomock.NewController(t)) + mockOIDC4CIService.EXPECT().PrepareCredential(gomock.Any(), gomock.Any()).DoAndReturn( + func( + ctx context.Context, + req *oidc4ci.PrepareCredential, + ) (*oidc4ci.PrepareCredentialResult, error) { + assert.Equal(t, issuecredential.TxID("123"), req.TxID) + + return &oidc4ci.PrepareCredentialResult{ + ProfileID: profileID, + ProfileVersion: profileVersion, + Credentials: []*oidc4ci.PrepareCredentialResultData{ + { + Credential: invalidVC, + Format: vcsverifiable.Ldp, + OidcFormat: "", + CredentialTemplate: &profileapi.CredentialTemplate{ + Checks: profileapi.CredentialTemplateChecks{ + Strict: true, + }, + }, + Retry: false, + EnforceStrictValidation: true, + NotificationID: nil, + }, + }, + }, nil + }, + ) + + c := NewController(&Config{ + ProfileSvc: mockProfileSvc, + IssueCredentialService: mockIssueCredentialSvc, + OIDC4CIService: mockOIDC4CIService, + DocumentLoader: testutil.DocumentLoader(t), + JSONSchemaValidator: NewMockJSONSchemaValidator(gomock.NewController(t)), + }) + + req := `{"tx_id":"123","types":["UniversityDegreeCredential"],"format":"ldp_vc"}` + ctx := echoContext(withRequestBody([]byte(req))) + + err = c.PrepareCredential(ctx) + require.ErrorContains(t, err, "invalid-claims: validate JSONLD") }) t.Run("credential response encryption is required error", func(t *testing.T) { diff --git a/pkg/restapi/v1/issuer/testdata/sample_invalid_vc_v2.jsonld b/pkg/restapi/v1/issuer/testdata/sample_invalid_vc_v2.jsonld new file mode 100644 index 000000000..9c32e1d68 --- /dev/null +++ b/pkg/restapi/v1/issuer/testdata/sample_invalid_vc_v2.jsonld @@ -0,0 +1,33 @@ +{ + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://w3id.org/citizenship/v2" + ], + "validFrom": "2019-12-03T12:19:52Z", + "validUntil": "2029-12-03T12:19:52Z", + "credentialSubject": { + "image": "data:image/png;base64,iVBORw0KGgo...kJggg==", + "lprNumber": "999-999-999", + "gender": "Male", + "residentSince": "2015-01-01", + "givenName": "JOHN", + "familyName": "SMITH", + "birthCountry": "Bahamas", + "id": "did:example:b34ca6cd37bbf23", + "invalidField": "C1", + "type": [ + "PermanentResident", + "Person" + ], + "birthDate": "1958-07-17", + "lprCategory": "C09" + }, + "name": "Permanent Resident Card", + "description": "Permanent Resident Card", + "id": "http://example.gov/credentials/ff98f978-588f-4eb0-b17b-60c18e1dac2c#13250913-eb53-4418-9077-fb429f6b033f", + "type": [ + "VerifiableCredential", + "PermanentResidentCard" + ], + "issuer": "did:key:z6MkrqCMy45WhL3UEa1gGTHUtr17AvU4czfP5fH9KNDoYaYN" +} \ No newline at end of file diff --git a/pkg/restapi/v1/issuer/testdata/sample_vc_v2.jsonld b/pkg/restapi/v1/issuer/testdata/sample_vc_v2.jsonld new file mode 100644 index 000000000..2d66dbb69 --- /dev/null +++ b/pkg/restapi/v1/issuer/testdata/sample_vc_v2.jsonld @@ -0,0 +1,35 @@ +{ + "credential": { + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://w3id.org/citizenship/v2" + ], + "validFrom": "2019-12-03T12:19:52Z", + "validUntil": "2029-12-03T12:19:52Z", + "credentialSubject": { + "image": "data:image/png;base64,iVBORw0KGgo...kJggg==", + "lprNumber": "999-999-999", + "gender": "Male", + "residentSince": "2015-01-01", + "givenName": "JOHN", + "familyName": "SMITH", + "birthCountry": "Bahamas", + "id": "did:example:b34ca6cd37bbf23", + "commuterClassification": "C1", + "type": [ + "PermanentResident", + "Person" + ], + "birthDate": "1958-07-17", + "lprCategory": "C09" + }, + "name": "Permanent Resident Card", + "description": "Permanent Resident Card", + "id": "http://example.gov/credentials/ff98f978-588f-4eb0-b17b-60c18e1dac2c#13250913-eb53-4418-9077-fb429f6b033f", + "type": [ + "VerifiableCredential", + "PermanentResidentCard" + ], + "issuer": "did:key:z6MkrqCMy45WhL3UEa1gGTHUtr17AvU4czfP5fH9KNDoYaYN" + } +} diff --git a/pkg/service/issuecredential/composer.go b/pkg/service/issuecredential/composer.go index ab700a56f..23798f6d7 100644 --- a/pkg/service/issuecredential/composer.go +++ b/pkg/service/issuecredential/composer.go @@ -69,11 +69,19 @@ func (c *CredentialComposer) Compose( } if credential.Contents().Expired == nil && req.CredentialConfiguration.CredentialExpiresAt != nil { - credential = credential.WithModifiedExpired(util.NewTime(*req.CredentialConfiguration.CredentialExpiresAt)) + if verifiable.IsBaseContext(credential.Contents().Context, verifiable.V2ContextURI) { + credential = credential.WithModifiedValidUntil(util.NewTime(*req.CredentialConfiguration.CredentialExpiresAt)) + } else { + credential = credential.WithModifiedExpired(util.NewTime(*req.CredentialConfiguration.CredentialExpiresAt)) + } } if credential.Contents().Issued == nil { - credential = credential.WithModifiedIssued(util.NewTime(time.Now().UTC())) + if verifiable.IsBaseContext(credential.Contents().Context, verifiable.V2ContextURI) { + credential = credential.WithModifiedValidFrom(util.NewTime(time.Now().UTC())) + } else { + credential = credential.WithModifiedIssued(util.NewTime(time.Now().UTC())) + } } return credential, nil diff --git a/pkg/service/issuecredential/composer_test.go b/pkg/service/issuecredential/composer_test.go index b6aa826a4..8bc4621ef 100644 --- a/pkg/service/issuecredential/composer_test.go +++ b/pkg/service/issuecredential/composer_test.go @@ -1,3 +1,9 @@ +/* +Copyright Gen Digital Inc. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + package issuecredential_test import ( @@ -7,6 +13,7 @@ import ( "github.com/samber/lo" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" util "github.com/trustbloc/did-go/doc/util/time" "github.com/trustbloc/vc-go/verifiable" @@ -68,6 +75,61 @@ func TestComposer(t *testing.T) { assert.NotNil(t, expectedExpiration, parsedCred.Contents().Issued) }) + t.Run("success - V2", func(t *testing.T) { + srv := issuecredential.NewCredentialComposer() + + cred, err := verifiable.CreateCredential(verifiable.CredentialContents{ + Types: []string{"VerifiableCredential"}, + Context: []string{ + verifiable.V2ContextURI, + }, + Subject: []verifiable.Subject{{ID: "xxx:yyy"}}, + }, verifiable.CustomFields{}) + require.NoError(t, err) + + expectedExpiration := time.Now().UTC() + + resp, err := srv.Compose( + context.TODO(), + cred, + &issuecredential.PrepareCredentialsRequest{ + TxID: "some-awesome-id", + IssuerDID: "did:example:123", + SubjectDID: "some-awesome-did", + CredentialConfiguration: &issuecredential.TxCredentialConfiguration{ + CredentialComposeConfiguration: &issuecredential.CredentialComposeConfiguration{ + IDTemplate: "hardcoded:{{.TxID}}:suffix", + OverrideIssuer: true, + OverrideSubjectDID: true, + }, + CredentialExpiresAt: &expectedExpiration, + }, + }, + ) + + require.NotNil(t, resp.Contents().Issued) + require.NotNil(t, resp.Contents().Expired) + + require.NoError(t, err) + require.NotNil(t, resp) + + credJSON, err := resp.MarshalAsJSONLD() + require.NoError(t, err) + + parsedCred, err := verifiable.ParseCredential(credJSON, + verifiable.WithCredDisableValidation(), + verifiable.WithDisabledProofCheck(), + ) + require.NoError(t, err) + + require.EqualValues(t, "hardcoded:some-awesome-id:suffix", resp.Contents().ID) + require.EqualValues(t, "did:example:123", resp.Contents().Issuer.ID) + require.EqualValues(t, "some-awesome-did", resp.Contents().Subject[0].ID) + require.EqualValues(t, expectedExpiration, parsedCred.Contents().Expired.Time) + require.NotEmpty(t, parsedCred.CustomField("validFrom")) + require.NotEmpty(t, parsedCred.CustomField("validUntil")) + }) + t.Run("success with prev-id", func(t *testing.T) { srv := issuecredential.NewCredentialComposer() diff --git a/pkg/service/issuecredential/issuecredential_service_test.go b/pkg/service/issuecredential/issuecredential_service_test.go index 1fdc71cde..f1f8cc255 100644 --- a/pkg/service/issuecredential/issuecredential_service_test.go +++ b/pkg/service/issuecredential/issuecredential_service_test.go @@ -432,7 +432,7 @@ func createCredential(t *testing.T) *verifiable.Credential { vcCreated, err := verifiable.CreateCredential(verifiable.CredentialContents{ ID: "http://example.edu/credentials/1872", - Context: []string{verifiable.ContextURI}, + Context: []string{verifiable.V1ContextURI}, Types: []string{verifiable.VCType}, Subject: []verifiable.Subject{{ID: "did:example:76e12ec712ebc6f1c221ebfeb1f"}}, Issued: &util.TimeWrapper{ diff --git a/pkg/service/oidc4ci/oidc4ci_service_initiate_issuance.go b/pkg/service/oidc4ci/oidc4ci_service_initiate_issuance.go index 5b09680fd..81412f2c5 100644 --- a/pkg/service/oidc4ci/oidc4ci_service_initiate_issuance.go +++ b/pkg/service/oidc4ci/oidc4ci_service_initiate_issuance.go @@ -251,8 +251,11 @@ func (s *Service) newTxCredentialConf( func (s *Service) validateComposeCredential(credential map[string]interface{}) error { requiredFields := map[string]string{ - "issuer": "did:orb:anything", - "issuanceDate": "2021-01-01T00:00:00Z", + "issuer": "did:orb:anything", + } + + if verifiable2.HasBaseContext(credential, verifiable2.V1ContextURI) { + requiredFields["issuanceDate"] = "2021-01-01T00:00:00Z" } var missingFieldsAdded []string diff --git a/pkg/service/oidc4vp/api.go b/pkg/service/oidc4vp/api.go index de107c50c..527a5399c 100644 --- a/pkg/service/oidc4vp/api.go +++ b/pkg/service/oidc4vp/api.go @@ -51,6 +51,8 @@ type CredentialMetadata struct { Issuer interface{} `json:"issuer,omitempty"` IssuanceDate *util.TimeWrapper `json:"issuanceDate,omitempty"` ExpirationDate *util.TimeWrapper `json:"expirationDate,omitempty"` + ValidFrom *util.TimeWrapper `json:"validFrom,omitempty"` + ValidUntil *util.TimeWrapper `json:"validUntil,omitempty"` CustomClaims map[string]Claims `json:"customClaims,omitempty"` Name interface{} `json:"name,omitempty"` diff --git a/pkg/service/oidc4vp/oidc4vp_service.go b/pkg/service/oidc4vp/oidc4vp_service.go index a1d150f6a..37caa3013 100644 --- a/pkg/service/oidc4vp/oidc4vp_service.go +++ b/pkg/service/oidc4vp/oidc4vp_service.go @@ -586,11 +586,17 @@ func (s *Service) RetrieveClaims( }) credMeta := CredentialMetadata{ - Format: credType, - Type: credContents.Types, - SubjectData: subject, - IssuanceDate: credContents.Issued, - ExpirationDate: credContents.Expired, + Format: credType, + Type: credContents.Types, + SubjectData: subject, + } + + if verifiable.IsBaseContext(credContents.Context, verifiable.V2ContextURI) { + credMeta.ValidFrom = credContents.Issued + credMeta.ValidUntil = credContents.Expired + } else { + credMeta.IssuanceDate = credContents.Issued + credMeta.ExpirationDate = credContents.Expired } credMeta.Name = cred.CustomField(additionalClaimFieldName) diff --git a/pkg/service/oidc4vp/oidc4vp_service_test.go b/pkg/service/oidc4vp/oidc4vp_service_test.go index 1cb0e5c2d..da1753ac9 100644 --- a/pkg/service/oidc4vp/oidc4vp_service_test.go +++ b/pkg/service/oidc4vp/oidc4vp_service_test.go @@ -54,6 +54,8 @@ var ( sampleVCJsonLD string //go:embed testdata/university_degree.jwt sampleVCJWT string + //go:embed testdata/sample_vc_v2.jsonld + sampleV2VCJsonLD string ) const ( @@ -1176,6 +1178,34 @@ func TestService_RetrieveClaims(t *testing.T) { claims["_scope"], ) }) + + t.Run("Success V2 JsonLD", func(t *testing.T) { + mockEventSvc := NewMockeventService(gomock.NewController(t)) + mockEventSvc.EXPECT().Publish(gomock.Any(), spi.VerifierEventTopic, gomock.Any()).DoAndReturn( + expectedPublishEventFunc(t, spi.VerifierOIDCInteractionClaimsRetrieved, nil), + ) + + ldvc, err := verifiable.ParseCredential([]byte(sampleV2VCJsonLD), + verifiable.WithJSONLDDocumentLoader(loader), + verifiable.WithDisabledProofCheck()) + require.NoError(t, err) + + svc := oidc4vp.NewService(&oidc4vp.Config{EventSvc: mockEventSvc, EventTopic: spi.VerifierEventTopic}) + + claims := svc.RetrieveClaims(context.Background(), &oidc4vp.Transaction{ + ReceivedClaims: &oidc4vp.ReceivedClaims{Credentials: []*verifiable.Credential{ + ldvc, + }}}, &profileapi.Verifier{}) + require.NotNil(t, claims) + + subjects, ok := claims["http://example.gov/credentials/ff98f978"].SubjectData.([]map[string]interface{}) + require.True(t, ok) + require.Equal(t, "did:example:b34ca6cd37bbf23", subjects[0]["id"]) + require.NotEmpty(t, claims["http://example.gov/credentials/ff98f978"].Issuer) + require.NotEmpty(t, claims["http://example.gov/credentials/ff98f978"].ValidFrom) + require.NotEmpty(t, claims["http://example.gov/credentials/ff98f978"].ValidUntil) + require.Empty(t, claims["_scope"]) + }) } func createCryptoSuite(t *testing.T) api.Suite { @@ -1261,7 +1291,7 @@ func newVP(t *testing.T, submission *presexch.PresentationSubmission, func newVC(issuer string, ctx []string, customTypes []string) verifiable.CredentialContents { cred := verifiable.CredentialContents{ - Context: []string{verifiable.ContextURI}, + Context: []string{verifiable.V1ContextURI}, Types: append([]string{verifiable.VCType}, customTypes...), ID: "http://test.credential.com/123", Issuer: &verifiable.Issuer{ID: issuer}, @@ -1285,7 +1315,7 @@ func newVC(issuer string, ctx []string, customTypes []string) verifiable.Credent func newDegreeVC(issuer string, degreeType string, ctx []string, customTypes []string) verifiable.CredentialContents { cred := verifiable.CredentialContents{ - Context: []string{verifiable.ContextURI}, + Context: []string{verifiable.V1ContextURI}, Types: append([]string{verifiable.VCType}, customTypes...), ID: uuid.New().String(), Issuer: &verifiable.Issuer{ID: issuer}, diff --git a/pkg/service/oidc4vp/testdata/sample_vc_v2.jsonld b/pkg/service/oidc4vp/testdata/sample_vc_v2.jsonld new file mode 100644 index 000000000..62bc6fd9f --- /dev/null +++ b/pkg/service/oidc4vp/testdata/sample_vc_v2.jsonld @@ -0,0 +1,33 @@ +{ + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://w3id.org/citizenship/v2" + ], + "validFrom": "2019-12-03T12:19:52Z", + "validUntil": "2029-12-03T12:19:52Z", + "credentialSubject": { + "image": "data:image/png;base64,iVBORw0KGgo...kJggg==", + "lprNumber": "999-999-999", + "gender": "Male", + "residentSince": "2015-01-01", + "givenName": "JOHN", + "familyName": "SMITH", + "birthCountry": "Bahamas", + "id": "did:example:b34ca6cd37bbf23", + "commuterClassification": "C1", + "type": [ + "PermanentResident", + "Person" + ], + "birthDate": "1958-07-17", + "lprCategory": "C09" + }, + "name": "Permanent Resident Card", + "description": "Permanent Resident Card", + "id": "http://example.gov/credentials/ff98f978", + "type": [ + "VerifiableCredential", + "PermanentResidentCard" + ], + "issuer": "did:key:z6MkrqCMy45WhL3UEa1gGTHUtr17AvU4czfP5fH9KNDoYaYN" +} diff --git a/pkg/service/trustregistry/trustregistry_service_test.go b/pkg/service/trustregistry/trustregistry_service_test.go index f91731530..0851734fa 100644 --- a/pkg/service/trustregistry/trustregistry_service_test.go +++ b/pkg/service/trustregistry/trustregistry_service_test.go @@ -575,7 +575,7 @@ func createVC( vcc := verifiable.CredentialContents{ Context: []string{ - verifiable.ContextURI, + verifiable.V1ContextURI, "https://w3c-ccg.github.io/lds-jws2020/contexts/lds-jws2020-v1.json", }, ID: uuid.New().String(), diff --git a/pkg/service/verifycredential/verifycredential_service.go b/pkg/service/verifycredential/verifycredential_service.go index b3b39d1d7..e4936c523 100644 --- a/pkg/service/verifycredential/verifycredential_service.go +++ b/pkg/service/verifycredential/verifycredential_service.go @@ -15,14 +15,15 @@ import ( "net/http" "github.com/piprate/json-gold/ld" - "github.com/trustbloc/vc-go/proof/defaults" - "github.com/trustbloc/vc-go/vermethod" - vdrapi "github.com/trustbloc/did-go/vdr/api" + "github.com/trustbloc/logutil-go/pkg/log" "github.com/trustbloc/vc-go/dataintegrity" "github.com/trustbloc/vc-go/dataintegrity/suite/ecdsa2019" + "github.com/trustbloc/vc-go/proof/defaults" "github.com/trustbloc/vc-go/verifiable" + "github.com/trustbloc/vc-go/vermethod" + "github.com/trustbloc/vcs/internal/logfields" "github.com/trustbloc/vcs/pkg/doc/vc" "github.com/trustbloc/vcs/pkg/doc/vc/bitstring" "github.com/trustbloc/vcs/pkg/doc/vc/crypto" @@ -30,6 +31,8 @@ import ( profileapi "github.com/trustbloc/vcs/pkg/profile" ) +var logger = log.New("verify-credential-service") + const ( revokedMsg = "revoked" ) @@ -243,6 +246,9 @@ func (s *Service) ValidateVCStatus(ctx context.Context, vcStatus *verifiable.Typ // TODO: check this on review. Previously we compared only issuer ids. So in case if both have empty issuers // it still consider this as valid situation. Should we keep same behavior? if statusListVCC.Issuer != nil && issuer != nil && statusListVCC.Issuer.ID != issuer.ID { + logger.Infoc(ctx, "issuer of the credential do not match status list vc issuer", + logfields.WithIssuerID(issuer.ID), logfields.WithStatusListIssuerID(statusListVCC.Issuer.ID)) + return fmt.Errorf("issuer of the credential do not match status list vc issuer") } diff --git a/test/bdd/attestation/go.mod b/test/bdd/attestation/go.mod index ee2049bd6..e00540c3f 100644 --- a/test/bdd/attestation/go.mod +++ b/test/bdd/attestation/go.mod @@ -12,8 +12,8 @@ require ( github.com/google/uuid v1.3.0 github.com/gorilla/mux v1.8.0 github.com/trustbloc/cmdutil-go v1.0.0 - github.com/trustbloc/did-go v1.2.2-0.20240812150654-c7d31e666f96 - github.com/trustbloc/vc-go v1.1.3-0.20240813130343-c7c2ade0e1fc + github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 + github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b ) diff --git a/test/bdd/attestation/go.sum b/test/bdd/attestation/go.sum index 09cff8844..ea7aa4b5e 100644 --- a/test/bdd/attestation/go.sum +++ b/test/bdd/attestation/go.sum @@ -226,14 +226,14 @@ github.com/trustbloc/bbs-signature-go v1.0.2 h1:gepEsbLiZHv/vva9FKG5gF38mGtOIyGe github.com/trustbloc/bbs-signature-go v1.0.2/go.mod h1:xYotcXHAbcE0TO+SteW0J6XI3geQaXq4wdnXR2k+XCU= github.com/trustbloc/cmdutil-go v1.0.0 h1:QCe7wVEIASWmy9ZDD0l0tsQCEsX6fx+kBFX5UqCVRdk= github.com/trustbloc/cmdutil-go v1.0.0/go.mod h1:o/v7C1z6d/5UrjaC6GAUc1hk0XVuE3M4tpyvsMMUw5k= -github.com/trustbloc/did-go v1.2.2-0.20240812150654-c7d31e666f96 h1:LpX6reFIcahgTxuDLrV9yro1gENtXQLv2NsneX5hWkc= -github.com/trustbloc/did-go v1.2.2-0.20240812150654-c7d31e666f96/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 h1:5GOoXZcKYDTsobaTCeFUEBjbognYbjBh38fCjkvClU4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= github.com/trustbloc/kms-go v1.1.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwys= github.com/trustbloc/kms-go v1.1.2/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v0.0.0-20221124174025-c46110e3ea42 h1:Mzg9wvEoUIWPoI/GHz3YlVbd4nKWeSPGc6+3l95eOZU= github.com/trustbloc/logutil-go v0.0.0-20221124174025-c46110e3ea42/go.mod h1:HRaXVV1caceumbDBwLO3ByiCcAc18KwrNvZ7JQBvDIQ= -github.com/trustbloc/vc-go v1.1.3-0.20240813130343-c7c2ade0e1fc h1:6/AZPtL61aybL8FsAgZBtaq89zX4ahgRqa20aEKP1fk= -github.com/trustbloc/vc-go v1.1.3-0.20240813130343-c7c2ade0e1fc/go.mod h1:l70VUyzJ+jAxGSlS+V8jiP5GnVcxFfV4bPxJ0grlu14= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 h1:SUz/V2k+Urckdr8Dqg1OJLl0RqkkXW84a0qoopP/i2w= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo= 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/attestation/server.go b/test/bdd/attestation/server.go index b8d80c7d7..4596c8b03 100644 --- a/test/bdd/attestation/server.go +++ b/test/bdd/attestation/server.go @@ -222,7 +222,7 @@ func (s *server) attestationVC( ) (string, error) { vcc := verifiable.CredentialContents{ Context: []string{ - verifiable.ContextURI, + verifiable.V1ContextURI, "https://w3c-ccg.github.io/lds-jws2020/contexts/lds-jws2020-v1.json", }, ID: uuid.New().String(), diff --git a/test/bdd/features/oidc4vc_api.feature b/test/bdd/features/oidc4vc_api.feature index b6dd94338..816e6170b 100644 --- a/test/bdd/features/oidc4vc_api.feature +++ b/test/bdd/features/oidc4vc_api.feature @@ -36,6 +36,28 @@ Feature: OIDC4VC REST API # LDP issuer, LDP verifier, no limit disclosure and schema match in PD query. | i_myprofile_cmtr_p256_ldp/v1.0 | CrudeProductCredential | pre-registered | crudeProductCredentialTemplateID | v_myprofile_ldp/v1.0 | lp403pb9-schema-match | schema_id | + @oidc4vc_rest_auth_flow_v2 + Scenario Outline: OIDC credential issuance and verification Auth flow with credential model 2.0 + Given Profile "" issuer has been authorized with username "profile-user-issuer-1" and password "profile-user-issuer-1-pwd" + And User holds credential "" with templateID "" + And Profile "" verifier has been authorized with username "profile-user-verifier-1" and password "profile-user-verifier-1-pwd" + + When User interacts with Wallet to initiate credential issuance using authorization code flow with client registration method "" + Then "1" credentials are issued + Then User interacts with Verifier and initiate OIDC4VP interaction under "" profile with presentation definition ID "" and fields "" + And Verifier with profile "" retrieves interactions claims + Then we wait 2 seconds + And Verifier with profile "" requests deleted interactions claims + + Examples: + | issuerProfile | credentialType | clientRegistrationMethod | credentialTemplate | verifierProfile | presentationDefinitionID | fields | +# SDJWT issuer, JWT verifier, no limit disclosure in PD query. + | bank_issuer_v2/v1.0 | UniversityDegreeCredential | dynamic | universityDegreeTemplateID | v_myprofile_jwt/v1.0 | 32f54163-no-limit-disclosure-single-field | degree_type_id | +# SDJWT issuer, JWT verifier, limit disclosure and optional fields in PD query. + | bank_issuer_v2/v1.0 | CrudeProductCredential | discoverable | crudeProductCredentialTemplateID | v_myprofile_jwt/v1.0 | 3c8b1d9a-limit-disclosure-optional-fields | unit_of_measure_barrel,api_gravity,category,supplier_address | +# JWT issuer, JWT verifier, no limit disclosure and optional fields in PD query. + | i_myprofile_ud_es256k_jwt_v2/v1.0 | PermanentResidentCard | pre-registered | permanentResidentCardTemplateID | v_myprofile_jwt/v1.0 | 32f54163-no-limit-disclosure-optional-fields | lpr_category_id,registration_city,commuter_classification | + @oidc4vc_rest_auth_flow_batch_credential_configuration_id Scenario Outline: OIDC Batch credential issuance and verification Auth flow (request all credentials by credentialConfigurationID) Given Profile "" issuer has been authorized with username "profile-user-issuer-1" and password "profile-user-issuer-1-pwd" diff --git a/test/bdd/fixtures/file-server/ld-contexts.json b/test/bdd/fixtures/file-server/ld-contexts.json index cf29d1a2c..50ae4130c 100644 --- a/test/bdd/fixtures/file-server/ld-contexts.json +++ b/test/bdd/fixtures/file-server/ld-contexts.json @@ -211,6 +211,16 @@ }] } }, + { + "url": "https://www.w3.org/ns/credentials/examples/v2", + "content" : { + "@context": [ + { + "@vocab": "https://www.w3.org/ns/credentials/examples#" + } + ] + } + }, { "url": "https://www.w3.org/ns/odrl.jsonld", "content": { @@ -471,6 +481,58 @@ } } }, + { + "url": "https://w3id.org/citizenship/v2", + "content": { + "@context": { + "@version": 1.1, + "@protected": true, + + "identifier": "http://schema.org/identifier", + "image": {"@id": "http://schema.org/image", "@type": "@id"}, + + "PermanentResidentCard": { + "@id": "https://w3id.org/citizenship#PermanentResidentCard", + "@context": { + "@version": 1.1, + "@protected": true, + + "id": "@id", + "type": "@type", + + "identifier": "http://schema.org/identifier", + "image": {"@id": "http://schema.org/image", "@type": "@id"} + } + }, + "PermanentResident": { + "@id": "https://w3id.org/citizenship#PermanentResident", + "@context": { + "@version": 1.1, + "@protected": true, + + "id": "@id", + "type": "@type", + + "ctzn": "https://w3id.org/citizenship#", + "schema": "http://schema.org/", + "xsd": "http://www.w3.org/2001/XMLSchema#", + + "birthCountry": "ctzn:birthCountry", + "birthDate": {"@id": "schema:birthDate", "@type": "xsd:dateTime"}, + "commuterClassification": "ctzn:commuterClassification", + "familyName": "schema:familyName", + "gender": "schema:gender", + "givenName": "schema:givenName", + "lprCategory": "ctzn:lprCategory", + "lprNumber": "ctzn:lprNumber", + "residentSince": {"@id": "ctzn:residentSince", "@type": "xsd:dateTime"} + } + }, + + "Person": "http://schema.org/Person" + } + } + }, { "url": "https://trustbloc.github.io/context/vc/examples-ext-v1.jsonld", "content": { @@ -757,6 +819,95 @@ "unsaturatedHydrocarbons": "cp:unsaturatedHydrocarbons" } } + }, + { + "url": "https://trustbloc.github.io/context/vc/examples-crude-product-v2.jsonld", + "content": { + "@context": + { + "@version": 1.1, + "cp": "https://mavennet.github.io/contexts/crude-product-vocab#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "schema": "http://schema.org/", + "prm": "http://schema.org/ProductModel", + "CrudeProductCredential": "schema:CrudeProductCredential", + "producer": "cp:producer", + "category": "cp:category", + "hsCode": "cp:hsCode", + "identifier": "prm:identifier", + "volume": "cp:volume", + "address": "prm:address", + "productionDate": "prm:productionDate", + "predecessorOf": "prm:predecessorOf", + "successorOf": "prm:successorOf", + "physicalSpecs": "cp:physicalSpecs", + "chemicalSpecs": "cp:chemicalSpecs", + "latitude": "cp:latitude", + "longitude": "cp:longitude", + "uom": "cp:uom", + "minimumQuantity": "cp:minimumQuantity", + "apiGravity": "cp:apiGravity", + "viscosityAt10C": "cp:viscosityAt10C", + "viscosityAt20C": "cp:viscosityAt20C", + "viscosityAt30C": "cp:viscosityAt30C", + "viscosityAt40C": "cp:viscosityAt40C", + "viscosityAt45C": "cp:viscosityAt45C", + "pourPoint": "cp:pourPoint", + "vapourPressure": "cp:vapourPressure", + "density": "cp:density", + "naphtha": "cp:naphtha", + "distillateAt350To650F": "cp:distillateAt350To650F", + "gasOilAt650To980F": "cp:gasOilAt650To980F", + "residAt980F": "cp:residAt980F", + "deemedButane": "cp:deemedButane", + "tan": "cp:tan", + "ron": "cp:ron", + "mon": "cp:mon", + "boilingPoint": "cp:boilingPoint", + "freezingPoint": "cp:freezingPoint", + "criticalTemperature": "cp:criticalTemperature", + "criticalPressure": "cp:criticalPressure", + "autoIgnitionTemperatureInAirAt1atm": "cp:autoIgnitionTemperatureInAirAt1atm", + "solubilityInTrichloroethylene": "cp:solubilityInTrichloroethylene", + "penetrationAt25C100g5sec": "cp:penetrationAt25C100g5sec", + "softeningPoint": "cp:softeningPoint", + "ductilityAt25C": "cp:ductilityAt25C", + "olefin": "cp:olefin", + "color": "cp:color", + "odor": "cp:odor", + "grossCalorificValueAt15C": "cp:grossCalorificValueAt15C", + "netCalorificValueAt15C": "cp:netCalorificValueAt15C", + "airRequiredForCombustion": "cp:airRequiredForCombustion", + "copperCorrosionAt38CFor1Hour": "cp:copperCorrosionAt38CFor1Hour", + "microCarbonResidue": "cp:microCarbonResidue", + "aromaticsTotalBTEX": "cp:aromaticsTotalBTEX", + "sedimentAndWater": "cp:sedimentAndWater", + "liquidPhaseH2S": "cp:liquidPhaseH2S", + "mercury": "cp:mercury", + "oxygenates": "cp:oxygenates", + "filterableSolids": "cp:filterableSolids", + "phosphorousVolatile": "cp:phosphorousVolatile", + "mediumChainTriglycerides": "cp:mediumChainTriglycerides", + "benzene": "cp:benzene", + "particulates": "cp:particulates", + "organicChlorides": "cp:organicChlorides", + "nickel": "cp:nickel", + "vanadium": "cp:vanadium", + "water": "cp:water", + "molecularWeight": "cp:molecularWeight", + "sulphur": "cp:sulphur", + "naphthenes": "cp:naphthenes", + "chloride": "cp:chloride", + "arsenic": "cp:arsenic", + "lead": "cp:lead", + "ethene": "cp:ethene", + "propane": "cp:propane", + "isoButane": "cp:isoButane", + "nButane": "cp:nButane", + "hydrocarbonsHeavier": "cp:hydrocarbonsHeavier", + "unsaturatedHydrocarbons": "cp:unsaturatedHydrocarbons" + } + } } ] } diff --git a/test/bdd/fixtures/profile/profiles.json b/test/bdd/fixtures/profile/profiles.json index 28043fe2f..f0bf6abf5 100644 --- a/test/bdd/fixtures/profile/profiles.json +++ b/test/bdd/fixtures/profile/profiles.json @@ -925,6 +925,198 @@ }, "createDID": true }, + { + "issuer": { + "id": "i_myprofile_ud_es256k_jwt_v2", + "version": "v1.0", + "groupID": "group_i_myprofile_ud_es256k_jwt_v2", + "name": "i_myprofile_ud_es256k_jwt v2.0", + "organizationID": "00000000-0000-0000-0000-000000000001", + "url": "http://vc-rest-echo.trustbloc.local:8075", + "active": true, + "vcConfig": { + "refreshServiceEnabled": false, + "signingAlgorithm": "ES256K", + "signatureRepresentation": 1, + "keyType": "ECDSASecp256k1DER", + "format": "jwt", + "didMethod": "ion", + "status": { + "type": "StatusList2021Entry" + } + }, + "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" + }, + "credentialTemplates": [ + { + "contexts": [ + "https://www.w3.org/ns/credentials/v2", + "https://w3id.org/citizenship/v2" + ], + "type": "PermanentResidentCard", + "id": "permanentResidentCardTemplateID", + "issuer": "did:orb:i_myprofile_ud_es256k_jwt_v2", + "checks": { + "strict": true + } + }, + { + "contexts": [ + "https://www.w3.org/ns/credentials/v2", + "https://www.w3.org/ns/credentials/examples/v2" + ], + "type": "VerifiedEmployee", + "id": "templateID", + "issuer": "did:orb:i_myprofile_ud_es256k_jwt_v2", + "checks": { + "strict": true + } + }, + { + "contexts": [ + "https://www.w3.org/ns/credentials/v2", + "https://www.w3.org/ns/credentials/examples/v2" + ], + "type": "UniversityDegreeCredential", + "id": "universityDegreeTemplateID", + "issuer": "did:orb:i_myprofile_ud_es256k_jwt_v2", + "checks": { + "strict": true + } + }, + { + "contexts": [ + "https://www.w3.org/ns/credentials/v2", + "https://trustbloc.github.io/context/vc/examples-crude-product-v2.jsonld" + ], + "type": "CrudeProductCredential", + "id": "crudeProductCredentialTemplateID", + "issuer": "did:orb:i_myprofile_ud_es256k_jwt_v2", + "checks": { + "strict": true + } + } + ], + "credentialMetadata": { + "display": [], + "credential_configurations_supported": { + "VerifiedEmployeeIdentifier": { + "format": "jwt_vc_json", + "display": [ + { + "name": "Verified Employee", + "locale": "en-US", + "logo": { + "uri": "https://example.com/public/logo.png", + "alt_text": "a square logo of a employee verification" + }, + "background_color": "#12107c", + "text_color": "#FFFFFF" + } + ], + "credential_definition": { + "credentialSubject": { + "displayName": { + "display": [ + { + "name": "Employee", + "locale": "en-US" + } + ] + }, + "givenName": { + "display": [ + { + "name": "Given Name", + "locale": "en-US" + } + ] + }, + "jobTitle": { + "display": [ + { + "name": "Job Title", + "locale": "en-US" + } + ] + }, + "surname": { + "display": [ + { + "name": "Surname", + "locale": "en-US" + } + ] + }, + "preferredLanguage": { + "display": [ + { + "name": "Preferred Language", + "locale": "en-US" + } + ] + }, + "mail": { + "display": [ + { + "name": "Mail", + "locale": "en-US" + } + ] + }, + "photo": { + "display": [ + { + "name": "Photo" + } + ] + } + }, + "type": [ + "VerifiableCredential", + "PermanentResidentCard" + ] + } + }, + "CrudeProductCredentialIdentifier": { + "format": "jwt_vc_json", + "scope": "CrudeProductCredential_001", + "credential_definition": { + "type": [ + "VerifiableCredential", + "CrudeProductCredential" + ], + "credentialSubject": {} + }, + "display": [] + } + } + } + }, + "createDID": true + }, { "issuer": { "id": "awesome_cwt", @@ -1677,6 +1869,219 @@ }, "createDID": true }, + { + "issuer": { + "id": "bank_issuer_v2", + "version": "v1.0", + "groupID": "group_bank_issuer_v2", + "name": "Bank Issuer 2.0", + "organizationID": "00000000-0000-0000-0000-000000000001", + "url": "http://vc-rest-echo.trustbloc.local:8075", + "active": true, + "vcConfig": { + "refreshServiceEnabled": false, + "signingAlgorithm": "JsonWebSignature2020", + "signatureRepresentation": 0, + "keyType": "ECDSASecp256k1DER", + "format": "jwt", + "didMethod": "ion", + "status": { + "type": "StatusList2021Entry" + }, + "sdjwt": { + "enable": true, + "hashAlg": 6 + } + }, + "oidcConfig": { + "client_id": "7d4u50e7w6nfq8tfayhzplgjf", + "client_secret_handle": "282ks4fkuqfosus5k0x30abnv", + "issuer_well_known": "http://cognito-mock.trustbloc.local:9229/local_5a9GzRvB/.well-known/openid-configuration", + "scopes_supported": [ + "openid", + "profile", + "VerifiedEmployeeCredential_001", + "UniversityDegreeCredential_001", + "CrudeProductCredential_001" + ], + "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, + "enable_discoverable_client_id_scheme": true, + "pre-authorized_grant_anonymous_access_supported": true, + "wallet_initiated_auth_flow_supported": true, + "claims_endpoint": "https://mock-login-consent.example.com:8099/claim-data?credentialType=UniversityDegreeCredential" + }, + "credentialTemplates": [ + { + "contexts": [ + "https://www.w3.org/ns/credentials/v2", + "https://www.w3.org/ns/credentials/examples/v2" + ], + "jsonSchema": "{\"$id\":\"https://trustbloc.com/universitydegree.schema.json\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"title\":\"UniversityDegreeCredential\",\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"spouse\":{\"type\":\"string\"},\"degree\":{\"type\":\"object\",\"description\":\"Describes the degree.\",\"properties\":{\"type\":{\"type\":\"string\"},\"degree\":{\"type\":\"string\"}},\"required\":[\"type\",\"degree\"]}},\"required\":[\"name\",\"spouse\",\"degree\"]}", + "type": "UniversityDegreeCredential", + "id": "universityDegreeTemplateID", + "issuer": "did:orb:bank_issuer", + "checks": { + "strict": true + } + }, + { + "contexts": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "type": "VerifiedEmployee", + "id": "templateID", + "issuer": "did:orb:bank_issuer", + "checks": { + "strict": true + } + }, + { + "contexts": [ + "https://www.w3.org/ns/credentials/v2", + "https://w3id.org/citizenship/v1" + ], + "type": "PermanentResidentCard", + "id": "permanentResidentCardTemplateID", + "issuer": "did:orb:bank_issuer", + "checks": { + "strict": true + } + }, + { + "contexts": [ + "https://www.w3.org/ns/credentials/v2", + "https://trustbloc.github.io/context/vc/examples-crude-product-v2.jsonld" + ], + "type": "CrudeProductCredential", + "id": "crudeProductCredentialTemplateID", + "issuer": "did:orb:bank_issuer", + "checks": { + "strict": true + } + } + ], + "credentialMetadata": { + "display": [], + "credential_configurations_supported": { + "VerifiedEmployeeIdentifier": { + "format": "jwt_vc_json-ld", + "scope": "VerifiedEmployeeCredential_001", + "credential_definition": { + "type": [ + "VerifiableCredential", + "VerifiedEmployee" + ], + "credentialSubject": { + "displayName": { + "display": [ + { + "name": "Employee", + "locale": "en-US" + } + ] + }, + "givenName": { + "display": [ + { + "name": "Given Name", + "locale": "en-US" + } + ] + }, + "jobTitle": { + "display": [ + { + "name": "Job Title", + "locale": "en-US" + } + ] + }, + "surname": { + "display": [ + { + "name": "Surname", + "locale": "en-US" + } + ] + }, + "preferredLanguage": { + "display": [ + { + "name": "Preferred Language", + "locale": "en-US" + } + ] + }, + "mail": { + "display": [ + { + "name": "Mail", + "locale": "en-US" + } + ] + }, + "photo": { + "display": [ + { + "name": "Photo" + } + ] + } + } + }, + "display": [ + { + "name": "Verified Employee", + "locale": "en-US", + "logo": { + "uri": "https://example.com/public/logo.png", + "alt_text": "a square logo of a employee verification" + }, + "background_color": "#12107c", + "text_color": "#FFFFFF" + } + ] + }, + "UniversityDegreeCredentialIdentifier": { + "format": "jwt_vc_json-ld", + "scope": "UniversityDegreeCredential_001", + "credential_definition": { + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "credentialSubject": {} + }, + "display": [] + }, + "CrudeProductCredentialIdentifier": { + "format": "jwt_vc_json-ld", + "scope": "CrudeProductCredential_001", + "credential_definition": { + "type": [ + "VerifiableCredential", + "CrudeProductCredential" + ], + "credentialSubject": {} + }, + "display": [] + } + } + } + }, + "createDID": true + }, { "issuer": { "id": "bank_issuer_sdjwt_v5", diff --git a/test/bdd/go.mod b/test/bdd/go.mod index e7bc2027c..fdb6ec388 100644 --- a/test/bdd/go.mod +++ b/test/bdd/go.mod @@ -25,11 +25,11 @@ require ( github.com/samber/lo v1.47.0 github.com/tidwall/gjson v1.17.3 github.com/trustbloc/cmdutil-go v0.0.0-20221125151303-09d42adcc811 - github.com/trustbloc/did-go v1.3.0 + github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 github.com/trustbloc/kms-go v1.1.2 github.com/trustbloc/logutil-go v1.0.0 github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.0 + github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 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 09f6f3d7f..51bfe1c11 100644 --- a/test/bdd/go.sum +++ b/test/bdd/go.sum @@ -782,16 +782,16 @@ github.com/trustbloc/bbs-signature-go v1.0.2 h1:gepEsbLiZHv/vva9FKG5gF38mGtOIyGe github.com/trustbloc/bbs-signature-go v1.0.2/go.mod h1:xYotcXHAbcE0TO+SteW0J6XI3geQaXq4wdnXR2k+XCU= github.com/trustbloc/cmdutil-go v0.0.0-20221125151303-09d42adcc811 h1:0e1d1w9o662+e7ZnJvRYJH8yblcBXngme8qbsjTvhQc= github.com/trustbloc/cmdutil-go v0.0.0-20221125151303-09d42adcc811/go.mod h1:o/v7C1z6d/5UrjaC6GAUc1hk0XVuE3M4tpyvsMMUw5k= -github.com/trustbloc/did-go v1.3.0 h1:vfiY/dewd9cORo3U5c+eoWgNIQnKsuQYn5PV0CRu1o0= -github.com/trustbloc/did-go v1.3.0/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 h1:5GOoXZcKYDTsobaTCeFUEBjbognYbjBh38fCjkvClU4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= github.com/trustbloc/kms-go v1.1.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwys= github.com/trustbloc/kms-go v1.1.2/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYttMypcE= github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc= 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.0 h1:/2blMr1hnw4xwQSO7RwMQC3boVC9ADm39MS+NAAtGoA= -github.com/trustbloc/vc-go v1.2.0/go.mod h1:o14xyB2I5GgJlsrH+Doh6NbKDStGmJ1R5nnlEV781IE= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 h1:SUz/V2k+Urckdr8Dqg1OJLl0RqkkXW84a0qoopP/i2w= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo= 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/bddutil/contexts/examples-v2.jsonld b/test/bdd/pkg/bddutil/contexts/examples-v2.jsonld new file mode 100644 index 000000000..f9b42be26 --- /dev/null +++ b/test/bdd/pkg/bddutil/contexts/examples-v2.jsonld @@ -0,0 +1,5 @@ +{ + "@context": { + "@vocab": "https://www.w3.org/ns/credentials/examples#" + } +} \ No newline at end of file diff --git a/test/bdd/pkg/bddutil/util.go b/test/bdd/pkg/bddutil/util.go index 3503f8b2b..8bbec0100 100644 --- a/test/bdd/pkg/bddutil/util.go +++ b/test/bdd/pkg/bddutil/util.go @@ -270,7 +270,9 @@ var ( //go:embed contexts/citizenship-v1.jsonld citizenshipVocab []byte //go:embed contexts/examples-v1.jsonld - examplesVocab []byte + examplesVocabV1 []byte + //go:embed contexts/examples-v2.jsonld + examplesVocabV2 []byte //go:embed contexts/examples-ext-v1.jsonld examplesExtVocab []byte //go:embed contexts/examples-crude-product-v1.jsonld @@ -295,7 +297,11 @@ var extraContexts = []ldcontext.Document{ //nolint:gochecknoglobals }, { URL: "https://www.w3.org/2018/credentials/examples/v1", - Content: examplesVocab, + Content: examplesVocabV1, + }, + { + URL: "https://www.w3.org/ns/credentials/examples/v2", + Content: examplesVocabV2, }, { URL: "https://trustbloc.github.io/context/vc/examples-ext-v1.jsonld", diff --git a/test/bdd/pkg/v1/oidc4vc/models.go b/test/bdd/pkg/v1/oidc4vc/models.go index 4d2409673..64d17c789 100644 --- a/test/bdd/pkg/v1/oidc4vc/models.go +++ b/test/bdd/pkg/v1/oidc4vc/models.go @@ -111,6 +111,8 @@ type credentialMetadata struct { ExpirationDate *util.TimeWrapper `json:"expirationDate,omitempty"` CustomClaims map[string]map[string]interface{} `json:"customClaims,omitempty"` Attachments []*oidc4vp.Attachment `json:"attachments,omitempty"` + ValidFrom *util.TimeWrapper `json:"validFrom,omitempty"` + ValidUntil *util.TimeWrapper `json:"validUntil,omitempty"` } type retrievedCredentialClaims map[string]credentialMetadata diff --git a/test/stress/go.mod b/test/stress/go.mod index 183c9da39..a394a85e9 100644 --- a/test/stress/go.mod +++ b/test/stress/go.mod @@ -17,11 +17,11 @@ require ( github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f github.com/redis/go-redis/v9 v9.6.1 github.com/samber/lo v1.47.0 - github.com/trustbloc/did-go v1.3.0 + github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 github.com/trustbloc/kms-go v1.1.2 github.com/trustbloc/logutil-go v1.0.0 github.com/trustbloc/sidetree-go v1.0.1-0.20240219121130-f4260aff7104 - github.com/trustbloc/vc-go v1.2.0 + github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 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 f5fd6ab40..c26ce2bf2 100644 --- a/test/stress/go.sum +++ b/test/stress/go.sum @@ -634,16 +634,16 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/trustbloc/bbs-signature-go v1.0.2 h1:gepEsbLiZHv/vva9FKG5gF38mGtOIyGez7desZxiI1o= github.com/trustbloc/bbs-signature-go v1.0.2/go.mod h1:xYotcXHAbcE0TO+SteW0J6XI3geQaXq4wdnXR2k+XCU= -github.com/trustbloc/did-go v1.3.0 h1:vfiY/dewd9cORo3U5c+eoWgNIQnKsuQYn5PV0CRu1o0= -github.com/trustbloc/did-go v1.3.0/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70 h1:5GOoXZcKYDTsobaTCeFUEBjbognYbjBh38fCjkvClU4= +github.com/trustbloc/did-go v1.3.1-0.20240910130808-bf0188fdfe70/go.mod h1:packTRoBoo8DrwOE7QKsI98xXS3Vf6ovUXYD4FUAcB4= github.com/trustbloc/kms-go v1.1.2 h1:nAlhDoHkSyX1eQFRz/sJsdgmJuNadyX7FJEy/9ROwys= github.com/trustbloc/kms-go v1.1.2/go.mod h1:OKOtsLbE6W5s4mpjWkvk8XEqcmt9vTgVmDNkHELpWO0= github.com/trustbloc/logutil-go v1.0.0 h1:KzNs9TRbnmn+M3oYw9UkrtOjNd3ZGO8aLgfYttMypcE= github.com/trustbloc/logutil-go v1.0.0/go.mod h1:JlxT0oZfNKgIlSNtgc001WEeDMxlnAvOM43gNm8DQVc= 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.0 h1:/2blMr1hnw4xwQSO7RwMQC3boVC9ADm39MS+NAAtGoA= -github.com/trustbloc/vc-go v1.2.0/go.mod h1:o14xyB2I5GgJlsrH+Doh6NbKDStGmJ1R5nnlEV781IE= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40 h1:SUz/V2k+Urckdr8Dqg1OJLl0RqkkXW84a0qoopP/i2w= +github.com/trustbloc/vc-go v1.2.1-0.20240912200336-59ce0ee5bb40/go.mod h1:mjjE1cfzbV5s1NTXhi10YceDyg7c+EBl70LUYcX1mYo= 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=