Skip to content

Update latest #19

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

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a2b66ce
Update db libs.
aljones15 Nov 10, 2022
d3c8942
Update linting tools to latest.
aljones15 Nov 10, 2022
7d71419
Remove esm from package.json.
aljones15 Nov 10, 2022
677aa8f
Start port to es6 export and import.
aljones15 Nov 10, 2022
691af42
Finish porting generate-vdls to es6.
aljones15 Nov 10, 2022
5e7f998
Further port to es6.
aljones15 Nov 10, 2022
8cd3346
Correct a few more es6 imports.
aljones15 Nov 10, 2022
e6040e5
Update bbs+ deps.
aljones15 Nov 11, 2022
dfbf54b
Revert states to json & make templateHelpers cjs.
aljones15 Nov 11, 2022
1186b80
Add error template to matrix.
aljones15 Nov 11, 2022
56f1239
Add error popup to template.
aljones15 Nov 11, 2022
77c9ea3
Add generate vdls as step in github workflow.
aljones15 Nov 11, 2022
5dc85f5
Add vc api test implementations to project.
aljones15 Nov 11, 2022
67a3d55
Use implementation issuer and verifier.
aljones15 Nov 11, 2022
c006118
Remove old implementation files.
aljones15 Nov 11, 2022
5b1faa9
Further work on issuer tests.
aljones15 Nov 12, 2022
b09eb68
Replace issuer and verifier.
aljones15 Nov 14, 2022
ac49727
Add additional props to Vc.
aljones15 Nov 14, 2022
ee9dee0
Add createVerifierBody & remove deepClone.
aljones15 Nov 14, 2022
b637e36
Correct jsigs issues from refactor.
aljones15 Nov 14, 2022
e253c90
Fix verifier tests.
aljones15 Nov 14, 2022
07a0035
Add KEY_SEED_DB to generate vdls.
aljones15 Nov 22, 2022
3ee3971
Update suite to use vdl-test tag.
aljones15 Nov 22, 2022
9d4c0f2
Don't use branch of implementations.
aljones15 Nov 30, 2023
16005d2
Throw in before on error.
aljones15 Nov 30, 2023
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
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
run: npm install --legacy-peer-deps
- name: Clean VDLs
run: rm -f ./credentials/*.json
- name: Generate VDLs
env:
KEY_SEED_DB: ${{ secrets.KEY_SEED_DB }}
run: npm run generate-vdls
- name: Run test with Node.js ${{ matrix.node-version }}
env:
KEY_SEED_DB: ${{ secrets.KEY_SEED_DB }}
Expand Down
13 changes: 8 additions & 5 deletions bbs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
Expand All @@ -11,10 +12,12 @@
"author": "",
"license": "ISC",
"dependencies": {
"@mattrglobal/bbs-signatures": "^0.6.0",
"@mattrglobal/bls12381-key-pair": "^0.7.0",
"@mattrglobal/jsonld-signatures-bbs": "^0.11.0",
"@mattrglobal/node-bbs-signatures": "^0.12.0",
"jsonld-signatures": "^5.0.0"
"@mattrglobal/bbs-signatures": "^1.1.0",
"@mattrglobal/bls12381-key-pair": "^1.0.0",
"@mattrglobal/jsonld-signatures-bbs": "^1.1.0",
"@mattrglobal/node-bbs-signatures": "^0.15.0",
"install": "^0.13.0",
"jsonld-signatures": "^5.0.0",
"npm": "^9.1.1"
}
}
28 changes: 14 additions & 14 deletions bbs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import {
BbsBlsSignatureProof2020,
deriveProof
} from '@mattrglobal/jsonld-signatures-bbs';
import {extendContextLoader, sign, verify, purposes} from 'jsonld-signatures';
import jsigs from 'jsonld-signatures';

import _keyPairOptions from './data/keyPair.json';
import _disclosures from './data/deriveProofFrame.json';
import exampleControllerDoc from './data/controllerDocument.json';
import bbsContext from './data/bbs.json';
import credentialContext from './data/credentialsContext.json';
import jwsContext from './data/jwsContext.json';
import _keyPairOptions from './data/keyPair.json' assert {type: 'json'};
import _disclosures from './data/deriveProofFrame.json' assert {type: 'json'};
import exampleControllerDoc from './data/controllerDocument.json' assert {type: 'json'};
import bbsContext from './data/bbs.json' assert {type: 'json'};
import credentialContext from './data/credentialsContext.json' assert {type: 'json'};
import jwsContext from './data/jwsContext.json' assert {type: 'json'};
import {CONTEXT_URL as vdlContextUri, CONTEXT} from 'vdl-context';

const documents = {
Expand Down Expand Up @@ -56,7 +56,7 @@ const customDocLoader = url => {
};

//Extended document load that uses local contexts
const _documentLoader = extendContextLoader(customDocLoader);
const _documentLoader = jsigs.extendContextLoader(customDocLoader);

/**
* Creates a BBS+ report for a VC.
Expand All @@ -81,16 +81,16 @@ export const createBBSreport = async ({
const keyPair = await new Bls12381G2KeyPair(keyPairOptions);

//Sign the input document
const signedDocument = await sign(inputDocument, {
const signedDocument = await jsigs.sign(inputDocument, {
suite: new BbsBlsSignature2020({key: keyPair}),
purpose: new purposes.AssertionProofPurpose(),
purpose: new jsigs.purposes.AssertionProofPurpose(),
documentLoader
});

//Verify the proof
let verified = await verify(signedDocument, {
let verified = await jsigs.verify(signedDocument, {
suite: new BbsBlsSignature2020(),
purpose: new purposes.AssertionProofPurpose(),
purpose: new jsigs.purposes.AssertionProofPurpose(),
documentLoader
});
//Derive a proof
Expand All @@ -100,9 +100,9 @@ export const createBBSreport = async ({
});

//Verify the derived proof
verified = await verify(derivedProof, {
verified = await jsigs.verify(derivedProof, {
suite: new BbsBlsSignatureProof2020(),
purpose: new purposes.AssertionProofPurpose(),
purpose: new jsigs.purposes.AssertionProofPurpose(),
documentLoader
});
return {
Expand Down
File renamed without changes.
34 changes: 15 additions & 19 deletions files.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
*/
'use strict';

const {join} = require('path');
const {createReadStream, writeFile, readdir, readFile} = require('fs');
const {finished} = require('stream');
const {promisify} = require('util');
const csv = require('csv-parse');
import {
createReadStream,
readdir,
readFile,
writeFile
} from 'fs';
import csv from 'csv-parse';
import {finished} from 'stream';
import {join} from 'path';
import {promisify} from 'util';

const asyncFinished = promisify(finished);
const asyncReadDir = promisify(readdir);
Expand All @@ -23,7 +28,7 @@ const asyncReadFile = promisify(readFile);
*
* @returns {Promise<Array<string>>} Dir and file names.
*/
async function getDir(path) {
export async function getDir(path) {
const directory = await asyncReadDir(path);
if(directory.length <= 0) {
throw new Error(`Dir ${path} is empty`);
Expand All @@ -38,14 +43,14 @@ async function getDir(path) {
*
* @returns {Promise<Array<string>>} Gets files as strings.
*/
async function getDirFiles(path) {
export async function getDirFiles(path) {
const dir = await getDir(path);
const files = await Promise.all(dir.map(
fileName => asyncReadFile(join(path, fileName), 'utf8')));
return files;
}

async function getJSONFiles(path) {
export async function getJSONFiles(path) {
const strings = await getDirFiles(path);
return strings.map(JSON.parse);
}
Expand All @@ -59,7 +64,7 @@ async function getJSONFiles(path) {
*
* @returns {Promise<Array<Array<string>>>} Each row is an array of strings.
*/
async function getCSV({path, parser = new csv.Parser()}) {
export async function getCSV({path, parser = new csv.Parser()}) {
const records = [];
const fileStream = createReadStream(path).pipe(parser);
fileStream.on('readable', function() {
Expand All @@ -82,15 +87,6 @@ async function getCSV({path, parser = new csv.Parser()}) {
*
* @returns {Promise} Resolves on write.
*/
async function writeJSON({path, data}) {
export async function writeJSON({path, data}) {
return asyncWriteFile(path, JSON.stringify(data, null, 2));
}

module.exports = {
getCSV,
getDir,
getDirFiles,
getJSONFiles,
writeJSON
};

14 changes: 8 additions & 6 deletions generate-vdls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
*/
'use strict';

const {join} = require('path');
const {writeJSON} = require('./files');
const {paths} = require('./paths');
const {CONTEXT_URL} = require('vdl-context');
const stateList = require('./states');
const didKeyDriver = require('@digitalbazaar/did-method-key').driver();
import {CONTEXT_URL} from 'vdl-context';
import {driver} from '@digitalbazaar/did-method-key';
import {join} from 'path';
import {paths} from './paths.js';
import stateList from './states.json' assert {type: 'json'};
import {writeJSON} from './files.js';

const didKeyDriver = driver();

async function createVC(state) {
const contexts = [
Expand Down
10 changes: 0 additions & 10 deletions implementations.js

This file was deleted.

12 changes: 0 additions & 12 deletions implementations/DigitalBazaar.json

This file was deleted.

9 changes: 0 additions & 9 deletions implementations/Mattr.json

This file was deleted.

9 changes: 0 additions & 9 deletions implementations/Spruce.json

This file was deleted.

25 changes: 24 additions & 1 deletion matrix.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@
.small-font {
font-size: 0.75rem;
}
.highlight-on-hover:hover {
background-color: yellow;
cursor: default;
}
.highlight-on-hover:hover + .relative-pos > .err {
display: block;
}
pre, code.hljs {
overflow: auto;
}
.relative-pos {
position: relative;
width: 0.5rem;
height: 0.5rem;
z-index: 1;
}
.relative-pos:hover > .err {
display: block;
}

pre, code.hljs{
overflow: auto;
}
Expand All @@ -54,7 +74,10 @@
<td class="no-wrap small-font">{{id}}</td>
<!--These contain if the test passed, failed, or was skipped-->
{{#each cells}}
<td class="{{state}} {{getOptional optional}}">{{getStatusMark state}}</td>
<td class="{{state}} {{getOptional optional}}">
<div class= "highlight-on-hover">{{getStatusMark state}}</div>
{{> error.hbs error=err}}
</td>
{{/each}}
</tr>
{{/each}}
Expand Down
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "0.0.1",
"description": "Test suite to demonstrate interoperability between various VC issuers & verifiers.",
"main": "index.js",
"type": "module",
"scripts": {
"parallel": "npm run generate-vdls && mocha tests/ --require esm --reporter @digitalbazaar/mocha-w3c-interop-reporter --reporter-options body=\"$PWD/body.hbs\",matrix=\"$PWD/matrix.hbs\",reportDir=\"$PWD/reports\",respec=\"$PWD/respecConfig.json\",title=\"Verifiable Driver's License Interoperability Report 1.0\",helpers=\"$PWD/templateHelpers.js\",suiteLog='./suite.log' --parallel --timeout 15000",
"test": "npm run generate-vdls && mocha tests/ --require esm --reporter @digitalbazaar/mocha-w3c-interop-reporter --reporter-options body=\"$PWD/body.hbs\",matrix=\"$PWD/matrix.hbs\",reportDir=\"$PWD/reports\",respec=\"$PWD/respecConfig.json\",title=\"Verifiable Driver's License Interoperability Report 1.0\",helpers=\"$PWD/templateHelpers.js\",suiteLog='./suite.log' --timeout 15000",
"test": "mocha tests/ --reporter @digitalbazaar/mocha-w3c-interop-reporter --reporter-options body=\"$PWD/body.hbs\",matrix=\"$PWD/matrix.hbs\",reportDir=\"$PWD/reports\",respec=\"$PWD/respecConfig.json\",title=\"Verifiable Driver's License Interoperability Report 1.0\",helpers=\"$PWD/templateHelpers.cjs\",suiteLog='./suite.log' --timeout 15000",
"generate-vdls": "node generate-vdls.js",
"lint": "eslint *.js",
"postinstall": "cd bbs && npm i"
Expand All @@ -30,28 +30,29 @@
},
"homepage": "https://github.com/w3c-ccg/vdl-test-suite#readme",
"dependencies": {
"@digitalbazaar/did-method-key": "^1.0.0",
"@digitalbazaar/ed25519-signature-2020": "^2.1.0",
"@digitalbazaar/ed25519-verification-key-2020": "^2.1.1",
"@digitalbazaar/http-client": "^1.0.0",
"@digitalbazaar/mocha-w3c-interop-reporter": "^1.0.0",
"@digitalbazaar/did-method-key": "^3.0.0",
"@digitalbazaar/ed25519-signature-2020": "^5.0.0",
"@digitalbazaar/ed25519-verification-key-2020": "^4.1.0",
"@digitalbazaar/http-client": "^3.2.0",
"@digitalbazaar/mocha-w3c-interop-reporter": "^1.3.0",
"@digitalbazaar/security-context": "^1.0.0",
"@digitalbazaar/vc": "^1.0.0",
"@digitalbazaar/vpqr": "^2.1.0",
"@digitalbazaar/vc": "^5.0.0",
"@digitalbazaar/vpqr": "^3.0.0",
"axios": "^0.21.1",
"chai": "^4.3.4",
"cit-context": "^2.0.0",
"credentials-context": "^1.0.0",
"credentials-context": "^2.0.0",
"csv-parse": "^4.15.3",
"did-context": "^3.0.1",
"ed25519-signature-2020-context": "^1.0.1",
"esm": "^3.2.25",
"file-size": "^1.0.0",
"jsonld-document-loader": "^1.1.0",
"klona": "^2.0.5",
"mocha": "^8.3.2",
"node-cbor": "^5.0.4",
"require-dir": "^1.2.0",
"uuid": "^8.3.2",
"vc-api-test-suite-implementations": "github:w3c-ccg/vc-api-test-suite-implementations",
"vc-revocation-list-context": "^1.0.0",
"vdl-context": "github:digitalbazaar/vdl-context",
"x25519-key-agreement-2020-context": "^1.0.0"
Expand All @@ -60,8 +61,8 @@
"node": ">=14.0.0"
},
"devDependencies": {
"eslint": "^7.23.0",
"eslint-config-digitalbazaar": "^2.6.1",
"eslint-plugin-jsdoc": "^32.3.0"
"eslint": "^8.27.0",
"eslint-config-digitalbazaar": "^4.1.0",
"eslint-plugin-jsdoc": "^39.6.2"
}
}
8 changes: 2 additions & 6 deletions paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
*/
'use strict';

const {join} = require('path');
import {join} from 'path';

const paths = {
export const paths = {
credentials: join(process.cwd(), 'credentials'),
implementations: join(process.cwd(), 'implementations')
};

module.exports = {
paths
};
4 changes: 3 additions & 1 deletion templateHelpers.js → templateHelpers.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const states = require('./states');
const states = require('./states.json');

const api = {
getState(abbreviation) {
const {name} = states.find(s => s.code === abbreviation) || {};
return name || 'Unknown';
}
};

module.exports = api;

Loading