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

Adds test vectors for credentials #79

Merged
merged 5 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
config:
line-length: false
no-duplicate-heading:
siblings_only: true
57 changes: 57 additions & 0 deletions web5-test-vectors/credentials/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# `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).
Loading
Loading