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

VC 2.0 Release Candidate #132

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
36 changes: 36 additions & 0 deletions test/mocha/20-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 {
Expand Down
29 changes: 29 additions & 0 deletions test/mocha/mock-credential-v2.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
2 changes: 1 addition & 1 deletion test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading