Skip to content

Commit

Permalink
Consolidate failure and success test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
andresuribe87 committed Dec 18, 2023
1 parent 42e12e5 commit 16ca863
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 108 deletions.
4 changes: 2 additions & 2 deletions web5-test-vectors/credentials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ the implementations are following the [Verifiable Credential 1.1 specification](

## `create`

Create test vectors are available for [success](./create_success.json) and [failure](./create_failure.json) test cases.
Create test vectors are available in the [json file](./create.json), which contains success and failure test cases.

### Input

Expand Down Expand Up @@ -35,7 +35,7 @@ The reference implementations for:

## `verify`

Verify test vectors are available for [success](./verify_success.json) and [failure](./verify_failure.json) test cases.
Verify test vectors are available in the [json file](./verify.json), which contains success and failure test cases.

### Input

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,74 @@
}
},
"errors": true
},
{
"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:zQ3shkpavjK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LjksiD2w"
},
{
"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:zQ3shkpavjKRewoBk6arPJnh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WFsU3ViamVjdCI6eyJpZCI6ImRpZDprZXk6elEzc2hrcGF2aktSZXdvQms2YXJQSm5oQTg3WnpoTERFV2dWdlpLTkhLNlFxVkpEQiIsImxvY2FsUmVzcGVjdCI6ImhpZ2giLCJsZWdpdCI6dHJ1ZX0sImlkIjoidXJuOnV1aWQ6NmM4YmJjZjQtODdhZi00NDlhLTliZmItMzBiZjI5OTc2MjI3IiwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlN0cmVldENyZWQiXSwiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpyZEhraU9pSkZReUlzSW5WelpTSTZJbk5wWnlJc0ltTnlkaUk2SW5ObFkzQXlOVFpyTVNJc0ltdHBaQ0k2SWs1Q1gzRnNWVWx5TURZdFFXbHJWbFpOUm5KbGNUQnNZeTF2YlZGMGVtTTJiSGRvYUdOMlowODJjalFpTENKNElqb2lSR1IwVGpoWE5uaGZNelJ3UWw5dWEzaFNNR1V4ZEcxRWEwNXVjMHBsZFhOQ1FVVlFla3RYWjJaZldTSXNJbmtpT2lKMU0xY3hNelZwYm05a1RIRjBZMFZpT1dwT1IxTXpTbk5OWDNWR1MyMXJTbE5pT0ZSeVl6bHNkVmRKSWl3aVlXeG5Jam9pUlZNeU5UWkxJbjAifX0.8AehkiboIK6SZy6LHC9ugy_OcT2VsjluzH4qzsgjfTtq9fEsGyY-cOW_xekNUa2RE2VzlP6FXk0gDn4xf6_r4g"
}
]
}
73 changes: 0 additions & 73 deletions web5-test-vectors/credentials/create_success.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
{
"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
},
{
"description": "verify a jwt verifiable credential signed with a did:key",
"input": {
Expand Down
33 changes: 0 additions & 33 deletions web5-test-vectors/credentials/verify_failure.json

This file was deleted.

0 comments on commit 16ca863

Please sign in to comment.