Skip to content
Snippets Groups Projects
Unverified Commit 1f79d797 authored by Georgi Michev's avatar Georgi Michev
Browse files

add signer presentation proof tests

parent 6ebdd553
No related branches found
No related tags found
1 merge request!22refactor step definitions
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/security/suites/jws-2020/v1",
"https://www.w3.org/2018/credentials/examples/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://www.w3.org/2018/credentials/examples/v1"
],
"credentialSubject": {
"allow": true,
"id": "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"
}
]
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"@context": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
},
{
"type": "string"
}
]
},
"id": {
"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"
},
{
"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",
"id",
"proof",
"type",
"verifiableCredential"
]
}
\ No newline at end of file
......@@ -47,10 +47,18 @@ public class SignerStepDefinitions extends BaseStepDefinitions {
}
@When("I get issuer DID via TSA Signer API")
public void iGetSignerDIDViaTSASignerAPI() {
public void iGetIssuerDIDViaTSASignerAPI() {
currentRequest.setPath("/v1/issuerDID");
Response response = RestClient.get(currentRequest);
addRequest(currentRequest);
addResponse(response);
}
@When("I validate presentation proof via TSA Signer API")
public void iValidatePresentationProofViaTSASignerAPI() {
currentRequest.setPath("/v1/presentation/proof");
Response response = RestClient.post(currentRequest);
addRequest(currentRequest);
addResponse(response);
}
}
......@@ -17,10 +17,10 @@
#Author: Georgi Michev georgi.michev@vereign.com
@rest @all @tsa @signer
Feature: API -TSA - Signer Issuer DID - v1/keys POST
Feature: API - TSA - Signer Issuer DID - v1/keys GET
As user
I want to see what keys are available
So I am able to use them the future
I want to see who is the issuer of the keys
So I am better informed
Background:
Given we are testing the TSA Signer Api
......
......@@ -17,7 +17,7 @@
#Author: Georgi Michev georgi.michev@vereign.com
@rest @all @tsa @signer
Feature: API -TSA - Signer keys - v1/keys POST
Feature: API - TSA - Signer keys - v1/keys GET
As user
I want to see what keys are available
So I am able to use them the future
......
#Copyright (c) 2018 Vereign AG [https://www.vereign.com]
#
#This is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as
#published by the Free Software Foundation, either version 3 of the
#License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU Affero General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#https://gaiax.vereign.com/tsa/signer/v1/presentation/proof
#Author: Georgi Michev georgi.michev@vereign.com
@rest @all @tsa @signer
Feature: API - TSA - Signer presentation proof - v1/presentation/proof POST
As user
I want to check a presentation proof
So I am sure it is valid
Background:
Given we are testing the TSA Signer Api
Scenario: TSA - validate presentation proof - Positive
When I load the request from json {/REST/json/Presentation.json}
When I validate 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}
@wip @bug-signer-#13
Scenario: TSA - validate presentation proof with empty body - Negative
When I set the following request body {{}}
When I validate presentation proof via TSA Signer API
And the status code should be {400}
And the field {message} has the value {missing required payload}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment