Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create validate_definition.json #94

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
295 changes: 295 additions & 0 deletions web5-test-vectors/validate_definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
{
"description":"Validate definition",
"vectors":[
{
"description":"valid presentation definition 1",
"input":{
"presentationDefinition":{
"id":"test-pd-id",
"name":"simple PD",
"purpose":"pd for testing",
"input_descriptors":[
{
"id":"whatever",
"purpose":"id for testing",
"constraints":{
"fields":[
{
"path":[
"$.vc.credentialSubject.btcAddress",
"$.credentialSubject.btcAddress",
"$.btcAddress"
]
}
]
}
},
{
"id":"whatever2",
"purpose":"id for testing2",
"constraints":{
"fields":[
{
"path":[
"$.vc.credentialSubject.dogeAddress",
"$.credentialSubject.dogeAddress",
"$.dogeAddress"
]
}
]
}
}
]
}
},
"errors":false
},
{
"description":"valid presentation definition 2",
"input":{
"presentationDefinition":{
"id":"presDefIdloanAppVerification123",
"name":"Loan Application Employment Verification",
"purpose":"To verify applicant’s employment, date of birth, and name",
"input_descriptors":[
{
"id":"employmentVerification",
"purpose":"Confirm current employment status",
"constraints":{
"fields":[
{
"path":[
"$.credentialSubject.employmentStatus"
],
"filter":{
"type":"string",
"pattern":"employed"
}
}
]
}
},
{
"id":"dobVerification",
"purpose":"Confirm the applicant’s date of birth",
"constraints":{
"fields":[
{
"path":[
"$.credentialSubject.dateOfBirth"
],
"filter":{
"type":"string",
"format":"date"
}
}
]
}
},
{
"id":"nameVerification",
"purpose":"Confirm the applicant’s legal name",
"constraints":{
"fields":[
{
"path":[
"$.credentialSubject.name"
],
"filter":{
"type":"string"
}
}
]
}
}
]
}
},
"errors":false
},
{
"description":"presentation definition with no id value",
"input":{
"presentationDefinition":{
"id":"",
"name":"simple PD",
"purpose":"purpose",
"input_descriptors":[

]
}
},
"errors":true
},
{
"description":"presentation definition with no name value",
"input":{
"presentationDefinition":{
"id":"test-pd-id",
"name":"",
"purpose":"purpose",
"input_descriptors":[

]
}
},
"errors":true
},
{
"description":"presentation definition with no purpose value",
"input":{
"presentationDefinition":{
"id":"test-pd-id",
"name":"simple PD",
"purpose":"",
"input_descriptors":[

]
}
},
"errors":true
},
{
"description":"duplicate input descriptor ids",
"input":{
"presentationDefinition":{
"id":"test-pd-id",
"name":"simple PD",
"purpose":"pd for testing",
"input_descriptors":[
{
"id":"dupe",
"purpose":"id for testing",
"constraints":{
"fields":[
{
"path":[
"$.vc.credentialSubject.btcAddress",
"$.credentialSubject.btcAddress",
"$.btcAddress"
]
}
]
}
},
{
"id":"dupe",
"purpose":"id for testing2",
"constraints":{
"fields":[
{
"path":[
"$.vc.credentialSubject.dogeAddress",
"$.credentialSubject.dogeAddress",
"$.dogeAddress"
]
}
]
}
}
]
}
},
"errors":true
},
{
"description":"fields have duplicate ids",
"input":{
"presentationDefinition":{
"id":"test-pd-id",
"name":"simple PD",
"purpose":"pd for testing",
"input_descriptors":[
{
"id":"whatever",
"purpose":"id for testing",
"constraints":{
"fields":[
{
"id":"dupe",
"path":[
"$.vc.credentialSubject.btcAddress",
"$.credentialSubject.btcAddress",
"$.btcAddress"
]
}
]
}
},
{
"id":"whatever2",
"purpose":"id for testing2",
"constraints":{
"fields":[
{
"id":"dupe",
"path":[
"$.vc.credentialSubject.dogeAddress",
"$.credentialSubject.dogeAddress",
"$.dogeAddress"
]
}
]
}
}
]
}
},
"errors":true
},
{
"description":"empty path in input descriptor",
"input":{
"presentationDefinition":{
"id":"test-pd-id",
"name":"simple PD",
"purpose":"pd for testing",
"input_descriptors":[
{
"id":"whatever",
"purpose":"id for testing",
"constraints":{
"fields":[
{
"id":"id1",
"path":[

]
}
]
}
}
]
}
},
"errors":true
},
{
"description":"invalid path in input descriptor",
"input":{
"presentationDefinition":{
"id":"test-pd-id",
"name":"simple PD",
"purpose":"pd for testing",
"input_descriptors":[
{
"id":"whatever",
"purpose":"id for testing",
"constraints":{
"fields":[
{
"id":"id1",
"path":[
"$.store.book[(@.price == 10]"
]
}
]
}
}
]
}
},
"errors":true
}
]
}
Loading