Skip to content

Commit

Permalink
adding new vectors for testing selectCredentials method (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyoontbd authored May 7, 2024
1 parent cb66211 commit 4c06416
Show file tree
Hide file tree
Showing 2 changed files with 293 additions and 67 deletions.
41 changes: 28 additions & 13 deletions test-vectors/presentation_exchange/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
# Presentation Exchange Test Vectors

## CreatePresentationFromCredentials
The reference implementation for Presentation Exchange can be found [here](https://github.com/TBD54566975/web5-js/blob/main/packages/credentials/src/presentation-exchange.ts#L80).

Input and output for a full presentation exchange test vectors are available [here](./wa-license.json) The reference implementation can be found [here](https://github.com/TBD54566975/web5-js/blob/main/packages/credentials/src/presentation-exchange.ts#L80)
## `create_presentation_from_credentials.json`
Vectors for creating a Presentation Submission from a given Presentation Definition and set of VC JWTs.

### Input
| Property | Description |
|---------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `input.presentationDefinition` | the input [presentationDefinition](https://identity.foundation/presentation-exchange/#presentation-definition) showing the requirements used for this getting an example WA license |
| `input.credentialJwt` | the input [verifiable credential secured as a JWT](https://www.w3.org/TR/vc-data-model/#json-web-token) that corresponds to the presentationDefinition to fulfill it and do a full presentation exchange |
| `output.presentationSubmission` | the expected [presentationSubmission](https://identity.foundation/presentation-exchange/#presentation-submission) when the `inputs` are processed by the `createPresentationFromCredentials` method. |

the value of `input` is a an object with `presentationDefinition` and the corresponding `credentialJwt`
## `select_credentials.json`
Vectors for selecting a subset of VC JWTs from a given set that satisfy a given Presentation Definition

| Property | Description |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `presentationDefinition` | the input [presentationDefinition](https://identity.foundation/presentation-exchange/#presentation-definition) showing the requirements used for this getting an example WA license |
| `credentialJwt` | the input [verifiable credential secured as a JWT](https://www.w3.org/TR/vc-data-model/#json-web-token) that corresponds to the presentationDefinition to fulfill it and do a full presentation exchange
| Property | Description |
|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `input.presentationDefinition` | the [presentationDefinition](https://identity.foundation/presentation-exchange/#presentation-definition) describing the required credentials. |
| `input.credentialJwts` | a set of [verifiable credentials secured as a JWT](https://www.w3.org/TR/vc-data-model/#json-web-token) |
| `output.selectedCredentials` | the expected [VC JWTs](https://identity.foundation/presentation-exchange/#presentation-submission) that satisfy the input presentation definition. If the set of VC JWTs do not satisfy the presentation definition, `output.selectedCredentials` is an empty array. |

### Output
## `validate_definition.json`
Vectors for validating whether a Presentation Definition is valid or not

the value of `output` is an object that contains the following properties
| Property | Description |
|--------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| `input.presentationDefinition` | the [presentationDefinition](https://identity.foundation/presentation-exchange/#presentation-definition) to be validated |
| `errors` | `true` is the presentation definition is NOT valid. `false` otherwise. |

| Property | Description |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `presentationSubmission` | the expected [presentationSubmission](https://identity.foundation/presentation-exchange/#presentation-submission) when the `inputs` are processed by `createPresentationFromCredentials`. |
## `validate_submission.json
Vectors for validating whether a Presentation Submission is valid or not

| Property | Description |
|--------------------------------|----------------------------------------------------------------------------------------------------------|
| `input.presentationSubmission` | the [presentationSubmission](https://identity.foundation/presentation-exchange/#presentation-submission) to be validated. |
| `errors` | `true` is the presentation submission is NOT valid. `false` otherwise. |
Loading

0 comments on commit 4c06416

Please sign in to comment.