diff --git a/src/main/resources/REST/json/Credential.json b/src/main/resources/REST/json/Credential.json index 1863a9b22a410f275ea1417cdb710620f21c8aa0..260e55f001fbb2e3b36689ffa95eadac4b4c1e96 100644 --- a/src/main/resources/REST/json/Credential.json +++ b/src/main/resources/REST/json/Credential.json @@ -24,7 +24,7 @@ } } }, - "for_proof_gaiax":{ + "for_proof_happypath_gaiax":{ "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "key": "key1", "namespace": "transit", @@ -49,7 +49,7 @@ } } }, - "for_proof_vault":{ + "for_proof_happypath_vault":{ "issuer": "did:web:vault.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "key": "key1", "namespace": "transit", @@ -74,6 +74,31 @@ } } }, + "for_proof_happypath_ssi-dev":{ + "issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "key": "key1", + "namespace": "transit", + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + "https://www.schema.org" + ], + "id": "http://example.edu/credentials/3732", + "type": ["VerifiableCredential", "UniversityDegreeCredential"], + "issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "issuanceDate": "2010-01-01T00:00:00Z", + "credentialSubject": { + "id": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "allow": true, + "num": 123, + "array": { + "txt1": "1", + "txt2": "2" + } + } + } + }, "for_proof_alumni": { "issuer": "http://example.edu/credentials/3732", "key": "key1", diff --git a/src/main/resources/REST/json/Presentation.json b/src/main/resources/REST/json/Presentation.json index 644af572c15341d8f83468f835e7cfc53c2a365d..93ef9bd7e2e7ebfceaec9049493cfc0dc1eb2e98 100644 --- a/src/main/resources/REST/json/Presentation.json +++ b/src/main/resources/REST/json/Presentation.json @@ -44,7 +44,7 @@ ] } }, - "for_proof_gaiax": { + "for_proof_happypath_gaiax": { "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "key": "key1", "namespace": "transit", @@ -89,7 +89,7 @@ ] } }, - "for_proof_vault": { + "for_proof_happypath_vault": { "issuer": "did:web:vault.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", "key": "key1", "namespace": "transit", @@ -134,6 +134,51 @@ ] } }, + "for_proof_happypath_ssi-dev": { + "issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "key": "key1", + "namespace": "transit", + "presentation": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/security/suites/jws-2020/v1" + ], + "id": "did:web:ssi-dev.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", + "https://schema.org" + ], + "credentialSubject": { + "allow": true, + "citizenship": "France", + "age_over": 18, + "id": "https://ssi-dev.vereign.com/tsa/policy/example/ProofRequestResponse/1.0" + }, + "issuanceDate": "2022-07-21T10:24:36.203848291Z", + "issuer": "did:web:ssi-dev.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": "https://vault.vereign.com/tsa/policy/example/ProofRequestResponse/1.0" + }, + "issuanceDate": "2022-07-21T10:24:36.203861194Z", + "issuer": "did:web:vault.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + } + ] + } + }, "for_proof_alumni": { "issuer": "https://example.edu/issuers/565049", "key": "key1", diff --git a/src/test/java/api/test/rest/RestGeneralStepDefinitions.java b/src/test/java/api/test/rest/RestGeneralStepDefinitions.java index 1889de41e97bfe837b9cb9ffbfc49ff7eaad8e06..447c286f73ce3670c6f205f3069dd9b07debbe31 100644 --- a/src/test/java/api/test/rest/RestGeneralStepDefinitions.java +++ b/src/test/java/api/test/rest/RestGeneralStepDefinitions.java @@ -121,22 +121,6 @@ public class RestGeneralStepDefinitions extends BaseStepDefinitions { } } - @Given("^I load the REST request \\{(.*)\\} with profile ENV name \\{(.*)\\}$") - public void I_load_the_REST_request_with_profile_ENV_name(String jsonName, String profileName) throws Throwable { - logger.info("Loading REST json into current request body. Json file= [{}] , profile= [{}]", jsonName, profileName); - String fullProfileName = profileName + "_" + System.getProperty("baseUrl").replace("https://", "").replace(".vereign.com/tsa", ""); - String loadedProfileData = JsonUtils.getProfileFromJson("/REST/json/" + jsonName, fullProfileName); - if (!loadedProfileData.equals("null")) { - currentRequest.setBody(loadedProfileData); - logger.info("SUCCESS - profile loaded."); - } else { - throw new RAFException(String.format("Profile loading FAILED. Value is \"null\". File= [%s] , profile= [%s]", - jsonName, - profileName) - , RestGeneralStepDefinitions.class); - } - } - @Then("^the response is valid according to the \\{(.*?)\\} REST schema$") public void the_response_is_valid_according_to_the_REST_schema(String schemaName) throws Throwable { validateJsonSchema(getLastResponse().getBody(), diff --git a/src/test/java/api/test/rest/tsa/signer/SignerStepDefinitions.java b/src/test/java/api/test/rest/tsa/signer/SignerStepDefinitions.java index b3c284542b8e9ac3d64d2b583c9c3502dd313028..b43fe54e706552d05d845fa6ca64e7a6c4a3275f 100644 --- a/src/test/java/api/test/rest/tsa/signer/SignerStepDefinitions.java +++ b/src/test/java/api/test/rest/tsa/signer/SignerStepDefinitions.java @@ -4,7 +4,9 @@ import api.test.core.BaseStepDefinitions; import api.test.rest.RestGeneralStepDefinitions; import api.test.rest.RestSessionContainer; import core.*; +import cucumber.api.java.en.Given; import cucumber.api.java.en.When; +import exceptions.RAFException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -92,4 +94,20 @@ public class SignerStepDefinitions extends BaseStepDefinitions { addRequest(currentRequest); addResponse(response); } + + @Given("^I load \\{(.*)\\} request for environment \\{(.*)\\} via TSA$") + public void I_load__request_for_environment_via_TSA(String jsonName, String profileName) throws Throwable { + logger.info("Loading REST json into current request body. Json file= [{}] , profile= [{}]", jsonName, profileName); + String fullProfileName = profileName + "_" + System.getProperty("baseUrl").replace("https://", "").replace(".vereign.com/tsa", ""); + String loadedProfileData = JsonUtils.getProfileFromJson("/REST/json/" + jsonName, fullProfileName); + if (!loadedProfileData.equals("null")) { + currentRequest.setBody(loadedProfileData); + logger.info("SUCCESS - profile loaded."); + } else { + throw new RAFException(String.format("Profile loading FAILED. Value is \"null\". File= [%s] , profile= [%s]", + jsonName, + profileName) + , RestGeneralStepDefinitions.class); + } + } } diff --git a/src/test/resources/features/tsa/signer/v1/credential/verify/POST.feature b/src/test/resources/features/tsa/signer/v1/credential/verify/POST.feature index 4599dee9202aecf070f236f39aaceb318cbcfb4d..baa26fb3e096834b4dacf57dd8ef2fc1105e99cc 100644 --- a/src/test/resources/features/tsa/signer/v1/credential/verify/POST.feature +++ b/src/test/resources/features/tsa/signer/v1/credential/verify/POST.feature @@ -26,7 +26,7 @@ Feature: API - TSA - Signer credential verify - v1/credential/verify POST Given we are testing the TSA Signer Api Scenario: TSA - verify credential proof - Positive - When I load the REST request {Credential.json} with profile ENV name {for_proof} + When I load {Credential.json} request for environment {for_proof_happypath} via TSA And I create credential proof via TSA Signer API Then the status code should be {200} And the response is valid according to the {Signer_CredentialProof_schema.json} REST schema 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 9382aa8025c197cfd4a6842b21bb028f728b04dc..499ebcf765789a20f13b0427fa25536b6c26dfba 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 @@ -26,7 +26,7 @@ Feature: API - TSA - Signer presentation verify - v1/presentation/verify POST Given we are testing the TSA Signer Api Scenario: TSA - verify presentation proof - Positive - When I load the REST request {Presentation.json} with profile ENV name {for_proof} + When I load {Presentation.json} request for environment {for_proof_happypath} via TSA 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