diff --git a/src/main/resources/REST/json/Credential.json b/src/main/resources/REST/json/Credential.json index 90acfcfd468aa351e2f00750e5f24de35f90ca4d..2ebfe51b8e88194df9fdd31a45cc239f9ec66dec 100644 --- a/src/main/resources/REST/json/Credential.json +++ b/src/main/resources/REST/json/Credential.json @@ -1,15 +1,50 @@ { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/security/suites/jws-2020/v1", - "https://www.w3.org/2018/credentials/examples/v1" - ], - "credentialSubject": { - "allow": true, - "hello": "world", - "id": "example/examplePolicy/1.0" + "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", + "https://schema.org" + ], + "credentialSubject": { + "allow": true, + "id": "https://gaiax.vereign.com/tsa/policy/example/examplePolicy/1.0" + }, + "issuanceDate": "2022-07-01T11:07:57.975459274Z", + "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", + "type": "VerifiableCredential" + } + ] }, - "issuanceDate": "2022-07-01T13:29:47.578628068Z", - "issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation", - "type": "VerifiableCredential" + "incorrect_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", + "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": "ZZZZZZZZZZZZZZZ" + }, + "issuanceDate": "2022-07-01T11:07:57.975459274Z", + "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/Signer_CredentialProof_schema.json b/src/main/resources/REST/schemas/Signer_CredentialProof_schema.json index 50182c1b1bebe87efb5463f7cc88a542f5605188..23a7e9c24126cf981be9989e6739e5d00a00bdbc 100644 --- a/src/main/resources/REST/schemas/Signer_CredentialProof_schema.json +++ b/src/main/resources/REST/schemas/Signer_CredentialProof_schema.json @@ -8,34 +8,15 @@ { "type": "string" }, - { - "type": "string" - }, { "type": "string" } ] }, "credentialSubject": { - "type": "object", - "properties": { - "allow": { - "type": "boolean" - }, - "hello": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "allow", - "hello", - "id" - ] + "type": "null" }, - "issuanceDate": { + "id": { "type": "string" }, "issuer": { @@ -70,14 +51,70 @@ }, "type": { "type": "string" + }, + "verifiableCredential": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ] + }, + "credentialSubject": { + "type": "object", + "properties": { + "allow": { + "type": "boolean" + }, + "id": { + "type": "string" + } + }, + "required": [ + "allow", + "id" + ] + }, + "issuanceDate": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "@context", + "credentialSubject", + "issuanceDate", + "issuer", + "type" + ] + } + ] } }, "required": [ "@context", "credentialSubject", - "issuanceDate", + "id", "issuer", "proof", - "type" + "type", + "verifiableCredential" ] } \ No newline at end of file diff --git a/src/test/resources/features/tsa/signer/v1/credential/proof/POST.feature b/src/test/resources/features/tsa/signer/v1/credential/proof/POST.feature index 19b959c569f75e35d2c6fa2e21bcbbb16082411e..54f282bfef53b9494a328f44b687f539e73e2403 100644 --- a/src/test/resources/features/tsa/signer/v1/credential/proof/POST.feature +++ b/src/test/resources/features/tsa/signer/v1/credential/proof/POST.feature @@ -26,7 +26,7 @@ Feature: API - TSA - Signer credential proof - v1/credential/proof POST Given we are testing the TSA Signer Api Scenario: TSA - create credential proof - Positive - When I load the request from json {/REST/json/Credential.json} + When I load the REST request {Credential.json} with profile {for_proof} When I create credential proof via TSA Signer API And the status code should be {200} And the response is valid according to the {Signer_CredentialProof_schema.json} REST schema @@ -36,4 +36,5 @@ Feature: API - TSA - Signer credential proof - v1/credential/proof POST Scenario: TSA - validate credential proof with empty body - Negative When I set the following request body {{}} When I create credential 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} + And the field {message} has the value {build new credential: fill credential types from raw: credential type of unknown structure}