w3c / vc-jose-cose

Verifiable Credentials Working Group — VC JSON Web Tokens specification
https://w3c.github.io/vc-jose-cose/
Other
31 stars 13 forks source link

Handling of "type" not clear in v2 #76

Closed astanciu closed 1 year ago

astanciu commented 1 year ago

When converting from vc+ld+jwt to vc+jwt, it's not clear how to handle the type property of the VCDM.

For ex, in the examples folder of this repo, the examples/vc-2.0/vc-ld-jwt.jose decodes to a VC that contains:


  "type": [
    "VerifiableCredential",
    "UniversityDegreeCredential"
  ],

The 2.0 version, examples/vc-2.0/vc-jwt.jose, (which presumably is the same VC converted to vc-jwt) does not contain any notion of the UniversityDegreeCredential type.

What is the guidance here? When converting to, or constructing, a vc-jwt using the new 2.0 spec, should the additional types (beyond the default VerifiableCredential) be included in the jwt as custom claims or something else?

OR13 commented 1 year ago
Screen Shot 2023-05-01 at 3 34 36 PM

The spec could be much, much clearer on this, but essentially...

The point of vc+jwt is that you don't need to convert from JSON-LD to JSON claimset.

Here is a demo https://jwt.vc

Here is the transforming code, that goes from jwt, vc+jwt or vc+ld+jwt to vc+ld+json (unidirectional mapping).

https://github.com/transmute-industries/jwt.vc/blob/main/services/token.ts

The group is still discussing many issues related to this, but hopefully we will agree to better text in these sections soon.

OR13 commented 1 year ago

type is RDF Class, this question seems more about the core data model.

OR13 commented 1 year ago

Marked pending close over 1 week ago, closing.

TallTed commented 1 year ago

type is RDF Class, this question seems more about the core data model.

Given that `type` is RDF Class, its value MUST be a URI, not a literal.

examples/vc-2.0/vc-ld-jwt.jose no longer resolves to a file, so I cannot check its actual content, and say what it should decode to contain, but that certainly is not —

  "type": [
    "VerifiableCredential",
    "UniversityDegreeCredential"
  ],

That should be something more like this, with fully qualified URIs —

  "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
    "http://example.com/ontology/VerifiableCredential",
    "http://example.com/ontology/UniversityDegreeCredential"
  ],
OR13 commented 1 year ago

See comment here: https://github.com/w3c/vc-data-model/pull/1203#issuecomment-1642405105

I suggest we move discussion regarding expanded form type literals to the vc data model, which has more engaged JSON-LD experts... I will file an issue based on your comment.

OR13 commented 1 year ago

Please continue discussion here: https://github.com/w3c/vc-data-model/issues/1206#issue-1812314198