Skip to content

w3c/respec-vc

Repository files navigation

Verifiable Credentials for ReSpec

This ReSpec extension enhances the Verifiable Credential examples in your specification.

The Verifiable Credentials extension to the ReSpec document authoring environment enables authors to express simple examples of credentials in their specification which are then enhanced by this extension to show the digitally signed forms of the credential. An example of the output of this extension is provided below (this extension adds the tabs seen in the image below):

image

Usage

To use this extension, include the following line in your ReSpec file:

<script class="remove" src="https://cdn.jsdelivr.net/gh/w3c/[email protected]/dist/main.js"></script>

Note that there might be releases later than the one listed above. Check this repository's tags for all known releases.

ReSpec Markup

To use this extension, you must add the vc class to your examples.

Options

The data-vc-vm option can be used to provide a digital proof verification method (e.g., a URL to a public key).

The data-vc-tabs property can be set to the following values to customize the tabs displayed:

On by default:

Optional:

<pre class="example nohighlight vc" title="Usage of the id property"
  data-vc-vm="https://example.edu/issuers/565049#key-1">
{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://www.w3.org/2018/credentials/examples/v1"
  ],
  <span class="highlight">"id": "http://example.edu/credentials/3732"</span>,
  "type": ["VerifiableCredential", "UniversityDegreeCredential"],
  "issuer": "https://example.edu/issuers/565049",
  "issuanceDate": "2010-01-01T00:00:00Z",
  "credentialSubject": {
    <span class="highlight">"id": "did:example:ebfeb1f712ebc6f1c276e12ec21"</span>,
    "degree": {
      "type": "BachelorDegree",
      "name": "Bachelor of Science and Arts"
    }
  }
}
</pre>

Development

$ npm i
$ npm run build # build and watch index.js changes
$ npm run start # serve this directory