diff --git a/src/main/resources/REST/json/Presentation.json b/src/main/resources/REST/json/Presentation.json index 332786fbcf787d55dedbcf12b04da1ee7b341713..1df59633e66c6165da11099295a626387191e58f 100644 --- a/src/main/resources/REST/json/Presentation.json +++ b/src/main/resources/REST/json/Presentation.json @@ -10,7 +10,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, @@ -25,7 +26,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, @@ -37,6 +39,36 @@ } ] }, + "for_proof_alumni": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "type": "VerifiablePresentation", + "verifiableCredential": [{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/1872", + "type": ["VerifiableCredential", "AlumniCredential"], + "issuer": "https://example.edu/issuers/565049", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "alumniOf": { + "id": "did:example:c276e12ec21ebfeb1f712ebc6f1", + "name": [{ + "value": "Example University", + "lang": "en" + }, { + "value": "Exemple d'Université", + "lang": "fr" + }] + } + } + }] + }, "for_proof_missing_ID": { "@context": [ "https://www.w3.org/2018/credentials/v1", @@ -92,8 +124,8 @@ ], "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "proof": { - "created": "2022-08-03T06:05:59.224982676Z", - "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEUCIG-PwWIzvaxnD_HDabNPWq5K9hOf99WsCAIWhWExSjXtAiEA3TkKOnU3vpK_GqShJeyKei6yfJfgUyUG8UmfLTuBHsU", + "created": "2022-08-03T14:26:51.378442416Z", + "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIDanJ43A79S8p7tGfrHvdLsH6iZWRNv2gQlWtCHboOBaAiBJbZEtYLn2151Q3lv5QnpJcdrPzsyADNbKMmqf-W8CAQ", "proofPurpose": "assertionMethod", "type": "JsonWebSignature2020", "verificationMethod": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1" @@ -103,7 +135,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "age_over": 18, @@ -118,7 +151,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, @@ -137,8 +171,8 @@ ], "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "proof": { - "created": "2022-08-03T06:11:38.170830056Z", - "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEYCIQDJ7gTTZju3fJ-xaCBcWYziuI4J80S19AdxwNl3x4nzIQIhALApZj26dRANZZx5mp6PlChh1TExNc203LFPkHzfCWGk", + "created": "2022-08-03T14:26:51.378442416Z", + "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIDanJ43A79S8p7tGfrHvdLsH6iZWRNv2gQlWtCHboOBaAiBJbZEtYLn2151Q3lv5QnpJcdrPzsyADNbKMmqf-W8CAQ", "proofPurpose": "assertionMethod", "type": "JsonWebSignature2020", "verificationMethod": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1" @@ -148,7 +182,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "age_over": 18, @@ -163,7 +198,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, @@ -227,8 +263,8 @@ ], "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "proof": { - "created": "2022-08-03T06:11:38.170830056Z", - "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEYCIQDJ7gTTZju3fJ-xaCBcWYziuI4J80S19AdxwNl3x4nzIQIhALApZj26dRANZZx5mp6PlChh1TExNc203LFPkHzfCWGk", + "created": "2022-08-03T14:26:51.378442416Z", + "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIDanJ43A79S8p7tGfrHvdLsH6iZWRNv2gQlWtCHboOBaAiBJbZEtYLn2151Q3lv5QnpJcdrPzsyADNbKMmqf-W8CAQ", "proofPurpose": "assertionMethod", "type": "JsonWebSignature2020", "verificationMethod": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1" @@ -238,7 +274,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "age_over": 18, @@ -253,7 +290,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": false, @@ -272,8 +310,8 @@ ], "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "proof": { - "created": "2022-08-03T06:44:14.016800951Z", - "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEYCIQCdpKnxGXPUCZ7fB9QNdZiiKTJ4vIcLudyYtysVOUG7dQIhAMr5DqWP7-lB0cDpDqrdakub38iUZxtxDLVoYO50tLmN", + "created": "2022-08-03T13:50:51.575345046Z", + "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEUCIF7F4sW9tY6bR_Z1bCl4rus_FEDvLbJRKDwmHCkLs5pDAiEAxPkI-TiQh3er_VxR4EdjoG-eYmpp1XpZdKVnvm2xjz8", "proofPurpose": "assertionMethod", "type": "JsonWebSignature2020", "verificationMethod": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1" @@ -283,7 +321,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "age_over": 18, @@ -298,7 +337,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, @@ -317,8 +357,8 @@ ], "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "proof": { - "created": "2022-08-03T06:44:14.016800951Z", - "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEYCIQCdpKnxGXPUCZ7fB9QNdZiiKTJ4vIcLudyYtysVOUG7dQIhAMr5DqWP7-lB0cDpDqrdakub38iUZxtxDLVoYO50tLmN", + "created": "2022-08-03T13:50:51.575345046Z", + "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEUCIF7F4sW9tY6bR_Z1bCl4rus_FEDvLbJRKDwmHCkLs5pDAiEAxPkI-TiQh3er_VxR4EdjoG-eYmpp1XpZdKVnvm2xjz8", "proofPurpose": "assertionMethod", "type": "JsonWebSignature2020", "verificationMethod": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1" @@ -328,13 +368,14 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "age_over": 18, "allow": true, "citizenship": "France", - "id": "invalid_ID" + "id": "https://gaiax.vereign.com/tsa/policy/example/ProofRequestResponse/1.0" }, "issuanceDate": "2022-07-21T10:24:36.203848291Z", "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", @@ -343,11 +384,12 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, - "id": "https://gaiax.vereign.com/tsa/policy/example/ProofRequestResponse/1.0" + "id": "https://gaiax.XXX.com/tsa/policy/example/ProofRequestResponse/1.0" }, "issuanceDate": "2022-07-21T10:24:36.203861194Z", "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", @@ -531,7 +573,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, @@ -546,7 +589,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, @@ -569,7 +613,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, @@ -584,7 +629,8 @@ { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1" + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" ], "credentialSubject": { "allow": true, diff --git a/src/main/resources/REST/schemas/Signer_PresentationProof_schema_alumni.json b/src/main/resources/REST/schemas/Signer_PresentationProof_schema_alumni.json new file mode 100644 index 0000000000000000000000000000000000000000..1a4baaeb69e6dfc5eb00e38b65ff7851bf2fdd8e --- /dev/null +++ b/src/main/resources/REST/schemas/Signer_PresentationProof_schema_alumni.json @@ -0,0 +1,161 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "type": "string" + } + ] + }, + "proof": { + "type": "object", + "properties": { + "created": { + "type": "string" + }, + "jws": { + "type": "string" + }, + "proofPurpose": { + "type": "string" + }, + "type": { + "type": "string" + }, + "verificationMethod": { + "type": "string" + } + }, + "required": [ + "created", + "jws", + "proofPurpose", + "type", + "verificationMethod" + ] + }, + "type": { + "type": "string" + }, + "verifiableCredential": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "type": "string" + } + ] + }, + "credentialSubject": { + "type": "object", + "properties": { + "alumniOf": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "lang": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "lang", + "value" + ] + }, + { + "type": "object", + "properties": { + "lang": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "lang", + "value" + ] + } + ] + } + }, + "required": [ + "id", + "name" + ] + }, + "id": { + "type": "string" + } + }, + "required": [ + "alumniOf", + "id" + ] + }, + "id": { + "type": "string" + }, + "issuanceDate": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "type": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "type": "string" + } + ] + } + }, + "required": [ + "@context", + "credentialSubject", + "id", + "issuanceDate", + "issuer", + "type" + ] + } + ] + } + }, + "required": [ + "@context", + "proof", + "type", + "verifiableCredential" + ] +} \ No newline at end of file diff --git a/src/test/resources/features/tsa/signer/v1/presentation/proof/POST.feature b/src/test/resources/features/tsa/signer/v1/presentation/proof/POST.feature index 965e0ee5a87f52361578d518bf364e6faf56b6b7..9766b75275b33d31bfecdd8772e8c18fe9b6d9f5 100644 --- a/src/test/resources/features/tsa/signer/v1/presentation/proof/POST.feature +++ b/src/test/resources/features/tsa/signer/v1/presentation/proof/POST.feature @@ -32,6 +32,12 @@ Feature: API - TSA - Signer presentation proof - v1/presentation/proof POST And the response is valid according to the {Signer_PresentationProof_schema.json} REST schema And the field {proof.verificationMethod} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1} + Scenario: TSA - create presentation proof - Positive + When I load the REST request {Presentation.json} with profile {for_proof_alumni} + When I create presentation proof via TSA Signer API + And the status code should be {200} + And the response is valid according to the {Signer_PresentationProof_schema_alumni.json} REST schema + Scenario: TSA - create presentation proof missing ID - Positive When I load the REST request {Presentation.json} with profile {for_proof_missing_ID} When I create presentation proof via TSA Signer API diff --git a/src/test/resources/features/tsa/signer/v1/presentation/verify/POST.feature b/src/test/resources/features/tsa/signer/v1/presentation/verify/POST.feature index 33fd91234942b62c54d7c95ecdd2dd1a7f17d430..67c77bfee8c27fd07bf483265b5bf2bf0fb7e78e 100644 --- a/src/test/resources/features/tsa/signer/v1/presentation/verify/POST.feature +++ b/src/test/resources/features/tsa/signer/v1/presentation/verify/POST.feature @@ -38,12 +38,6 @@ Feature: API - TSA - Signer presentation verify - v1/presentation/verify POST @negative Scenario: TSA - verify presentation proof with missing proof - Negative - When I load the REST request {Presentation.json} with profile {for_proof} - When I create presentation proof via TSA Signer API - And the status code should be {200} - And the response is valid according to the {Signer_PresentationProof_schema.json} REST schema - And the field {proof.verificationMethod} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1} - Then I get the last response body and load it to the current request body When I load the REST request {Presentation.json} with profile {missing_proof} And I verify presentation proof via TSA Signer API And the status code should be {400} @@ -51,12 +45,6 @@ Feature: API - TSA - Signer presentation verify - v1/presentation/verify POST @negative Scenario: TSA - verify presentation proof with modified ID field - Negative - When I load the REST request {Presentation.json} with profile {for_proof} - When I create presentation proof via TSA Signer API - And the status code should be {200} - And the response is valid according to the {Signer_PresentationProof_schema.json} REST schema - And the field {proof.verificationMethod} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1} - Then I get the last response body and load it to the current request body When I load the REST request {Presentation.json} with profile {modified_ID} And I verify presentation proof via TSA Signer API And the status code should be {400} @@ -64,51 +52,27 @@ Feature: API - TSA - Signer presentation verify - v1/presentation/verify POST @negative Scenario: TSA - verify presentation proof with modified issuanceDate field - Negative - When I load the REST request {Presentation.json} with profile {for_proof} - When I create presentation proof via TSA Signer API - And the status code should be {200} - And the response is valid according to the {Signer_PresentationProof_schema.json} REST schema - And the field {proof.verificationMethod} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1} - Then I get the last response body and load it to the current request body When I load the REST request {Presentation.json} with profile {modified_issuanceDate} And I verify presentation proof via TSA Signer API And the status code should be {400} And the field {message} has the value {check embedded proof: check linked data proof: ecdsa: invalid signature} - @wip @negative + @negative Scenario: TSA - verify presentation proof with modified first credentialSubject.allow field - Negative - When I load the REST request {Presentation.json} with profile {for_proof} - When I create presentation proof via TSA Signer API - And the status code should be {200} - And the response is valid according to the {Signer_PresentationProof_schema.json} REST schema - And the field {proof.verificationMethod} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1} - Then I get the last response body and load it to the current request body When I load the REST request {Presentation.json} with profile {modified_credentialSubject_1_allow} And I verify presentation proof via TSA Signer API -# And the status code should be {400} -# And the field {message} has the value {check embedded proof: check linked data proof: ecdsa: invalid signature} + And the status code should be {400} + And the field {message} has the value {check embedded proof: check linked data proof: ecdsa: invalid signature} - @wip @bug-signer#20 @negative + @negative Scenario: TSA - verify presentation proof with modified second credentialSubject.allow field - Negative - When I load the REST request {Presentation.json} with profile {for_proof} - When I create presentation proof via TSA Signer API - And the status code should be {200} - And the response is valid according to the {Signer_PresentationProof_schema.json} REST schema - And the field {proof.verificationMethod} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1} - Then I get the last response body and load it to the current request body When I load the REST request {Presentation.json} with profile {modified_credentialSubject_2_allow} And I verify presentation proof via TSA Signer API -# And the status code should be {400} -# And the field {message} has the value {check embedded proof: check linked data proof: ecdsa: invalid signature} + And the status code should be {400} + And the field {message} has the value {check embedded proof: check linked data proof: ecdsa: invalid signature} @negative Scenario: TSA - verify presentation proof with modified first credentialSubject.ID field - Negative - When I load the REST request {Presentation.json} with profile {for_proof} - When I create presentation proof via TSA Signer API - And the status code should be {200} - And the response is valid according to the {Signer_PresentationProof_schema.json} REST schema - And the field {proof.verificationMethod} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1} - Then I get the last response body and load it to the current request body When I load the REST request {Presentation.json} with profile {modified_credentialSubject_1_ID} And I verify presentation proof via TSA Signer API And the status code should be {400} @@ -116,12 +80,6 @@ Feature: API - TSA - Signer presentation verify - v1/presentation/verify POST @negative Scenario: TSA - verify presentation proof with modified second credentialSubject.ID field - Negative - When I load the REST request {Presentation.json} with profile {for_proof} - When I create presentation proof via TSA Signer API - And the status code should be {200} - And the response is valid according to the {Signer_PresentationProof_schema.json} REST schema - And the field {proof.verificationMethod} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1} - Then I get the last response body and load it to the current request body When I load the REST request {Presentation.json} with profile {modified_credentialSubject_2_ID} And I verify presentation proof via TSA Signer API And the status code should be {400}