diff --git a/web5-test-vectors/credentials/README.md b/web5-test-vectors/credentials/README.md new file mode 100644 index 0000000..6d91685 --- /dev/null +++ b/web5-test-vectors/credentials/README.md @@ -0,0 +1,51 @@ +# `credentials` Test Vectors + +This directory contains test vectors for the `credentials` module. It's important to note that the test vectors ensure +that +the implementations are following the [Verifiable Credential 1.1 specification](https://www.w3.org/TR/vc-data-model/). + +## `create` + +Create test vectors are available for [success](./create_success.json) and [failure](./create_failure.json) test cases. + +### Input + +The value of `input` is an object with the following properties. + +| Property | Description | +|--------------------|--------------------------------------------------------------------------------------------------------------------------| +| `signerDidUri` | the did uri that will be used to sign the verifiable credential created. | +| `signerPrivateJwk` | Json Web Key object associated with the `signerDidUri` which will be used for signing `credential`. | +| `credential` | A JSON object that represents a Verifiable Credential 1.1 according to the [spec](https://www.w3.org/TR/vc-data-model/). | + +### Output + +The value of `output` is a Verifiable Credential 1.1 encoded as a JSON Web Token ( +see [here](https://www.w3.org/TR/vc-data-model/#json-web-token) for more details). The signature is created using +the `signerPrivateJwk` private key. + +### Reference implementations + +The reference implementations for: +* `create_success` can be found [here](https://github.com/TBD54566975/web5-kt/blob/466e8d8ca9771ae3a98767e5a4a79ac7b1e7a5d8/credentials/src/test/kotlin/web5/sdk/credentials/VerifiableCredentialTest.kt#L244). +* `create_failure` can be found [here](https://github.com/TBD54566975/web5-kt/blob/466e8d8ca9771ae3a98767e5a4a79ac7b1e7a5d8/credentials/src/test/kotlin/web5/sdk/credentials/VerifiableCredentialTest.kt#L285). + +## `verify` + +Verify test vectors are available for [success](./verify_success.json) and [failure](./verify_failure.json) test cases. + +### Input + +The value of `input` is an object with the single property `vcJwt`. The value of `vcJwt` is a Verifiable Credential 1.1 +encoded as a JSON Web Token (see [here](https://www.w3.org/TR/vc-data-model/#json-web-token) for more details). + +### Output + +Output is empty, signalling that no exception nor errors should be thrown for success cases. For failure cases, the +`errors` property is set to `true`, signalling that an exception or an error should be returned or thrown. + +### Reference implementations + +The reference implementations for: +* `verify_success` can be found [here](https://github.com/TBD54566975/web5-kt/blob/466e8d8ca9771ae3a98767e5a4a79ac7b1e7a5d8/credentials/src/test/kotlin/web5/sdk/credentials/VerifiableCredentialTest.kt#L261). +* `verify_failure` can be found [here](https://github.com/TBD54566975/web5-kt/blob/466e8d8ca9771ae3a98767e5a4a79ac7b1e7a5d8/credentials/src/test/kotlin/web5/sdk/credentials/VerifiableCredentialTest.kt#L273). \ No newline at end of file diff --git a/web5-test-vectors/credentials/create_failure.json b/web5-test-vectors/credentials/create_failure.json new file mode 100644 index 0000000..f89d765 --- /dev/null +++ b/web5-test-vectors/credentials/create_failure.json @@ -0,0 +1,553 @@ +{ + "description": "verifiable credential 1.1 signing", + "vectors": [ + { + "description": "bad no credential subject", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/58473", + "type": [ + "VerifiableCredential", + "AlumniCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad missing context", + "input": { + "credential": { + "@context": [ + ], + "id": "http://example.edu/credentials/58473", + "type": [ + "VerifiableCredential", + "AlumniCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "alumniOf": "Example University" + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad first context item", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/examples/v1", + "https://www.w3.org/2018/credentials/v1" + ], + "id": "http://example.edu/credentials/58473", + "type": [ + "VerifiableCredential", + "AlumniCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "alumniOf": "Example University" + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad multiple id values", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": [ + "http://example.edu/credentials/3731", + "http://example.edu/credentials/3732" + ], + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad id must be a uri", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "example", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad type must have at least one value", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad type must have VerifiableCredential as first value", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad issuance date", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "01/01/2010", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad multiple issuers", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": [ + "https://example.edu/issuers/14", + "https://example.edu/issuers/20" + ], + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad issuer must be uri", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "example", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad issuer as object without id", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": {}, + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad issuer as numeric id", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": 12345, + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad missing issuance date", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad missing issuer", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad expiration date with multiple values", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "expirationDate": [ + "2020-01-01T19:23:24Z", + "2021-01-01T19:23:24Z" + ], + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad expiration date value", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "expirationDate": "01/01/2020", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad credential status with missing id", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "credentialStatus": { + "type": "CredentialStatusList2017" + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad credential status with missing type", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "credentialStatus": { + "id": "https://example.edu/status/24" + }, + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + }, + { + "description": "bad credential status as a string", + "input": { + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1" + ], + "id": "http://example.edu/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu/issuers/14", + "issuanceDate": "2010-01-01T19:23:24Z", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science in Mechanical Engineering" + } + }, + "credentialStatus": "false", + "proof": { + "type": "RsaSignature2018" + } + } + }, + "errors": true + } + ] +} \ No newline at end of file diff --git a/web5-test-vectors/credentials/create_success.json b/web5-test-vectors/credentials/create_success.json new file mode 100644 index 0000000..884d29f --- /dev/null +++ b/web5-test-vectors/credentials/create_success.json @@ -0,0 +1,73 @@ +{ + "description": "verifiable credential 1.1 signing", + "vectors": [ + { + "description": "creates a verifiable credential as a jwt with a did:key", + "input": { + "signerDidUri": "did:key:zQ3shNLt1aMWPbWRGa8VoeEbJofJ7xJe4FCPpDKxq1NZygpiy", + "signerPrivateJwk": { + "kty": "EC", + "d": "OeBCt3M8roz9F9Ny192TtZXf_-qPzAkwSM6ep7QdSO4", + "use": "sig", + "crv": "secp256k1", + "kid": "NB_qlUIr06-AikVVMFreq0lc-omQtzc6lwhhcvgO6r4", + "x": "DdtN8W6x_34pB_nkxR0e1tmDkNnsJeusBAEPzKWgf_Y", + "y": "u3W135inodLqtcEb9jNGS3JsM_uFKmkJSb8Trc9luWI", + "alg": "ES256K" + }, + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1" + ], + "type": [ + "VerifiableCredential", + "StreetCred" + ], + "id": "urn:uuid:6c8bbcf4-87af-449a-9bfb-30bf29976227", + "issuer": "did:key:zQ3shNLt1aMWPbWRGa8VoeEbJofJ7xJe4FCPpDKxq1NZygpiy", + "issuanceDate": "2023-11-30T00:03:13Z", + "credentialSubject": { + "id": "did:key:zQ3shkpavjKRewoBk6arPJnhA87ZzhLDEWgVvZKNHK6QqVJDB", + "localRespect": "high", + "legit": true + } + } + }, + "output": "eyJraWQiOiJkaWQ6a2V5OnpRM3NoTkx0MWFNV1BiV1JHYThWb2VFYkpvZko3eEplNEZDUHBES3hxMU5aeWdwaXkjelEzc2hOTHQxYU1XUGJXUkdhOFZvZUViSm9mSjd4SmU0RkNQcERLeHExTlp5Z3BpeSIsInR5cCI6IkpXVCIsImFsZyI6IkVTMjU2SyJ9.eyJpc3MiOiJkaWQ6a2V5OnpRM3NoTkx0MWFNV1BiV1JHYThWb2VFYkpvZko3eEplNEZDUHBES3hxMU5aeWdwaXkiLCJzdWIiOiJkaWQ6a2V5OnpRM3Noa3BhdmpLUmV3b0JrNmFyUEpuaEE4N1p6aExERVdnVnZaS05ISzZRcVZKREIiLCJpYXQiOjE3MDEzMDI1OTMsInZjIjp7Imlzc3VhbmNlRGF0ZSI6IjIwMjMtMTEtMzBUMDA6MDM6MTNaIiwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6a2V5OnpRM3Noa3BhdmpLUmV3b0JrNmFyUEpuaEE4N1p6aExERVdnVnZaS05ISzZRcVZKREIiLCJsb2NhbFJlc3BlY3QiOiJoaWdoIiwibGVnaXQiOnRydWV9LCJpZCI6InVybjp1dWlkOjZjOGJiY2Y0LTg3YWYtNDQ5YS05YmZiLTMwYmYyOTk3NjIyNyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJTdHJlZXRDcmVkIl0sIkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIl0sImlzc3VlciI6ImRpZDprZXk6elEzc2hOTHQxYU1XUGJXUkdhOFZvZUViSm9mSjd4SmU0RkNQcERLeHExTlp5Z3BpeSJ9fQ.qoqF4-FinFsQ2J-NFSO46xCE8kUTZqZCU5fYr6tS0TQ6VP8y-ZnyR6R3oAqLs_Yo_CqQi23yi38uDjLjksiD2w" + }, + { + "description": "creates a verifiable credential as a jwt with a did:jwk", + "input": { + "signerDidUri": "did:jwk:eyJrdHkiOiJFQyIsInVzZSI6InNpZyIsImNydiI6InNlY3AyNTZrMSIsImtpZCI6Ik5CX3FsVUlyMDYtQWlrVlZNRnJlcTBsYy1vbVF0emM2bHdoaGN2Z082cjQiLCJ4IjoiRGR0TjhXNnhfMzRwQl9ua3hSMGUxdG1Ea05uc0pldXNCQUVQektXZ2ZfWSIsInkiOiJ1M1cxMzVpbm9kTHF0Y0ViOWpOR1MzSnNNX3VGS21rSlNiOFRyYzlsdVdJIiwiYWxnIjoiRVMyNTZLIn0", + "signerPrivateJwk": { + "kty": "EC", + "d": "OeBCt3M8roz9F9Ny192TtZXf_-qPzAkwSM6ep7QdSO4", + "use": "sig", + "crv": "secp256k1", + "kid": "NB_qlUIr06-AikVVMFreq0lc-omQtzc6lwhhcvgO6r4", + "x": "DdtN8W6x_34pB_nkxR0e1tmDkNnsJeusBAEPzKWgf_Y", + "y": "u3W135inodLqtcEb9jNGS3JsM_uFKmkJSb8Trc9luWI", + "alg": "ES256K" + }, + "credential": { + "@context": [ + "https://www.w3.org/2018/credentials/v1" + ], + "type": [ + "VerifiableCredential", + "StreetCred" + ], + "id": "urn:uuid:6c8bbcf4-87af-449a-9bfb-30bf29976227", + "issuer": "did:jwk:eyJrdHkiOiJFQyIsInVzZSI6InNpZyIsImNydiI6InNlY3AyNTZrMSIsImtpZCI6Ik5CX3FsVUlyMDYtQWlrVlZNRnJlcTBsYy1vbVF0emM2bHdoaGN2Z082cjQiLCJ4IjoiRGR0TjhXNnhfMzRwQl9ua3hSMGUxdG1Ea05uc0pldXNCQUVQektXZ2ZfWSIsInkiOiJ1M1cxMzVpbm9kTHF0Y0ViOWpOR1MzSnNNX3VGS21rSlNiOFRyYzlsdVdJIiwiYWxnIjoiRVMyNTZLIn0", + "issuanceDate": "2023-11-30T00:03:13Z", + "credentialSubject": { + "id": "did:key:zQ3shkpavjKRewoBk6arPJnhA87ZzhLDEWgVvZKNHK6QqVJDB", + "localRespect": "high", + "legit": true + } + } + }, + "output": "eyJraWQiOiJkaWQ6andrOmV5SnJkSGtpT2lKRlF5SXNJblZ6WlNJNkluTnBaeUlzSW1OeWRpSTZJbk5sWTNBeU5UWnJNU0lzSW10cFpDSTZJazVDWDNGc1ZVbHlNRFl0UVdsclZsWk5SbkpsY1RCc1l5MXZiVkYwZW1NMmJIZG9hR04yWjA4MmNqUWlMQ0o0SWpvaVJHUjBUamhYTm5oZk16UndRbDl1YTNoU01HVXhkRzFFYTA1dWMwcGxkWE5DUVVWUWVrdFhaMlpmV1NJc0lua2lPaUoxTTFjeE16VnBibTlrVEhGMFkwVmlPV3BPUjFNelNuTk5YM1ZHUzIxclNsTmlPRlJ5WXpsc2RWZEpJaXdpWVd4bklqb2lSVk15TlRaTEluMCMwIiwidHlwIjoiSldUIiwiYWxnIj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5TURZdFFXbHJWbFpOUm5KbGNUQnNZeTF2YlZGMGVtTTJiSGRvYUdOMlowODJjalFpTENKNElqb2lSR1IwVGpoWE5uaGZNelJ3UWw5dWEzaFNNR1V4ZEcxRWEwNXVjMHBsZFhOQ1FVVlFla3RYWjJaZldTSXNJbmtpT2lKMU0xY3hNelZwYm05a1RIRjBZMFZpT1dwT1IxTXpTbk5OWDNWR1MyMXJTbE5pT0ZSeVl6bHNkVmRKSWl3aVlXeG5Jam9pUlZNeU5UWkxJbjAifX0.8AehkiboIK6SZy6LHC9ugy_OcT2VsjluzH4qzsgjfTtq9fEsGyY-cOW_xekNUa2RE2VzlP6FXk0gDn4xf6_r4g" + } + ] +} \ No newline at end of file diff --git a/web5-test-vectors/credentials/verify_failure.json b/web5-test-vectors/credentials/verify_failure.json new file mode 100644 index 0000000..7a6e134 --- /dev/null +++ b/web5-test-vectors/credentials/verify_failure.json @@ -0,0 +1,33 @@ +{ + "description": "verifiable credential 1.1 verification", + "vectors": [ + { + "description": "bad vcJwt structure", + "input": { + "vcJwt": "foo.bar" + }, + "errors": true + }, + { + "description": "bad missing alg", + "input": { + "vcJwt": "eyJraWQiOiJkaWQ6a2V5OnpRM3NoTkx0MWFNV1BiV1JHYThWb2VFYkpvZko3eEplNEZDUHBES3hxMU5aeWdwaXkjelEzc2hOTHQxYU1XUGJXUkdhOFZvZUViSm9mSjd4SmU0RkNQcERLeHExTlp5Z3BpeSIsInR5cCI6IkpXVCJ9.eyJraWQiOiJkaWQ6a2V5OnpRM3NoTkx0MWFNV1BiV1JHYThWb2VFYkpvZko3eEplNEZDUHBES3hxMU5aeWdwaXkjelEzc2hOTHQxYU1XUGJXUkdhOFZvZUViSm9mSjd4SmU0RkNQcERLeHExTlp5Z3BpeSIsInR5cCI6IkpXVCJ9.cbK62TrzOfbVDy06OWQUxkz--hKGGuG_Ch5on_SkiuU" + }, + "errors": true + }, + { + "description": "bad missing kid", + "input": { + "vcJwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJraWQiOiJkaWQ6a2V5OnpRM3NoTkx0MWFNV1BiV1JHYThWb2VFYkpvZko3eEplNEZDUHBES3hxMU5aeWdwaXkjelEzc2hOTHQxYU1XUGJXUkdhOFZvZUViSm9mSjd4SmU0RkNQcERLeHExTlp5Z3BpeSIsInR5cCI6IkpXVCJ9.cbK62TrzOfbVDy06OWQUxkz--hKGGuG_Ch5on_SkiuU" + }, + "errors": true + }, + { + "description": "bad signature", + "input": { + "vcJwt": "eyJraWQiOiJkaWQ6a2V5OnpRM3NoTkx0MWFNV1BiV1JHYThWb2VFYkpvZko3eEplNEZDUHBES3hxMU5aeWdwaXkjelEzc2hOTHQxYU1XUGJXUkdhOFZvZUViSm9mSjd4SmU0RkNQcERLeHExTlp5Z3BpeSIsInR5cCI6IkpXVCJ9.eyJraWQiOiJkaWQ6a2V5OnpRM3NoTkx0MWFNV1BiV1JHYThWb2VFYkpvZko3eEplNEZDUHBES3hxMU5aeWdwaXkjelEzc2hOTHQxYU1XUGJXUkdhOFZvZUViSm9mSjd4SmU0RkNQcERLeHExTlp5Z3BpeSIsInR5cCI6IkpXVCJ9.8AehkiboIK6SZy6LHC9ugy_OcT2VsjluzH4qzsgjfTtq9fEsGyY-cOW_xekNUa2RE2VzlP6FXk0gDn4xf6_r4g" + }, + "errors": true + } + ] +} diff --git a/web5-test-vectors/credentials/verify_success.json b/web5-test-vectors/credentials/verify_success.json new file mode 100644 index 0000000..836f638 --- /dev/null +++ b/web5-test-vectors/credentials/verify_success.json @@ -0,0 +1,17 @@ +{ + "description": "verifiable credential 1.1 verification", + "vectors": [ + { + "description": "verify a jwt verifiable credential signed with a did:key", + "input": { + "vcJwt": "eyJraWQiOiJkaWQ6a2V5OnpRM3NoTkx0MWFNV1BiV1JHYThWb2VFYkpvZko3eEplNEZDUHBES3hxMU5aeWdwaXkjelEzc2hOTHQxYU1XUGJXUkdhOFZvZUViSm9mSjd4SmU0RkNQcERLeHExTlp5Z3BpeSI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