This repository was archived by the owner on Feb 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9832136
Showing
9 changed files
with
590 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2018, Digital Bazaar, Inc. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# W3C Decentralized Identifiers Working Group Test Suite | ||
|
||
This repository contains the W3C | ||
[CREDENTIALS COMMUNITY GROUP](https://www.w3.org/community/credentials/) test suite. | ||
Any conforming implementation MUST pass all tests in the test suite. | ||
|
||
There are multiple test suites, each of which is detailed below. | ||
|
||
## Decentralized Identifiers 1.0 Test Suite | ||
|
||
This test suite will check any application that generates [Decentralized Identifiers](https://w3c-ccg.github.io/did-spec/) documents to | ||
ensure conformance with the specification. | ||
|
||
### Creating a Binary | ||
You web application will need to be accessible from the command line. It will also need to accept the following command line parameters: | ||
``` | ||
Usage: <your_program> [options] [command] | ||
Options: | ||
-?, --question //TODO add commands | ||
-h, --help output usage information | ||
Commands: | ||
validate? // TODO commands | ||
``` | ||
All tests will run against your binary and assume that an exit code greater than 0 represents an error. | ||
|
||
### Creating a config file | ||
An example local configuration for the test suite. To use: | ||
|
||
1. Copy this file to one called config.json. | ||
2. Modify the file and replace with appropriate values for your system. | ||
3. the generator should be a path to your binary. | ||
|
||
``` | ||
{ | ||
"generator": "../your-application/bin", | ||
} | ||
``` | ||
|
||
### Running the Test Suite | ||
|
||
1. npm install | ||
2. Copy the `config.json.example` file to `config.json` and modify. | ||
3. All that is needed is a path to the binary that runs the tests | ||
4. npm test | ||
|
||
### Submit an Implementation Report | ||
|
||
1. npm install | ||
2. Copy the `config.json.example` file to `config.json` and modify. | ||
3. npm run report | ||
4. Rename implementation/results.json to | ||
implementation/YOUR_IMPLEMENTATION-results.json. | ||
5. git add implementations/YOUR_IMPLEMENTATION-results.json and submit a | ||
pull request for your implementation. | ||
|
||
## Contributing | ||
|
||
You may contribute to this test suite by submitting pull requests here: | ||
|
||
https://github.com/w3c-ccg/did-test-suite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"generator": "../your/app", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/** | ||
* Generates the HTTP Signatures Implementation Report given | ||
* a set of *-report.json files. | ||
*/ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const testConfig = require('./test.json'); | ||
|
||
// extract the results from all of the test files | ||
const allTests = []; | ||
const allResults = {}; | ||
const dirContents = fs.readdirSync(__dirname); | ||
const files = dirContents.filter( | ||
contents => {return contents.match(/.*-report.json/ig);}); | ||
|
||
if(!files.length) { | ||
throw new Error( | ||
'Failed to find any reports in the form of your_program-report.json ' + | ||
`in the dir ${__dirname}`); | ||
} | ||
|
||
function getTestStatus(test, pendingTitles) { | ||
if(pendingTitles.includes(test.fullTitle)) { | ||
return 'skipped'; | ||
} | ||
const errorCount = Object.keys(test.err).length; | ||
if(errorCount > 0) { | ||
return 'failure'; | ||
} | ||
return 'success'; | ||
} | ||
|
||
// process each test file | ||
files.forEach(file => { | ||
const implementation = file.match(/(.*)-report.json/)[1]; | ||
const results = JSON.parse(fs.readFileSync( | ||
path.join(__dirname, file)), 'utf-8'); | ||
allResults[implementation] = {}; | ||
const pendingTitles = results.pending.map(t => t.fullTitle); | ||
|
||
// process each test, noting the result | ||
results.tests.forEach(test => { | ||
allResults[implementation][test.fullTitle] = | ||
getTestStatus(test, pendingTitles); | ||
// assume vc.js tests all features | ||
// TODO abstract this out | ||
if(implementation === testConfig.implementation) { | ||
allTests.push(test.fullTitle); | ||
} | ||
}); | ||
}); | ||
|
||
// generate the implementation report | ||
const implementations = Object.keys(allResults).sort(); | ||
let conformanceTable = ` | ||
<table class="simple"> | ||
<thead> | ||
<th width="80%">Test</th> | ||
`; | ||
implementations.forEach(implementation => { | ||
conformanceTable += `<th>${implementation}</th>`; | ||
}); | ||
conformanceTable += ` | ||
</thead> | ||
<tbody> | ||
`; | ||
|
||
// process each test | ||
allTests.forEach(test => { | ||
conformanceTable += ` | ||
<tr> | ||
<td>${test}</td> | ||
`; | ||
implementations.forEach(implementation => { | ||
const status = (allResults[implementation][test]) || 'unimplemented'; | ||
let statusMark = '-'; | ||
|
||
if(status === 'success') { | ||
statusMark = '✓'; | ||
} | ||
if(status === 'failure') { | ||
statusMark = '❌'; | ||
} | ||
if(status === 'skipped') { | ||
//skipped tests get a pause button | ||
statusMark = '⏸'; | ||
} | ||
|
||
conformanceTable += ` | ||
<td class="${status}">${statusMark}</td> | ||
`; | ||
}); | ||
conformanceTable += ` | ||
</tr> | ||
`; | ||
}); | ||
conformanceTable += ` | ||
</tbody> | ||
</table> | ||
`; | ||
|
||
// output the implementation report | ||
const template = fs.readFileSync( | ||
path.join(__dirname, 'template.html'), 'utf-8'); | ||
fs.writeFileSync(path.join(__dirname, 'index.html'), | ||
template.replace('%%%REPORTS%%%', conformanceTable)); | ||
|
||
console.log('Generated new implementation report.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Decentralized Identifiers Implementation Report 1.0</title> | ||
<meta http-equiv='Content-Type' content='text/html;charset=utf-8'/> | ||
<!-- | ||
=== NOTA BENE === | ||
For the three scripts below, if your spec resides on dev.w3 you can check them | ||
out in the same tree and use relative links so that they'll work offline, | ||
--> | ||
<script src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script> | ||
<script type="text/javascript" class="remove"> | ||
var respecConfig = { | ||
// specification status (e.g., WD, LCWD, NOTE, etc.). If in doubt use ED. | ||
specStatus: "ED", | ||
|
||
// the specification's short name, as in http://www.w3.org/TR/short-name/ | ||
shortName: "decentralized-identifiers-implementation-report", | ||
|
||
// subtitle for the spec | ||
subtitle: "Implementation Report for Decentralized Identifiers", | ||
|
||
// if you wish the publication date to be other than today, set this | ||
//publishDate: "2017-08-03", | ||
|
||
// if there is a previously published draft, uncomment this and set its YYYY-MM-DD date | ||
// and its maturity status | ||
// previousPublishDate: "1977-03-15", | ||
// previousMaturity: "WD", | ||
|
||
// extend the bibliography entries | ||
doJsonLd: true, | ||
|
||
github: "https://github.com/w3c-ccg/did-test-suite", | ||
includePermalinks: false, | ||
|
||
// if there a publicly available Editor's Draft, this is the link | ||
edDraftURI: "https://w3c-ccg.github.io/did-test-suite/implementations/", | ||
|
||
// if this is a LCWD, uncomment and set the end of its review period | ||
// lcEnd: "2009-08-05", | ||
|
||
// editors, add as many as you like | ||
// only "name" is required | ||
editors: [ | ||
{ name: "Manu Sporny", url: "http://manu.sporny.org/", | ||
company: "Digital Bazaar", companyURL: "http://digitalbazaar.com/" } | ||
], | ||
// authors, add as many as you like. | ||
// This is optional, uncomment if you have authors as well as editors. | ||
// only "name" is required. Same format as editors. | ||
authors: | ||
[ | ||
{ name: "Manu Sporny", url: "http://digitalbazaar.com/", | ||
company: "Digital Bazaar", companyURL: "http://digitalbazaar.com/" } | ||
], | ||
// name of the WG | ||
wg: "CREDENTIALS COMMUNITY GROUP", | ||
|
||
// URI of the public WG page | ||
wgURI: "https://www.w3.org/community/credentials/", | ||
|
||
// name (with the @w3.org) of the public mailing to which comments are due | ||
wgPublicList: "public-credentials", | ||
|
||
// URI of the patent status for this WG, for Rec-track documents | ||
// !!!! IMPORTANT !!!! | ||
// This is important for Rec-track documents, do not copy a patent URI from a random | ||
// document unless you know what you're doing. If in doubt ask your friendly neighbourhood | ||
// Team Contact. | ||
wgPatentURI: null, | ||
maxTocLevel: 2, | ||
inlineCSS: true | ||
}; | ||
</script> | ||
<style> | ||
.success { | ||
font-weight: bold; | ||
background-color: lightgreen; | ||
text-align: center; | ||
} | ||
.failure { | ||
font-weight: bold; | ||
background-color: pink; | ||
text-align: center; | ||
} | ||
.unimplemented { | ||
font-weight: bold; | ||
background-color: lightyellow; | ||
text-align: center; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<section id='abstract'> | ||
<p> | ||
This is the most recent implementation report for the | ||
<a href="https://w3c-ccg.github.io/did-spec/">Decentralized Identifiers</a> specification. | ||
</p> | ||
</section> | ||
|
||
<section id='sotd'> | ||
<p> | ||
Comments regarding this document are welcome. Please file issues | ||
directly on <a href="https://github.com/w3c-ccg/did-spec/issues">GitHub</a>, | ||
or send them to | ||
<a href="mailto:[email protected]">[email protected]</a> | ||
(<a href="mailto:[email protected]?subject=subscribe">subscribe</a>, | ||
<a href="https://lists.w3.org/Archives/Public/public-credentials/">archives</a>). | ||
</p> | ||
|
||
</section> | ||
|
||
<section class="informative"> | ||
<h1>Introduction</h1> | ||
|
||
<p> | ||
The purpose of this document is to demonstrate that there are at least two | ||
interoperable implementations of processors that are capable of generating | ||
output that is conformant with the <a href="https://w3c-ccg.github.io/did-spec/"> | ||
Decentralized Identifiers</a> spec. | ||
</p> | ||
|
||
<section class="informative"> | ||
<h2>Testing Methodology</h2> | ||
|
||
<p> | ||
The testing framework for the Decentralized Identifiers executes the | ||
following process for every conformance statement in the | ||
<a href="https://w3c-ccg.github.io/did-spec/"> | ||
Decentralized Identifiers</a> spec.: | ||
</p> | ||
|
||
<ol class="algorithm"> | ||
<li> | ||
Take an input file template that exercises the feature and feed it to a | ||
developer provided DID generator. | ||
</li> | ||
<li> | ||
If the input is valid, generate a DID that is conformant | ||
to the spec. | ||
</li> | ||
<li> | ||
The test suite then ensures that the generated DID is | ||
conformant to the feature being tested. | ||
</li> | ||
</ol> | ||
|
||
</section> | ||
|
||
</section> | ||
|
||
<section class="informative"> | ||
<h1>Conformance Testing Results</h1> | ||
|
||
<p> | ||
The results of the conformance testing are shown below: | ||
</p> | ||
|
||
|
||
<table class="simple"> | ||
<thead> | ||
<th width="80%">Test</th> | ||
<th>fake-bad</th><th>fake-good</th><th>skip</th><th>vc.js</th> | ||
</thead> | ||
<tbody> | ||
|
||
</tbody> | ||
</table> | ||
|
||
|
||
</section> | ||
</body> | ||
</html> |
Oops, something went wrong.