This repository contains the W3C Verifiable Credentials Working Group test suite. Any conforming implementation MUST pass all tests in the test suite.
There are multiple test suites, each of which is detailed below.
You can review the current draft implementation report.
This test suite will check any application that generates Verifiable Credential Data Model documents to ensure conformance with the specification.
npm install
cp config.json.example config.json
config.json
for your run (be sure to remove all comments)npm test
If your tests are timing out (for example, it takes a long time to generate
needed keys), you can use the --timeout
parameter in mocha, and pass in a
higher timeout (in milliseconds). For example, to increase the timeout for
each test to 10 seconds, you would:
npm test -- --timeout 10000
or when generating the report:
mocha --recursive --timeout 10000 test/vc-data-model-1.0/ -R json > implementations/report.json
If your tests fail with the following error:
TypeError: Cannot read property 'es256kPrivateKeyJwk' of undefined
This means that you need to do one of:
"sectionsNotSupported": ["jwt"]
to your config.json
.For example, the config for the vc-js
implementation is below:
{
"generator": "../vc-js/bin/vc-js test-issue < ",
"presentationGenerator": "../vc-js/bin/vc-js test-presentation <",
"generatorOptions": "",
"sectionsNotSupported": ["jwt", "zkp"]
}
This tells the test harness several things:
../vc-js/
implementation directory (you should substitute the path
to your own)For a more in-depth discussion of how the test suite works, see this comment on issue #14.
The following are the command line parameters that JWT generators have to expect (in addition to the filename/path):
Cmd Line Parameter | Description |
---|---|
--jwt <base64-encoded-keys> |
Generators can choose between RS256 and ES256K private keys to generate JWS for verifiable credentials and presentations. |
--jwt-aud <aud> |
Generators have to use <aud> as the aud attribute in all JWTs |
--jwt-no-jws |
Generators have to suppress the JWS although keys are present |
--jwt-presentation |
Generators have to generate a verifiable presentation |
--jwt-decode |
Generators have to generate a credential from a JWT verifiable credential. The input file will be a JWT instead of a JSON-LD file. |
JWT tests belong to any of the following three categories:
Cmd Line Parameter | Optional |
---|---|
--jwt <base64-encoded-keys> |
no |
--jwt-aud <aud> |
no |
--jwt-no-jws |
yes |
Cmd Line Parameter | Optional |
---|---|
--jwt <base64-encoded-keys> |
no |
--jwt-aud <aud> |
no |
--jwt-presentation |
yes |
Cmd Line Parameter | Optional |
---|---|
--jwt-decode |
no |
NOTE: the command line parameters will be provided by the JWT tests based on the configuration in config.json
.
See config.json.example
for all possible JWT specific config parameters, and see config.json.jwt.example
for an example
JWT configuration.
npm install
cp config.json.example config.json
config.json
for your run.mocha --recursive --timeout 10000 test/vc-data-model-1.0/ -R json > implementations/report.json
mv implementations/report.json implementations/{YOUR_IMPLEMENTATION}-report.json
git add implementations/{YOUR_IMPLEMENTATION}-report.json
node implementations/generate.js
You may contribute to this test suite by submitting pull requests here:
https://github.com/w3c/vc-test-suite/
New BSD License (3-clause) © Digital Bazaar