-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add v2 test suite #736
Conversation
"issued": "eyJpc3MiOiJkaWQ6andrOmV5SnJkSGtpT2lKUFMxQWlMQ0pqY25ZaU9pSkZaREkxTlRFNUlpd2llQ0k2SW5wWU1ucHZSMjFYTXpaVVZFeGZhM2N6WnkxTFJsWnFhRFZKYjJGRVkyOVRZekE0YWtsRU5IVkhjbk1pZlEiLCJraWQiOiIjMCIsImFsZyI6IkVkRFNBIiwiY3R5IjoidmMrbGQranNvbiJ9.eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL3czaWQub3JnL3RyYWNlYWJpbGl0eS92MSJdLCJpZCI6InVybjp1dWlkOjc2YjllYTg1LTY0NzctNDE2MC1hYmZkLThiNWMxYzUzY2FjZCIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJCYW5rQWNjb3VudENyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpyZEhraU9pSlBTMUFpTENKamNuWWlPaUpGWkRJMU5URTVJaXdpZUNJNklucFlNbnB2UjIxWE16WlVWRXhmYTNjelp5MUxSbFpxYURWSmIyRkVZMjlUWXpBNGFrbEVOSFZIY25NaWZRIiwiaXNzdWFuY2VEYXRlIjoiMjAyMi0wNC0xMVQxNjozNjoyNFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJ0eXBlIjpbIkJhbmtBY2NvdW50Il0sImFjY291bnRJZCI6IjExMTExMTEiLCJCSUMxMSI6IlRET01DQVRUVE9SIiwiZmFtaWx5TmFtZSI6IlNtaXRoIiwiZ2l2ZW5OYW1lIjoiQWxpY2UiLCJpZCI6ImRpZDprZXk6ejZNazJjZDIxZTlhYmU1N2ZhZTcuLi4zMTA3M2RhMWI1MjI3OTBlNjM4MzRmZTE3YTRjMmJlIiwiaWJhbiI6IkdCNzRHU0xEMDQyOTYyODAwMDEzMTkiLCJyb3V0aW5nSW5mbyI6eyJ0eXBlIjpbIlJvdXRpbmdJbmZvIl0sImNvZGUiOiJHQkRTQyIsInZhbHVlIjoiMDQyOTYyIn0sImFkZHJlc3MiOnsidHlwZSI6WyJQb3N0YWxBZGRyZXNzIl0sInN0cmVldEFkZHJlc3MiOiIxOSBLbm94IFN0IiwiYWRkcmVzc0xvY2FsaXR5IjoiVG9yb250byIsImFkZHJlc3NSZWdpb24iOiJPTiIsImFkZHJlc3NDb3VudHJ5IjoiQ2FuYWRhIiwicG9zdGFsQ29kZSI6Ik0zQiAxQTIifX0sImNyZWRlbnRpYWxTY2hlbWEiOnsiaWQiOiJodHRwczovL3czaWQub3JnL3RyYWNlYWJpbGl0eS9vcGVuYXBpL2NvbXBvbmVudHMvc2NoZW1hcy9jcmVkZW50aWFscy9CYW5rQWNjb3VudENyZWRlbnRpYWwueW1sIiwidHlwZSI6Ik9wZW5BcGlTcGVjaWZpY2F0aW9uVmFsaWRhdG9yMjAyMiJ9fQ.dkmYNquKwLoFd0UhpDjRj_RQUOzkUKqTnVxRJ56NffQibq2ZIx0Q0vwRIu1Fb8PF41rhbtW7AVNi7typLPPZAA", | ||
"verified": { | ||
"protectedHeader": { | ||
"iss": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwieCI6InpYMnpvR21XMzZUVExfa3czZy1LRlZqaDVJb2FEY29TYzA4aklENHVHcnMifQ", |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2 context
This test suite won't pass, because not all schemas support |
@rhofvendahl might want to take a pass on this to make sure we have proper |
There was a problem hiding this 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
const privateKeyJwk = { | ||
kty: 'OKP', | ||
crv: 'Ed25519', | ||
x: 'zX2zoGmW36TTL_kw3g-KFVjh5IoaDcoSc08jID4uGrs', | ||
d: '95hNcacuqtWQP70MDYrL6DRUJ8iGg-oq13I0KM5Etw8', | ||
}; | ||
|
||
module.exports = privateKeyJwk; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Co-authored-by: Mike Prorock <[email protected]>
Co-authored-by: Mike Prorock <[email protected]>
.github/workflows/v2.test.yml
Outdated
- name: Begin CI... | ||
uses: actions/checkout@v2 | ||
- name: Use Node 16 | ||
uses: actions/setup-node@v1 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Schema validation requires: #747 |
I should be unblocked, but we might find out more errors in schemas after we are unblocked. |
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. |
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.