diff --git a/package.json b/package.json index 3c737e8e..b6903798 100644 --- a/package.json +++ b/package.json @@ -40,9 +40,9 @@ "@digitalbazaar/eddsa-2022-cryptosuite": "^1.0.0", "@digitalbazaar/eddsa-rdfc-2022-cryptosuite": "^1.0.1", "@digitalbazaar/lru-memoize": "^3.0.0", - "@digitalbazaar/vc": "^6.0.2", - "@digitalbazaar/vc-revocation-list": "^6.0.0", - "@digitalbazaar/vc-status-list": "^7.0.0", + "@digitalbazaar/vc": "github:digitalbazaar/vc#vc-2.0-time-props", + "@digitalbazaar/vc-revocation-list": "github:digitalbazaar/vc-revocation-list#update-vc-2.0", + "@digitalbazaar/vc-status-list": "github:digitalbazaar/vc-status-list#update-vc-2.0", "@digitalbazaar/webkms-client": "^13.0.0", "assert-plus": "^1.0.0", "bnid": "^3.0.0", diff --git a/test/mocha/20-credentials.js b/test/mocha/20-credentials.js index b10b572f..87d18ef2 100644 --- a/test/mocha/20-credentials.js +++ b/test/mocha/20-credentials.js @@ -21,6 +21,7 @@ const serviceType = 'vc-issuer'; // NOTE: using embedded context in mockCredential: // https://www.w3.org/2018/credentials/examples/v1 const mockCredential = require('./mock-credential.json'); +const mockCredentialV2 = require('./mock-credential-v2.json'); describe('issue APIs', () => { const suiteNames = { @@ -220,6 +221,41 @@ describe('issue APIs', () => { should.exist(verifiableCredential.proof); verifiableCredential.proof.should.be.an('object'); }); + it('issues a VC 2.0 credential w/no "credentialStatus"', async () => { + const credential = klona(mockCredentialV2); + let error; + let result; + try { + const zcapClient = helpers.createZcapClient({capabilityAgent}); + result = await zcapClient.write({ + url: `${noStatusListIssuerId}/credentials/issue`, + capability: noStatusListIssuerRootZcap, + json: { + credential, + options: { + mandatoryPointers: ['issuer'] + } + } + }); + } catch(e) { + error = e; + } + assertNoError(error); + should.exist(result.data); + should.exist(result.data.verifiableCredential); + const {verifiableCredential} = result.data; + verifiableCredential.should.be.an('object'); + should.exist(verifiableCredential['@context']); + should.exist(verifiableCredential.id); + should.exist(verifiableCredential.type); + should.exist(verifiableCredential.issuer); + should.exist(verifiableCredential.credentialSubject); + verifiableCredential.credentialSubject.should.be.an('object'); + should.not.exist(verifiableCredential.credentialStatus); + should.exist(verifiableCredential.proof); + verifiableCredential.proof.should.be.an('object'); + }); + it('fails to issue a valid credential', async () => { let error; try { diff --git a/test/mocha/mock-credential-v2.json b/test/mocha/mock-credential-v2.json new file mode 100644 index 00000000..0b1b0c78 --- /dev/null +++ b/test/mocha/mock-credential-v2.json @@ -0,0 +1,29 @@ +{ + "@context": [ + "https://www.w3.org/ns/credentials/v2", + { + "ex": "https://example.org/examples#", + "schema": "http://schema.org/", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + + "BachelorDegree": "ex:BachelorDegree", + "UniversityDegreeCredential": "ex:UniversityDegreeCredential", + + "degree": "ex:degree", + "name": {"@id": "schema:name", "@type": "rdf:HTML"} + } + ], + "id": "http://example.gov/credentials/3732", + "type": [ + "VerifiableCredential", + "UniversityDegreeCredential" + ], + "issuer": "https://example.edu", + "credentialSubject": { + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "degree": { + "type": "BachelorDegree", + "name": "Bachelor of Science and Arts" + } + } +} diff --git a/test/package.json b/test/package.json index 8140cef3..d8889e2d 100644 --- a/test/package.json +++ b/test/package.json @@ -13,7 +13,7 @@ "dependencies": { "@bedrock/app-identity": "^4.0.0", "@bedrock/core": "^6.0.1", - "@bedrock/credentials-context": "^4.0.0", + "@bedrock/credentials-context": "digitalbazaar/bedrock-credentials-context#update-vc-2.0", "@bedrock/data-integrity-context": "^3.0.0", "@bedrock/did-context": "^5.0.0", "@bedrock/did-io": "^10.1.0",