diff --git a/src/main/resources/REST/json/Infohub.json b/src/main/resources/REST/json/Infohub.json index 869c2778317d4db07531b3e4e0942f5c058bab89..7477620d1da06b56f25c3cc3140ae6f4be060d5b 100644 --- a/src/main/resources/REST/json/Infohub.json +++ b/src/main/resources/REST/json/Infohub.json @@ -2,13 +2,12 @@ "successful_import": { "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1", - "https://www.w3.org/2018/credentials/examples/v1" + "https://w3id.org/security/suites/jws-2020/v1" ], "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "proof": { - "created": "2022-07-08T09:23:43.073435032Z", - "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEYCIQCSmaYCbM8RweOXO1Vauz7F5taH9xnRKtcmkTkrhxw9DQIhAMhLuFBqk5JvYstemhdBGc81Ie3zOl00m_5CmfUd7OtO", + "created": "2022-08-02T13:37:23.968398678Z", + "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEUCIH5tUuKsOX8mvAqvUSHdImQquWt9DbgG-_5EUk9CEchgAiEAwLZIXGsjTPF5NmQl_ABQqFe98jojkgx1vOT7yc5O6ms", "proofPurpose": "assertionMethod", "type": "JsonWebSignature2020", "verificationMethod": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1" @@ -19,13 +18,14 @@ "@context": [ "https://www.w3.org/2018/credentials/v1", "https://w3id.org/security/suites/jws-2020/v1", - "https://www.w3.org/2018/credentials/examples/v1" + "https://schema.org" ], "credentialSubject": { "allow": true, - "id": "example/examplePolicy/1.0" + "name": "pass", + "num": 123 }, - "issuanceDate": "2022-07-08T09:23:43.006994232Z", + "issuanceDate": "2022-07-21T10:24:36.203848291Z", "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "type": "VerifiableCredential" }, @@ -33,13 +33,157 @@ "@context": [ "https://www.w3.org/2018/credentials/v1", "https://w3id.org/security/suites/jws-2020/v1", - "https://www.w3.org/2018/credentials/examples/v1" + "https://schema.org" ], "credentialSubject": { "allow": true, - "id": "example/ProofRequestResponse/1.0" + "array": [ + { + "num1": 1, + "num2": 2 + }, + { + "txt1": "1", + "txt2": "2" + } + ] }, - "issuanceDate": "2022-07-08T09:23:43.006998385Z", + "issuanceDate": "2022-07-21T10:24:36.203861194Z", + "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + } + ] + }, + "successful_import_ID": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "proof": { + "created": "2022-08-02T13:20:07.281542082Z", + "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIHdx3Womv8y4GRzYiso1iKCJnjqNsRZ-dGi545SEYcWNAiAdWqUo0CPqqMLjWBfRsdpSZngnysOBUIOTdlMbPLm5mw", + "proofPurpose": "assertionMethod", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1" + }, + "type": "VerifiablePresentation", + "verifiableCredential": [ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" + ], + "credentialSubject": { + "allow": true, + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation" + }, + "issuanceDate": "2022-07-21T10:24:36.203848291Z", + "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + }, + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" + ], + "credentialSubject": { + "allow": true, + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation" + }, + "issuanceDate": "2022-07-21T10:24:36.203861194Z", + "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + } + ] + }, + "modified_ID": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "proof": { + "created": "2022-08-02T13:20:07.281542082Z", + "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIHdx3Womv8y4GRzYiso1iKCJnjqNsRZ-dGi545SEYcWNAiAdWqUo0CPqqMLjWBfRsdpSZngnysOBUIOTdlMbPLm5mw", + "proofPurpose": "assertionMethod", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1" + }, + "type": "VerifiablePresentation", + "verifiableCredential": [ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" + ], + "credentialSubject": { + "allow": true, + "id": "did:web::gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation" + }, + "issuanceDate": "2022-07-21T10:24:36.203848291Z", + "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + }, + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" + ], + "credentialSubject": { + "allow": true, + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation" + }, + "issuanceDate": "2022-07-21T10:24:36.203861194Z", + "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + } + ] + }, + "modified_allow": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "proof": { + "created": "2022-08-02T13:20:07.281542082Z", + "jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIHdx3Womv8y4GRzYiso1iKCJnjqNsRZ-dGi545SEYcWNAiAdWqUo0CPqqMLjWBfRsdpSZngnysOBUIOTdlMbPLm5mw", + "proofPurpose": "assertionMethod", + "type": "JsonWebSignature2020", + "verificationMethod": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1" + }, + "type": "VerifiablePresentation", + "verifiableCredential": [ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" + ], + "credentialSubject": { + "allow": false, + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation" + }, + "issuanceDate": "2022-07-21T10:24:36.203848291Z", + "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + }, + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1", + "https://schema.org" + ], + "credentialSubject": { + "allow": true, + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation" + }, + "issuanceDate": "2022-07-21T10:24:36.203861194Z", "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "type": "VerifiableCredential" } diff --git a/src/main/resources/REST/json/Presentation.json b/src/main/resources/REST/json/Presentation.json index 1779b1cd1c44447376657d9285ed2cad358690bb..39f87c935b3b06b1ed74fe5cc587409c6f3d0fc1 100644 --- a/src/main/resources/REST/json/Presentation.json +++ b/src/main/resources/REST/json/Presentation.json @@ -1,5 +1,43 @@ { "for_proof": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiablePresentation", + "verifiableCredential": [ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "credentialSubject": { + "allow": true, + "citizenship": "France", + "age_over": 18, + "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", + "type": "VerifiableCredential" + }, + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "credentialSubject": { + "allow": true, + "id": "https://gaiax.vereign.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", + "type": "VerifiableCredential" + } + ] + }, + "for_proof_missing_ID": { "@context": [ "https://www.w3.org/2018/credentials/v1", "https://w3id.org/security/suites/jws-2020/v1" @@ -15,7 +53,8 @@ ], "credentialSubject": { "allow": true, - "id": "https://gaiax.vereign.com/tsa/policy/example/ProofRequestResponse/1.0" + "num": 1234, + "type": "pass" }, "issuanceDate": "2022-07-21T10:24:36.203848291Z", "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", @@ -29,7 +68,16 @@ ], "credentialSubject": { "allow": true, - "id": "https://gaiax.vereign.com/tsa/policy/example/ProofRequestResponse/1.0" + "array": [ + { + "num1": 1, + "num2": 2 + }, + { + "txt1": "1", + "txt2": "2" + } + ] }, "issuanceDate": "2022-07-21T10:24:36.203861194Z", "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", @@ -475,5 +523,119 @@ "type": "VerifiableCredential" } ] + }, + "for_proof_incorrect_ID_path": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiablePresentation", + "verifiableCredential": [ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "credentialSubject": { + "allow": true, + "citizenship": "France", + "age_over": 18, + "id": "/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", + "type": "VerifiableCredential" + }, + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "credentialSubject": { + "allow": true, + "id": "https://gaiax.vereign.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", + "type": "VerifiableCredential" + } + ] + }, + "for_proof_incorrect_ID_space": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiablePresentation", + "verifiableCredential": [ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "credentialSubject": { + "allow": true, + "citizenship": "France", + "age_over": 18, + "id": " " + }, + "issuanceDate": "2022-07-21T10:24:36.203848291Z", + "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + }, + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "credentialSubject": { + "allow": true, + "id": "https://gaiax.vereign.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", + "type": "VerifiableCredential" + } + ] + }, + "for_proof_incorrect_ID_symbols": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiablePresentation", + "verifiableCredential": [ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "credentialSubject": { + "allow": true, + "citizenship": "France", + "age_over": 18, + "id": ":" + }, + "issuanceDate": "2022-07-21T10:24:36.203848291Z", + "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + }, + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "credentialSubject": { + "allow": true, + "id": "https://gaiax.vereign.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", + "type": "VerifiableCredential" + } + ] } } \ No newline at end of file diff --git a/src/main/resources/REST/schemas/Infohub_Export_schema.json b/src/main/resources/REST/schemas/Infohub_Export_schema.json index 293ca617533c83eb8bfad5959502f440c23a88e4..42b3596f2cc20fc0ff11d9c5846c66c89da4862d 100644 --- a/src/main/resources/REST/schemas/Infohub_Export_schema.json +++ b/src/main/resources/REST/schemas/Infohub_Export_schema.json @@ -74,14 +74,10 @@ "properties": { "allow": { "type": "boolean" - }, - "id": { - "type": "string" } }, "required": [ - "allow", - "id" + "allow" ] }, "issuanceDate": { @@ -124,14 +120,10 @@ "properties": { "allow": { "type": "boolean" - }, - "id": { - "type": "string" } }, "required": [ - "allow", - "id" + "allow" ] }, "issuanceDate": { diff --git a/src/main/resources/REST/schemas/Signer_PresentationProof_schema.json b/src/main/resources/REST/schemas/Signer_PresentationProof_schema.json index 427c92b10631b053145e5da575828e6f60d0c2e0..219f1ff44ccbb1f2c67393cd5137abfee64a45a8 100644 --- a/src/main/resources/REST/schemas/Signer_PresentationProof_schema.json +++ b/src/main/resources/REST/schemas/Signer_PresentationProof_schema.json @@ -74,14 +74,10 @@ "properties": { "allow": { "type": "boolean" - }, - "id": { - "type": "string" } }, "required": [ - "allow", - "id" + "allow" ] }, "issuanceDate": { diff --git a/src/test/resources/features/tsa/cache/v1/cache/GET.feature b/src/test/resources/features/tsa/cache/v1/cache/GET.feature index ca6f8c486a839185945ba5062e85796fb15151ff..5ddbbc6014361746cccfbc38681c3374376b8a0f 100644 --- a/src/test/resources/features/tsa/cache/v1/cache/GET.feature +++ b/src/test/resources/features/tsa/cache/v1/cache/GET.feature @@ -71,7 +71,7 @@ Feature: API -TSA - Cache - v1/cache GET Scenario: TSA - Check the Cache after importing data to Infohub - Positive Given we are testing the TSA Infohub Api - When I load the REST request {Infohub.json} with profile {successful_import} + When I load the REST request {Infohub.json} with profile {successful_import_ID} And I import data via TSA Infohub API Then the status code should be {200} ## Checking the cache service with Import IDs @@ -79,8 +79,8 @@ Feature: API -TSA - Cache - v1/cache GET Then I load element {0} from Info SessionContainer into currentRequest HEADER {x-cache-key} When I send the Cache GET request via TSA Cache API And the field {allow} has the value {true} - And the field {id} has the value {example/examplePolicy/1.0} + And the field {id} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation} Then I load element {1} from Info SessionContainer into currentRequest HEADER {x-cache-key} When I send the Cache GET request via TSA Cache API And the field {allow} has the value {true} - And the field {id} has the value {example/ProofRequestResponse/1.0} + And the field {id} has the value {did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation} diff --git a/src/test/resources/features/tsa/infohub/v1/import/POST.feature b/src/test/resources/features/tsa/infohub/v1/import/POST.feature index fd2d19f8b897e187e7b0b2ddf9a37fe00ea0f690..b1f977fa23233219566f4476b397fa2df9d6175d 100644 --- a/src/test/resources/features/tsa/infohub/v1/import/POST.feature +++ b/src/test/resources/features/tsa/infohub/v1/import/POST.feature @@ -31,9 +31,26 @@ Feature: API - TSA - Infohub - v1/export POST Then the status code should be {200} And the response is valid according to the {Infohub_Import_schema.json} REST schema - @wip @bug-signer-#13 @negative + Scenario: TSA - Import data with ID to Infohub - Positive + When I load the REST request {Infohub.json} with profile {successful_import_ID} + And I import data via TSA Infohub API + Then the status code should be {200} + And the response is valid according to the {Infohub_Import_schema.json} REST schema + + @negative + Scenario: TSA - Import data with modified ID to Infohub - Negative + When I load the REST request {Infohub.json} with profile {modified_ID} + And I import data via TSA Infohub API + Then the status code should be {400} + + @negative + Scenario: TSA - Import data with modified ID to Infohub - Negative + When I load the REST request {Infohub.json} with profile {modified_allow} + And I import data via TSA Infohub API + Then the status code should be {400} + + @negative Scenario: TSA - Import empty data to Infohub - Negative When I set the following request body {{}} And I import data via TSA Infohub API - And the status code should be {400} - And the field {message} has the value {missing required payload} + And the status code should be {400} \ 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 31ed9b5c37c7ae5c27493b277f435cc943ff4a66..965e0ee5a87f52361578d518bf364e6faf56b6b7 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,8 +32,29 @@ 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 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 + 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} + @negative Scenario: TSA - validate presentation proof with empty body - Negative When I set the following request body {{}} When I create presentation proof via TSA Signer API - And the status code should be {400} \ No newline at end of file + And the status code should be {400} + + @negative + Scenario: TSA - create presentation proof with incorrect ID (space) - Negative + When I load the REST request {Presentation.json} with profile {for_proof_incorrect_ID_space} + When I create presentation proof via TSA Signer API + And the status code should be {400} + And the field {message} has the value {invalid format of subject id} + + @negative + Scenario: TSA - create presentation proof with incorrect ID (symbols) - Negative + When I load the REST request {Presentation.json} with profile {for_proof_incorrect_ID_symbols} + When I create presentation proof via TSA Signer API + And the status code should be {400} + And the field {message} has the value {invalid format of subject id}