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

Add v2 test suite #736

Merged
merged 11 commits into from
May 23, 2023
Merged

Add v2 test suite #736

merged 11 commits into from
May 23, 2023

Conversation

OR13
Copy link
Collaborator

@OR13 OR13 commented Apr 12, 2023

This PR adds and experimental test suite for VCDM v2.

Current approach transforms the published schemas, but in the future, when VCDM v2 is a TR, this transformation should not be necessary.

"issued": "eyJpc3MiOiJkaWQ6andrOmV5SnJkSGtpT2lKUFMxQWlMQ0pqY25ZaU9pSkZaREkxTlRFNUlpd2llQ0k2SW5wWU1ucHZSMjFYTXpaVVZFeGZhM2N6WnkxTFJsWnFhRFZKYjJGRVkyOVRZekE0YWtsRU5IVkhjbk1pZlEiLCJraWQiOiIjMCIsImFsZyI6IkVkRFNBIiwiY3R5IjoidmMrbGQranNvbiJ9.eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL3czaWQub3JnL3RyYWNlYWJpbGl0eS92MSJdLCJpZCI6InVybjp1dWlkOjc2YjllYTg1LTY0NzctNDE2MC1hYmZkLThiNWMxYzUzY2FjZCIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJCYW5rQWNjb3VudENyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpyZEhraU9pSlBTMUFpTENKamNuWWlPaUpGWkRJMU5URTVJaXdpZUNJNklucFlNbnB2UjIxWE16WlVWRXhmYTNjelp5MUxSbFpxYURWSmIyRkVZMjlUWXpBNGFrbEVOSFZIY25NaWZRIiwiaXNzdWFuY2VEYXRlIjoiMjAyMi0wNC0xMVQxNjozNjoyNFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJ0eXBlIjpbIkJhbmtBY2NvdW50Il0sImFjY291bnRJZCI6IjExMTExMTEiLCJCSUMxMSI6IlRET01DQVRUVE9SIiwiZmFtaWx5TmFtZSI6IlNtaXRoIiwiZ2l2ZW5OYW1lIjoiQWxpY2UiLCJpZCI6ImRpZDprZXk6ejZNazJjZDIxZTlhYmU1N2ZhZTcuLi4zMTA3M2RhMWI1MjI3OTBlNjM4MzRmZTE3YTRjMmJlIiwiaWJhbiI6IkdCNzRHU0xEMDQyOTYyODAwMDEzMTkiLCJyb3V0aW5nSW5mbyI6eyJ0eXBlIjpbIlJvdXRpbmdJbmZvIl0sImNvZGUiOiJHQkRTQyIsInZhbHVlIjoiMDQyOTYyIn0sImFkZHJlc3MiOnsidHlwZSI6WyJQb3N0YWxBZGRyZXNzIl0sInN0cmVldEFkZHJlc3MiOiIxOSBLbm94IFN0IiwiYWRkcmVzc0xvY2FsaXR5IjoiVG9yb250byIsImFkZHJlc3NSZWdpb24iOiJPTiIsImFkZHJlc3NDb3VudHJ5IjoiQ2FuYWRhIiwicG9zdGFsQ29kZSI6Ik0zQiAxQTIifX0sImNyZWRlbnRpYWxTY2hlbWEiOnsiaWQiOiJodHRwczovL3czaWQub3JnL3RyYWNlYWJpbGl0eS9vcGVuYXBpL2NvbXBvbmVudHMvc2NoZW1hcy9jcmVkZW50aWFscy9CYW5rQWNjb3VudENyZWRlbnRpYWwueW1sIiwidHlwZSI6Ik9wZW5BcGlTcGVjaWZpY2F0aW9uVmFsaWRhdG9yMjAyMiJ9fQ.dkmYNquKwLoFd0UhpDjRj_RQUOzkUKqTnVxRJ56NffQibq2ZIx0Q0vwRIu1Fb8PF41rhbtW7AVNi7typLPPZAA",
"verified": {
"protectedHeader": {
"iss": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwieCI6InpYMnpvR21XMzZUVExfa3czZy1LRlZqaDVJb2FEY29TYzA4aklENHVHcnMifQ",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mprorock note the header params.

"iss": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwieCI6InpYMnpvR21XMzZUVExfa3czZy1LRlZqaDVJb2FEY29TYzA4aklENHVHcnMifQ",
"kid": "#0",
"alg": "EdDSA",
"cty": "vc+ld+json"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the v2 content type.

}
},
"credentialSchema": {
"id": "https://w3id.org/traceability/openapi/components/schemas/credentials/BankAccountCredential.yml",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the self referencing credentialSchema... this is checked... AFTER ... signature verification in the tests.

},
"payload": {
"@context": [
"https://www.w3.org/ns/credentials/v2",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2 context

@OR13
Copy link
Collaborator Author

OR13 commented Apr 12, 2023

This test suite won't pass, because not all schemas support credentialSchema property... given how fundamental to our work this is, it seems like we should correct this.

@mprorock
Copy link
Collaborator

This test suite won't pass, because not all schemas support credentialSchema property... given how fundamental to our work this is, it seems like we should correct this.

@rhofvendahl might want to take a pass on this to make sure we have proper credentialSchema support in place

Copy link
Collaborator

@mprorock mprorock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brownoxford I like the approach taken here, particularly with did:jwk instead of did:key for testing - this will cause us to need to update a few things as we shift more to this model

Comment on lines 1 to 8
const privateKeyJwk = {
kty: 'OKP',
crv: 'Ed25519',
x: 'zX2zoGmW36TTL_kw3g-KFVjh5IoaDcoSc08jID4uGrs',
d: '95hNcacuqtWQP70MDYrL6DRUJ8iGg-oq13I0KM5Etw8',
};

module.exports = privateKeyJwk;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but perhaps p256?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change that part, it just makes the examples longer.

OR13 and others added 2 commits April 12, 2023 14:00
Co-authored-by: Mike Prorock <mprorock@users.noreply.github.com>
Co-authored-by: Mike Prorock <mprorock@users.noreply.github.com>
- name: Begin CI...
uses: actions/checkout@v2
- name: Use Node 16
uses: actions/setup-node@v1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use node v3? and checkout v3? also might be a good idea to use cache with it to speed it up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a snippet you would prefer I use here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See any of the workflows in trace-interop:

...
    steps:
      # Check out repo, set up node, and install dependencies.
      # @see https://github.com/actions/setup-node#usage
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16.15.1
          cache: 'npm'
      - run: npm ci
...

const jose = require('jose');
const fs = require('fs');
const { v4: uuidv4 } = require('uuid');
// pending merge of https://github.com/w3c-ccg/traceability-vocab/pull/735
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

putting a comment here to make sure this gets changed after pr 735 is merged but before this pr is.

@OR13
Copy link
Collaborator Author

OR13 commented Apr 19, 2023

Schema validation requires: #747

@OR13
Copy link
Collaborator Author

OR13 commented Apr 25, 2023

I should be unblocked, but we might find out more errors in schemas after we are unblocked.

@OR13
Copy link
Collaborator Author

OR13 commented May 21, 2023

Several related issues have been uncovered here...

We will probably want to refactor the schema package tests next, so we can start issuing both v1 and v2 credentials as part of CI tests.

@nissimsan nissimsan merged commit 64e58ff into main May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants