generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds test vectors for credentials (#79)
* Promote test-vectors from web5-kt to sdk-development. * lint * modify linter * try updating the linter again * Final lint
- Loading branch information
1 parent
44b7d25
commit 42e12e5
Showing
6 changed files
with
735 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
config: | ||
line-length: false | ||
no-duplicate-heading: | ||
siblings_only: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
Oops, something went wrong.