Skip to content

Commit

Permalink
Promote test-vectors from web5-kt to sdk-development.
Browse files Browse the repository at this point in the history
  • Loading branch information
andresuribe87 committed Dec 13, 2023
1 parent 44b7d25 commit 338fc79
Show file tree
Hide file tree
Showing 5 changed files with 727 additions and 0 deletions.
51 changes: 51 additions & 0 deletions web5-test-vectors/credentials/README.md
Original file line number Diff line number Diff line change
@@ -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).

Check failure on line 30 in web5-test-vectors/credentials/README.md

View workflow job for this annotation

GitHub Actions / lint

Lists should be surrounded by blank lines

web5-test-vectors/credentials/README.md:30 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "* `create_success` can be foun..."] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md032.md
* `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

Check failure on line 37 in web5-test-vectors/credentials/README.md

View workflow job for this annotation

GitHub Actions / lint

Multiple headings with the same content

web5-test-vectors/credentials/README.md:37 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Input"] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md024.md

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

Check failure on line 42 in web5-test-vectors/credentials/README.md

View workflow job for this annotation

GitHub Actions / lint

Multiple headings with the same content

web5-test-vectors/credentials/README.md:42 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Output"] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md024.md

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

Check failure on line 47 in web5-test-vectors/credentials/README.md

View workflow job for this annotation

GitHub Actions / lint

Multiple headings with the same content

web5-test-vectors/credentials/README.md:47 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### Reference implementations"] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md024.md

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).

Check failure on line 50 in web5-test-vectors/credentials/README.md

View workflow job for this annotation

GitHub Actions / lint

Lists should be surrounded by blank lines

web5-test-vectors/credentials/README.md:50 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "* `verify_success` can be foun..."] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md032.md
* `verify_failure` can be found [here](https://github.com/TBD54566975/web5-kt/blob/466e8d8ca9771ae3a98767e5a4a79ac7b1e7a5d8/credentials/src/test/kotlin/web5/sdk/credentials/VerifiableCredentialTest.kt#L273).

Check failure on line 51 in web5-test-vectors/credentials/README.md

View workflow job for this annotation

GitHub Actions / lint

Files should end with a single newline character

web5-test-vectors/credentials/README.md:51:207 MD047/single-trailing-newline Files should end with a single newline character https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md047.md
Loading

0 comments on commit 338fc79

Please sign in to comment.