digitalbazaar / vc

W3C Verifiable Credentials implementation in JavaScript
BSD 3-Clause "New" or "Revised" License
173 stars 50 forks source link

Add support for Verifiable Credentials Data Model v2.0 #149

Open parviz-mv opened 10 months ago

parviz-mv commented 10 months ago

VC Data Model v2.0 introduces new contexts:

"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"

When I try to issue a credential with a new contexts:

const credential = {
  "@context": [
    "https://www.w3.org/ns/credentials/v2",
    "https://www.w3.org/ns/credentials/examples/v2",
  ],
  id: "https://example.com/credentials/1872",
  type: ["VerifiableCredential", "AlumniCredential"],
  issuer: "https://example.edu/issuers/565049",
  validFrom: date.toISOString(),
  validUntil: untildate.toISOString(),
  credentialSubject: {
    id: "did:example:ebfeb1f712ebc6f1c276e12ec21",
    alumniOf: "Example University",
  },
};
const verifiableCredential = await vc.issue({
  credential,
  suite,
  documentLoader,
});

I got an error:

Error: "https://www.w3.org/2018/credentials/v1" needs to be first in the list of contexts.

Also, if I use v1 contexts with a new validFrom and validUntil properties, credential successfully issued, but contains issuanceDate property which was renamed to validFrom in v2.0 spec:

{
  '@context': [
    'https://www.w3.org/2018/credentials/v1',
    'https://www.w3.org/2018/credentials/examples/v1'
  ],
  id: 'https://example.com/credentials/1872',
  type: [ 'VerifiableCredential', 'AlumniCredential' ],
  issuer: 'https://example.edu/issuers/565049',
  validFrom: '2023-08-11T10:07:34.116Z',
  validUntil: '2023-08-11T10:09:34.116Z',
  credentialSubject: {
    id: 'did:example:ebfeb1f712ebc6f1c276e12ec21',
    alumniOf: 'Example University'
  },
  issuanceDate: '2023-08-11T10:07:34Z',
  proof: {
    type: 'Ed25519Signature2020',
    created: '2023-08-11T10:07:34Z',
    verificationMethod: 'did:example:1234#z6MknsvN6TxRX8WQ3tC1MToBp9Wc6EX2jCYnVTnkNcXrDCg3',
    proofPurpose: 'assertionMethod',
    proofValue: 'z3m5SNbh5PGn7LYv2mZKLwNvyGKpV6mSytuDdWF4Xziv1pfkUNpiGFiRjTwRxX9kXR3LNshUnRM3tieBP3meqGAry'
  }
}
JSAssassin commented 10 months ago

@parviz-mv Support for Verifiable Credentials (VC) Data Model 2.0 is currently under development. You can find the ongoing work in this PR: https://github.com/digitalbazaar/vc/pull/148

parviz-mv commented 10 months ago

@JSAssassin Got it, thanks!

bparth24 commented 1 week ago

Hello @JSAssassin cc: @parviz-mv

  1. any updates on this issue?
  2. As you mentioned support for VC Data Model 2.0 is under development. Do you have any rough estimate of when it will be done/available?
aljones15 commented 6 days ago

@bparth24 @parviz-mv you may use the existing release candidate for VC 2.0 here: https://github.com/digitalbazaar/vc/pull/148

Also do note: the VC 2.0 context is changing relatively soon: https://github.com/digitalbazaar/credentials-v2-context/pull/10

The R.C. has been reviewed multiple times so I believe the major hold up at this point is continued changes in the VC 2.0 spec and also some changes in dependent libraries (we want the newer version of jsonld.js in the next release).

p.s. any feedback or review comments are welcome.

bparth24 commented 6 days ago

@bparth24 @parviz-mv you may use the existing release candidate for VC 2.0 here: #148

Also do note: the VC 2.0 context is changing relatively soon: digitalbazaar/credentials-v2-context#10

The R.C. has been reviewed multiple times so I believe the major hold up at this point is continued changes in the VC 2.0 spec and also some changes in dependent libraries (we want the newer version of jsonld.js in the next release).

p.s. any feedback or review comments are welcome.

@aljones15 thank you for the response.