Skip to content
Snippets Groups Projects
Verified Commit 45ebc150 authored by Georgi Michev's avatar Georgi Michev
Browse files

Add tests for VP proofs

The tests should catch an error if any of the VC in the VP has been tampered.
parent df7257a1
No related branches found
No related tags found
1 merge request!37Add tests for VP proofs
Pipeline #60133 passed with stage
in 7 minutes and 8 seconds
......@@ -79,6 +79,80 @@
}]
}
},
"for_proof_with_proofs": {
"issuer": "did:web:gaiax.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:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"type": [
"VerifiablePresentation"
],
"verifiableCredential": [
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.schema.org"
],
"credentialSubject": {
"allow": true,
"array": {
"txt1": "1",
"txt2": "2"
},
"id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"num": 123
},
"id": "http://example.edu/credentials/3732",
"issuanceDate": "2010-01-01T00:00:00Z",
"issuer": "did:web:ssi.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"proof": {
"created": "2023-04-11T08:13:03.38201499Z",
"jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEUCIFEQ_8NbyAyZGsq9wou6lBF9qBz8001ViR48Igtwsa6VAiEApUcE9AVMT-n18JQ4xBsHcFgmdzOX9PIXgqSmpdC98b8",
"proofPurpose": "assertionMethod",
"type": "JsonWebSignature2020",
"verificationMethod": "did:web:ssi.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1"
},
"type": [
"VerifiableCredential",
"UniversityDegreeCredential"
]
},
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.schema.org"
],
"credentialSubject": {
"age_over": 18,
"allow": true,
"citizenship": "France",
"id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation"
},
"id": "http://example.edu/credentials/3732",
"issuanceDate": "2010-01-01T00:00:00Z",
"issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"proof": {
"created": "2023-04-11T08:16:51.645723638Z",
"jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIGxdwsdZ9DGRfUQS1S61baeEIlr6IVehGiaX1oIfFldKAiBUGJEA0ArOR7tVd6MIY4hTJLs4VEnWzJExIvNnt_0qPg",
"proofPurpose": "assertionMethod",
"type": "JsonWebSignature2020",
"verificationMethod": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1"
},
"type": [
"VerifiableCredential",
"UniversityDegreeCredential"
]
}
]
}
},
"for_proof_without_ID": {
"issuer": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"key": "key1",
......@@ -687,5 +761,230 @@
}
]
}
},
"credential_tampered_verification_method":
{
"issuer": "did:web:gaiax.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:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"type": [
"VerifiablePresentation"
],
"verifiableCredential": [
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.schema.org"
],
"credentialSubject": {
"allow": true,
"array": {
"txt1": "1",
"txt2": "2"
},
"id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"num": 123
},
"id": "http://example.edu/credentials/3732",
"issuanceDate": "2010-01-01T00:00:00Z",
"issuer": "did:web:ssi.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"proof": {
"created": "2023-04-11T08:13:03.38201499Z",
"jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEUCIFEQ_8NbyAyZGsq9wou6lBF9qBz8001ViR48Igtwsa6VAiEApUcE9AVMT-n18JQ4xBsHcFgmdzOX9PIXgqSmpdC98b8",
"proofPurpose": "assertionMethod",
"type": "JsonWebSignature2020",
"verificationMethod": "did:web:ssi.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1"
},
"type": [
"VerifiableCredential",
"UniversityDegreeCredential"
]
},
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.schema.org"
],
"credentialSubject": {
"age_over": 18,
"allow": true,
"citizenship": "France",
"id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation"
},
"id": "http://example.edu/credentials/3732",
"issuanceDate": "2010-01-01T00:00:00Z",
"issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"proof": {
"created": "2023-04-11T08:16:51.645723638Z",
"jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIGxdwsdZ9DGRfUQS1S61baeEIlr6IVehGiaX1oIfFldKAiBUGJEA0ArOR7tVd6MIY4hTJLs4VEnWzJExIvNnt_0qPg",
"proofPurpose": "assertionMethod",
"type": "JsonWebSignature2020",
"verificationMethod": "did:web:ssi.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1"
},
"type": [
"VerifiableCredential",
"UniversityDegreeCredential"
]
}
]
}
},
"credential_tampered_created":
{
"issuer": "did:web:gaiax.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:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"type": [
"VerifiablePresentation"
],
"verifiableCredential": [
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.schema.org"
],
"credentialSubject": {
"allow": true,
"array": {
"txt1": "1",
"txt2": "2"
},
"id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"num": 123
},
"id": "http://example.edu/credentials/3732",
"issuanceDate": "2010-01-01T00:00:00Z",
"issuer": "did:web:ssi.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"proof": {
"created": "2022-04-11T08:13:03.38201499Z",
"jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEUCIFEQ_8NbyAyZGsq9wou6lBF9qBz8001ViR48Igtwsa6VAiEApUcE9AVMT-n18JQ4xBsHcFgmdzOX9PIXgqSmpdC98b8",
"proofPurpose": "assertionMethod",
"type": "JsonWebSignature2020",
"verificationMethod": "did:web:ssi.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1"
},
"type": [
"VerifiableCredential",
"UniversityDegreeCredential"
]
},
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.schema.org"
],
"credentialSubject": {
"age_over": 18,
"allow": true,
"citizenship": "France",
"id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation"
},
"id": "http://example.edu/credentials/3732",
"issuanceDate": "2010-01-01T00:00:00Z",
"issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"proof": {
"created": "2023-04-11T08:16:51.645723638Z",
"jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIGxdwsdZ9DGRfUQS1S61baeEIlr6IVehGiaX1oIfFldKAiBUGJEA0ArOR7tVd6MIY4hTJLs4VEnWzJExIvNnt_0qPg",
"proofPurpose": "assertionMethod",
"type": "JsonWebSignature2020",
"verificationMethod": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1"
},
"type": [
"VerifiableCredential",
"UniversityDegreeCredential"
]
}
]
}
},
"credential_tampered_credentialSubject":
{
"issuer": "did:web:gaiax.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:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"type": [
"VerifiablePresentation"
],
"verifiableCredential": [
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.schema.org"
],
"credentialSubject": {
"allow": true,
"array": {
"txt1": "1",
"txt2": "2"
},
"id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"num": 123
},
"id": "http://example.edu/credentials/3732",
"issuanceDate": "2010-01-01T00:00:00Z",
"issuer": "did:web:ssi.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"proof": {
"created": "2023-04-11T08:13:03.38201499Z",
"jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEUCIFEQ_8NbyAyZGsq9wou6lBF9qBz8001ViR48Igtwsa6VAiEApUcE9AVMT-n18JQ4xBsHcFgmdzOX9PIXgqSmpdC98b8",
"proofPurpose": "assertionMethod",
"type": "JsonWebSignature2020",
"verificationMethod": "did:web:ssi.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1"
},
"type": [
"VerifiableCredential",
"UniversityDegreeCredential"
]
},
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.schema.org"
],
"credentialSubject": {
"age_over": 48,
"allow": true,
"citizenship": "France",
"id": "did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation"
},
"id": "http://example.edu/credentials/3732",
"issuanceDate": "2010-01-01T00:00:00Z",
"issuer": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation",
"proof": {
"created": "2023-04-11T08:16:51.645723638Z",
"jws": "eyJhbGciOiJKc29uV2ViU2lnbmF0dXJlMjAyMCIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..MEQCIGxdwsdZ9DGRfUQS1S61baeEIlr6IVehGiaX1oIfFldKAiBUGJEA0ArOR7tVd6MIY4hTJLs4VEnWzJExIvNnt_0qPg",
"proofPurpose": "assertionMethod",
"type": "JsonWebSignature2020",
"verificationMethod": "did:web:ssi-dev.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1"
},
"type": [
"VerifiableCredential",
"UniversityDegreeCredential"
]
}
]
}
}
}
\ 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"
}
]
},
"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"
},
"array": {
"type": "object",
"properties": {
"txt1": {
"type": "string"
},
"txt2": {
"type": "string"
}
},
"required": [
"txt1",
"txt2"
]
},
"id": {
"type": "string"
},
"num": {
"type": "integer"
}
},
"required": [
"allow",
"array",
"id",
"num"
]
},
"id": {
"type": "string"
},
"issuanceDate": {
"type": "string"
},
"issuer": {
"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": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
}
]
}
},
"required": [
"@context",
"credentialSubject",
"id",
"issuanceDate",
"issuer",
"proof",
"type"
]
},
{
"type": "object",
"properties": {
"@context": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
},
{
"type": "string"
}
]
},
"credentialSubject": {
"type": "object",
"properties": {
"age_over": {
"type": "integer"
},
"allow": {
"type": "boolean"
},
"citizenship": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"age_over",
"allow",
"citizenship",
"id"
]
},
"id": {
"type": "string"
},
"issuanceDate": {
"type": "string"
},
"issuer": {
"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": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
}
]
}
},
"required": [
"@context",
"credentialSubject",
"id",
"issuanceDate",
"issuer",
"proof",
"type"
]
}
]
}
},
"required": [
"@context",
"id",
"proof",
"type",
"verifiableCredential"
]
}
\ No newline at end of file
......@@ -33,10 +33,11 @@ Feature: API - TSA - Signer presentation proof - v1/presentation/proof POST
And the field {proof.verificationMethod} has the value {<verificationMethod>}
Examples:
| labelSuffix | profileOption | schema | verificationMethod |
| | for_proof | Signer_PresentationProof_schema.json | did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1 |
| alumni of | for_proof_alumni | Signer_PresentationProof_schema_alumni.json | https://example.edu/issuers/565049#key1 |
| without ID | for_proof_without_ID | Signer_PresentationProof_schema.json | did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1 |
| labelSuffix | profileOption | schema | verificationMethod |
| | for_proof | Signer_PresentationProof_schema.json | did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1 |
| alumni of | for_proof_alumni | Signer_PresentationProof_schema_alumni.json | https://example.edu/issuers/565049#key1 |
| without ID | for_proof_without_ID | Signer_PresentationProof_schema.json | did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1 |
| with proofs | for_proof_with_proofs | Signer_PresentationWithProof_schema.json | did:web:gaiax.vereign.com:tsa:policy:policy:example:returnDID:1.0:evaluation#key1 |
@negative
Scenario: TSA - validate presentation proof with empty body - Negative
......@@ -58,4 +59,17 @@ Feature: API - TSA - Signer presentation proof - v1/presentation/proof POST
Examples:
| labelSuffix | profileOption |
| space | for_proof_incorrect_ID_space |
| symbols | for_proof_incorrect_ID_symbols |
\ No newline at end of file
| symbols | for_proof_incorrect_ID_symbols |
@negative
Scenario Outline: TSA - create presentation proof with tampered credential - Negative
When I load the REST request {Presentation.json} with profile {<profileOption>}
And I create presentation proof via TSA Signer API
Then the status code should be {400}
And the field {message} contains the value {error validating credential}
Examples:
| labelSuffix | profileOption |
| space | credential_tampered_verification_method |
| space | credential_tampered_created |
| space | credential_tampered_credentialSubject |
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment