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 support for Verifiable Credentials Data Model v2.0 #149

Open
parviz-mv opened this issue Aug 11, 2023 · 2 comments
Open

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

parviz-mv opened this issue Aug 11, 2023 · 2 comments

Comments

@parviz-mv
Copy link

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
Copy link
Contributor

@parviz-mv Support for Verifiable Credentials (VC) Data Model 2.0 is currently under development. You can find the ongoing work in this PR: #148

@parviz-mv
Copy link
Author

@JSAssassin Got it, thanks!

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

No branches or pull requests

2 participants