feat(vc2): implement VC 2.0 support - #2827
Conversation
🦋 Changeset detectedLatest commit: 2b67bae The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
6686ca6 to
c2533bf
Compare
|
I implemented tree-walking support for VP-within-VP (per I will remove this functionality for |
|
This PR would close #2196 |
Signed-off-by: rmlearney-digicatapult <robert.learney@digicatapult.org.uk>
Signed-off-by: rmlearney-digicatapult <robert.learney@digicatapult.org.uk>
Signed-off-by: rmlearney-digicatapult <robert.learney@digicatapult.org.uk>
Signed-off-by: rmlearney-digicatapult <robert.learney@digicatapult.org.uk>
Signed-off-by: rmlearney-digicatapult <robert.learney@digicatapult.org.uk>
73f5b0c to
8ac7f6e
Compare
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
|
Tests all passing locally with Docker :( Looks like the E2E and Drizzle errors are arising from
|
|
Design question: This is currently a strict spec-compliant implementation. Do we want to extend options to allow user to inject custom The implementation also currently uses direct native I could modify all of these sites to use injected fetch plus wrapper. |
|
Ideally we use the custom fetch from whenever possible. We didn't use it because the document loader didn't support it. |
genaris
left a comment
There was a problem hiding this comment.
Thanks @rmlearney-digicatapult ! I left some comments and minor suggestions but overall I think it's a great addition. I'd like to see it soon in main and that's why I'm submitting my approval!
| } | ||
|
|
||
| async function getContextBytes(contextUrl: string): Promise<Uint8Array> { | ||
| const response = await fetch(contextUrl, { |
There was a problem hiding this comment.
Beware on using bare fetch (use the one from agent dependencies, either directly or through the fetchWithTimeout utility method).
| signerId = presentation.resolvedPresentation.holderId | ||
| if (!signerId) { | ||
| validationResults.isValid = false | ||
| return validationResults | ||
| } |
There was a problem hiding this comment.
If holder is not present (optional in VCDM 2.0), wouldn't this always fail?
| let cachedContextValidationDocumentLoader: DocumentLoader | undefined | ||
|
|
||
| async function getContextValidationDocumentLoader(): Promise<DocumentLoader> { | ||
| if (cachedContextValidationDocumentLoader) return cachedContextValidationDocumentLoader |
There was a problem hiding this comment.
Is it intended to have this scoped document loader (cached on module-owned variable)? I mean, is it fine to have a separate loader configured for W3CCredentialsModule? There we can define a custom loader that wouldn't be used here.
There was a problem hiding this comment.
W3cV2CredentialsModule.ts declares W3cV2CredentialsModuleConfigOptions inline and stores this.options. Its direct 1.1 sibling does it conventionally:
export class W3cCredentialsModule implements Module {
public readonly config: W3cCredentialsModuleConfig
public constructor(config?: W3cCredentialsModuleConfigOptions) {
this.config = new W3cCredentialsModuleConfig(config)
}Related: W3cV2DataIntegrityContextValidator.configure() is a mutable setter on an @injectable() class, called once at registration. A config class passed to the constructor would match the codebase and remove the mutable-singleton shape.
There was a problem hiding this comment.
The directory's v1 means Data Integrity 1.0, but adding that suffix does not make it "future proof", since the classes within it do only include the "V2" that corresponds to the VCDM 2.0. I think we can simply leave the directory as data-integrity and, in case a future major revision of DI is created, we can rename the classes to take into account the DI version (if actually needed).
Signed-off-by: rmlearney-digicatapult <robert.learney@digicatapult.org.uk>
Signed-off-by: rmlearney-digicatapult <robert.learney@digicatapult.org.uk>
Signed-off-by: rmlearney-digicatapult <robert.learney@digicatapult.org.uk>
Apologies I couldn't break this into smaller units for review but it wouldn't have been functional.
Large core element of fully spec-compliant VC Data Model 2.0.
This PR introduces:
W3cV2 Model Changes for VC 2.0
enveloped_verifiable_presentation_typeW3cV2EnvelopedVerifiablePresentation.tsand break a circular imports with theJwtandSdJwtmodelsW3cV2 JWT & SD-JWT alignment to VC-JOSE-COSE
jwt-vc-presentation-profile.tsFull VC 2.0 + VC-JOSE-COSE multi-format nested VC/VP compliance
jwt,sd-jwt,di), not string matchesjwt/sd-jwtouter) and Enveloped VP (jwt/sd-jwtouter) to comply with VC 2.0 and VC-JOSE-COSEmatrixVpFixture.tsVC 2.0 Routing & API
W3cV2CredentialServiceas full-featured top-level router capable of dispatchingjwt,sd-jwt,dicredential typesv2-jwt-utils.tsvalidators.tsJSON-LD Contexts for VC 2.0
Data Integrity v1.0 Handling
w3c-diproof module for VC 2.0 semanticsfixtures/credo-di-vc.tsCredential Record
W3cV2CredentialRecord.tsto handle DI + cryptosuite taggingDCQL, PEX, OIDC
di_*paths because not yet supported