diff --git a/test-vectors/did_dht/create.json b/test-vectors/did_dht/create.json new file mode 100644 index 0000000..46ef41d --- /dev/null +++ b/test-vectors/did_dht/create.json @@ -0,0 +1,150 @@ +{ + "description": "did:dht create", + "vectors": [ + { + "description": "creates a did document according to the vector in https://did-dht.com/#vector-1", + "input": { + "identityPublicJwk": { + "kty": "OKP", + "crv": "Ed25519", + "x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE", + "alg": "EdDSA", + "kid": "0" + } + }, + "output": { + "id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo", + "verificationMethod": [ + { + "id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0", + "type": "JsonWebKey", + "controller": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo", + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE", + "alg": "EdDSA", + "kid": "0" + } + } + ], + "authentication": [ + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0" + ], + "assertionMethod": [ + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0" + ], + "capabilityInvocation": [ + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0" + ], + "capabilityDelegation": [ + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0" + ] + } + }, + { + "description": "creates a did document according to the vector in https://did-dht.com/#vector-2", + "input": { + "identityPublicJwk": { + "kty": "OKP", + "crv": "Ed25519", + "x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE", + "alg": "EdDSA", + "kid": "0" + }, + "services": [ + { + "id": "service-1", + "type": "TestService", + "serviceEndpoint": [ + "https://test-service.com/1", + "https://test-service.com/2" + ] + } + ], + "additionalVerificationMethods": [ + { + "jwk": { + "kty": "EC", + "crv": "secp256k1", + "x": "1_o0IKHGNamet8-3VYNUTiKlhVK-LilcKrhJSPHSNP0", + "y": "qzU8qqh0wKB6JC_9HCu8pHE-ZPkDpw4AdJ-MsV2InVY", + "alg": "ES256K", + "kid": "0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw" + }, + "purposes": [ + "assertionMethod", + "capabilityInvocation" + ] + } + ], + "controller": [ + "did:example:abcd" + ], + "alsoKnownAs": [ + "did:example:efgh", + "did:example:ijkl" + ] + }, + "output": { + "id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo", + "controller": "did:example:abcd", + "alsoKnownAs": [ + "did:example:efgh", + "did:example:ijkl" + ], + "verificationMethod": [ + { + "id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0", + "type": "JsonWebKey", + "controller": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo", + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE", + "alg": "EdDSA", + "kid": "0" + } + }, + { + "id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw", + "type": "JsonWebKey", + "controller": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo", + "publicKeyJwk": { + "kty": "EC", + "crv": "secp256k1", + "x": "1_o0IKHGNamet8-3VYNUTiKlhVK-LilcKrhJSPHSNP0", + "y": "qzU8qqh0wKB6JC_9HCu8pHE-ZPkDpw4AdJ-MsV2InVY", + "alg": "ES256K", + "kid": "0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw" + } + } + ], + "authentication": [ + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0" + ], + "assertionMethod": [ + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0", + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw" + ], + "capabilityInvocation": [ + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0", + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw" + ], + "capabilityDelegation": [ + "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0" + ], + "service": [ + { + "id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#service-1", + "type": "TestService", + "serviceEndpoint": [ + "https://test-service.com/1", + "https://test-service.com/2" + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/test-vectors/did_dht/resolve.json b/test-vectors/did_dht/resolve.json new file mode 100644 index 0000000..cbe28f4 --- /dev/null +++ b/test-vectors/did_dht/resolve.json @@ -0,0 +1,41 @@ +{ + "description": "did:dht resolution", + "vectors": [ + { + "description": "methodNotSupported error returned when did method is not dht", + "input": { + "didUri": "did:web:example.com" + }, + "output": { + "didResolutionMetadata": { + "error": "methodNotSupported" + } + }, + "errors": true + }, + { + "description": "notFound error returned when not published", + "input": { + "didUri": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoz" + }, + "output": { + "didResolutionMetadata": { + "error": "notFound" + } + }, + "errors": true + }, + { + "description": "invalidDid error returned for suffix with invalid character", + "input": { + "didUri": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfov" + }, + "output": { + "didResolutionMetadata": { + "error": "invalidDid" + } + }, + "errors": true + } + ] +} \ No newline at end of file diff --git a/test-vectors/presentation_exchange/validate_definition.json b/test-vectors/presentation_exchange/validate_definition.json new file mode 100644 index 0000000..41eb61b --- /dev/null +++ b/test-vectors/presentation_exchange/validate_definition.json @@ -0,0 +1,434 @@ +{ + "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":"input descriptor with empty id", + "input":{ + "presentationDefinition":{ + "id":"test-pd-id", + "name":"name", + "purpose":"purpose", + "input_descriptors":[ + { + "id":"", + "purpose":"Confirm current employment status", + "constraints":{ } + } + ] + } + }, + "errors":true + }, + { + "description":"input descriptor with empty name", + "input":{ + "presentationDefinition":{ + "id":"test-pd-id", + "name":"name", + "purpose":"purpose", + "input_descriptors":[ + { + "id":"id", + "name": "", + "purpose":"purpose", + "constraints":{ } + } + ] + } + }, + "errors":true + }, + { + "description":"input descriptor with empty purpose", + "input":{ + "presentationDefinition":{ + "id":"test-pd-id", + "name":"name", + "purpose":"purpose", + "input_descriptors":[ + { + "id":"id", + "name": "name", + "purpose":"", + "constraints":{ } + } + ] + } + }, + "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 + }, + { + "description":"field id is empty", + "input":{ + "presentationDefinition":{ + "id":"test-pd-id", + "name":"simple PD", + "purpose":"pd for testing", + "input_descriptors":[ + { + "id":"whatever", + "purpose":"id for testing", + "constraints":{ + "fields":[ + { + "id":"", + "path":[ + "$.vc.dob" + ] + } + ] + } + } + ] + } + }, + "errors":true + }, + { + "description":"field purpose is empty", + "input":{ + "presentationDefinition":{ + "id":"test-pd-id", + "name":"simple PD", + "purpose":"pd for testing", + "input_descriptors":[ + { + "id":"whatever", + "purpose":"id for testing", + "constraints":{ + "fields":[ + { + "id":"id", + "purpose": "", + "path":[ + "$.vc.dob" + ] + } + ] + } + } + ] + } + }, + "errors":true + }, + { + "description":"field name is empty", + "input":{ + "presentationDefinition":{ + "id":"test-pd-id", + "name":"simple PD", + "purpose":"pd for testing", + "input_descriptors":[ + { + "id":"whatever", + "purpose":"id for testing", + "constraints":{ + "fields":[ + { + "id":"id", + "name": "", + "path":[ + "$.vc.dob" + ] + } + ] + } + } + ] + } + }, + "errors":true + } + ] +} \ No newline at end of file diff --git a/test-vectors/presentation_exchange/validate_submission.json b/test-vectors/presentation_exchange/validate_submission.json new file mode 100644 index 0000000..f0be9d6 --- /dev/null +++ b/test-vectors/presentation_exchange/validate_submission.json @@ -0,0 +1,243 @@ +{ + "description":"Validate submission", + "vectors":[ + { + "description":"valid simple presentation submission", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + } + ] + } + }, + "errors":false + }, + { + "description":"valid presentation submission with path nested", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]", + "path_nested" : { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]", + "path_nested" : { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + } + } + } + ] + } + }, + "errors":false + }, + { + "description":"valid submission with multiple descriptor map objects", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + }, + { + "id":"descriptor-map-id-2", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + } + ] + } + }, + "errors":false + }, + { + "description":"empty pres submission id", + "input":{ + "presentationSubmission":{ + "id":"", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + } + ] + } + }, + "errors":true + }, + { + "description":"definition id is empty", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + } + ] + } + }, + "errors":true + }, + { + "description":"empty descriptor map", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[] + } + }, + "errors":true + }, + { + "description":"descriptor map has empty id", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + } + ] + } + }, + "errors":true + }, + { + "description":"descriptor map has empty format", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"", + "path": "$.verifiableCredential[0]" + } + ] + } + }, + "errors":true + }, + { + "description":"descriptor map has empty path", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "" + } + ] + } + }, + "errors":true + }, + { + "description":"path nested has different id", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]", + "path_nested" : { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]", + "path_nested" : { + "id":"different-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + } + } + } + ] + } + }, + "errors":true + }, + { + "description":"path nested has invliad path", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]", + "path_nested" : { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]", + "path_nested" : { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.store.book[(@.price == 10]" + } + } + } + ] + } + }, + "errors":true + }, + { + "description":"multiple descriptor map objects have same duplicate id", + "input":{ + "presentationSubmission":{ + "id":"test-submission-id", + "definition_id":"test-definition-id", + "descriptor_map":[ + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + }, + { + "id":"descriptor-map-id", + "format":"jwt_vc", + "path": "$.verifiableCredential[0]" + } + ] + } + }, + "errors":true + } + ] +} \ No newline at end of file