diff --git a/internal/testutil/contexts/examples_v2.jsonld b/internal/testutil/contexts/examples_v2.jsonld new file mode 100644 index 00000000..035ff6db --- /dev/null +++ b/internal/testutil/contexts/examples_v2.jsonld @@ -0,0 +1,7 @@ +{ + "@context": [ + { + "@vocab": "https://www.w3.org/ns/credentials/examples#" + } + ] +} \ No newline at end of file diff --git a/internal/testutil/document_loader.go b/internal/testutil/document_loader.go index 153f0773..baf8ef80 100644 --- a/internal/testutil/document_loader.go +++ b/internal/testutil/document_loader.go @@ -23,6 +23,8 @@ var ( credentialExamples []byte //go:embed contexts/examples_v1.jsonld vcExamples []byte + //go:embed contexts/examples_v2.jsonld + vcExamplesV2 []byte //go:embed contexts/odrl.jsonld odrl []byte //go:embed contexts/citizenship_v1.jsonld @@ -62,6 +64,10 @@ func DocumentLoader(t *testing.T, extraContexts ...ldcontext.Document) *lddocloa URL: "https://trustbloc.github.io/context/vc/examples-v1.jsonld", Content: vcExamples, }, + { + URL: "https://www.w3.org/ns/credentials/examples/v2", + Content: vcExamplesV2, + }, { URL: "https://www.w3.org/ns/odrl.jsonld", Content: odrl, diff --git a/test/integration/expecteddisplaydata/university_degree_v2.json b/test/integration/expecteddisplaydata/university_degree_v2.json new file mode 100644 index 00000000..8ebb5a95 --- /dev/null +++ b/test/integration/expecteddisplaydata/university_degree_v2.json @@ -0,0 +1,104 @@ +{ + "issuer_display": { + "name": "University Degree Issuer 2.0", + "locale": "en-US" + }, + "credential_displays": [ + { + "overview": { + "name": "University Degree Credential", + "locale": "en-US", + "logo": { + "uri": "https://example.com/public/logo.png", + "alt_text": "a square logo of a degree verification" + }, + "background_color": "#12107c", + "text_color": "#FFFFFF" + }, + "claims": [ + { + "raw_id": "familyName", + "label": "Family Name", + "value_type": "string", + "raw_value": "John Doe", + "locale": "en-US" + }, + { + "raw_id": "givenName", + "label": "Given Name", + "value_type": "string", + "raw_value": "John", + "locale": "en-US" + }, + { + "raw_id": "degree", + "label": "Degree", + "value_type": "string", + "raw_value": "MIT", + "locale": "en-US" + }, + { + "raw_id": "degreeSchool", + "label": "Degree School", + "value_type": "string", + "raw_value": "MIT school", + "locale": "en-US" + }, + { + "raw_id": "photo", + "label": "Photo", + "value_type": "image", + "raw_value": "binary data" + } + ] + }, + { + "overview": { + "name": "University Degree Credential", + "locale": "en-US", + "logo": { + "uri": "https://example.com/public/logo.png", + "alt_text": "a square logo of a degree verification" + }, + "background_color": "#12107c", + "text_color": "#FFFFFF" + }, + "claims": [ + { + "raw_id": "familyName", + "label": "Family Name", + "value_type": "string", + "raw_value": "John Doe", + "locale": "en-US" + }, + { + "raw_id": "givenName", + "label": "Given Name", + "value_type": "string", + "raw_value": "John", + "locale": "en-US" + }, + { + "raw_id": "degree", + "label": "Degree", + "value_type": "string", + "raw_value": "MS", + "locale": "en-US" + }, + { + "raw_id": "degreeSchool", + "label": "Degree School", + "value_type": "string", + "raw_value": "Stanford", + "locale": "en-US" + }, + { + "raw_id": "photo", + "label": "Photo", + "value_type": "image", + "raw_value": "binary data" + } + ] + } + ] +} diff --git a/test/integration/fixtures/file-server/ld-contexts.json b/test/integration/fixtures/file-server/ld-contexts.json index 8400f9d4..45981732 100644 --- a/test/integration/fixtures/file-server/ld-contexts.json +++ b/test/integration/fixtures/file-server/ld-contexts.json @@ -134,6 +134,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": { diff --git a/test/integration/fixtures/profile/profiles.json b/test/integration/fixtures/profile/profiles.json index 550c356a..a736be0e 100644 --- a/test/integration/fixtures/profile/profiles.json +++ b/test/integration/fixtures/profile/profiles.json @@ -1006,6 +1006,145 @@ }, "createDID": true }, + { + "issuer": { + "id": "university_degree_issuer_v2", + "version": "v1.0", + "groupID": "group_university_degree_issuer_v2", + "name": "University Degree Issuer 2.0", + "organizationID": "f13d1va9lp403pb9lyj89vk55", + "url": "http://localhost:8075", + "active": true, + "vcConfig": { + "model": "w3c-vc-2.0", + "refreshServiceEnabled": false, + "signingAlgorithm": "JsonWebSignature2020", + "signatureRepresentation": 0, + "keyType": "ED25519", + "format": "ldp", + "didMethod": "ion", + "status": { + "type": "BitstringStatusListEntry" + } + }, + "dataIntegrityProof": { + "enable": true, + "suiteType": "ecdsa-2019" + }, + "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" + ], + "grant_types_supported": [ + "authorization_code", + "urn:ietf:params:oauth:grant-type:pre-authorized_code" + ], + "response_types_supported": [ + "code" + ], + "token_endpoint_auth_methods_supported": [ + "none" + ], + "pre-authorized_grant_anonymous_access_supported": true + }, + "credentialTemplates": [ + { + "contexts": [ + "https://www.w3.org/ns/credentials/v2", + "https://www.w3.org/ns/credentials/examples/v2" + ], + "type": "UniversityDegreeCredential", + "id": "universityDegreeTemplateID", + "issuer": "did:orb:bank_issuer_v2", + "checks": { + "strict": true + } + } + ], + "credentialMetadata": { + "credential_configurations_supported": { + "UniversityDegreeCredential_ldp_vc_v1": { + "format": "ldp_vc", + "credential_definition": { + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "credentialSubject": { + "familyName": { + "display": [ + { + "name": "Family Name", + "locale": "en-US" + } + ], + "value_type": "string" + }, + "givenName": { + "display": [ + { + "name": "Given Name", + "locale": "en-US" + } + ], + "value_type": "string" + }, + "degree": { + "display": [ + { + "name": "Degree", + "locale": "en-US" + } + ], + "value_type": "string" + }, + "photo": { + "display": [ + { + "name": "Photo" + } + ], + "value_type": "image" + }, + "degreeSchool": { + "display": [ + { + "name": "Degree School", + "locale": "en-US" + } + ], + "value_type": "string" + } + } + }, + "cryptographic_binding_methods_supported": [ + "did" + ], + "credential_signing_alg_values_supported": [ + "Ed25519Signature2018" + ], + "display": [ + { + "name": "University Degree Credential", + "locale": "en-US", + "logo": { + "uri": "https://example.com/public/logo.png", + "alt_text": "a square logo of a degree verification" + }, + "background_color": "#12107c", + "text_color": "#FFFFFF" + } + ] + } + } + } + }, + "createDID": true + }, { "issuer": { "id": "did_ion_issuer", diff --git a/test/integration/openid4ci_test.go b/test/integration/openid4ci_test.go index 7a9666bb..e6021d46 100644 --- a/test/integration/openid4ci_test.go +++ b/test/integration/openid4ci_test.go @@ -56,6 +56,9 @@ var ( //go:embed expecteddisplaydata/university_degree_multi.json expectedUniversityDegreeMulti string + + //go:embed expecteddisplaydata/university_degree_v2.json + expectedUniversityDegreeV2 string ) const ( @@ -231,6 +234,21 @@ func doPreAuthCodeFlowTest(t *testing.T) { expectedDisplayData: helpers.ParseDisplayData(t, expectedUniversityDegreeMulti), expectedIssuerURI: "http://localhost:8075/oidc/idp/university_degree_issuer/v1.0", }, + { + issuerProfileID: "university_degree_issuer_v2", + issuerDIDMethod: "ion", + walletDIDMethod: "ion", + claims: []*claimEntry{ + { + Data: universityDegreeClaims, + }, + { + Data: universityDegreeClaims2, + }, + }, + expectedDisplayData: helpers.ParseDisplayData(t, expectedUniversityDegreeV2), + expectedIssuerURI: "http://localhost:8075/oidc/idp/university_degree_issuer_v2/v1.0", + }, } oidc4ciSetup, err := oidc4ci.NewSetup(testenv.NewHttpRequest()) diff --git a/test/integration/openid4vp_test.go b/test/integration/openid4vp_test.go index 9a15f092..7618cc17 100644 --- a/test/integration/openid4vp_test.go +++ b/test/integration/openid4vp_test.go @@ -178,6 +178,12 @@ func TestOpenID4VPFullFlow(t *testing.T) { verifierProfileID: "v_myprofile_jwt_verified_employee", acknowledgeNoConsent: true, }, + { + issuerProfileIDs: []string{"university_degree_issuer_v2"}, + claimData: []claimData{universityDegreeClaims}, + walletDIDMethod: "ion", + verifierProfileID: "v_ldp_university_degree", + }, } var traceIDs []string