Skip to content

Latest commit

 

History

History
116 lines (92 loc) · 5.31 KB

V3.md

File metadata and controls

116 lines (92 loc) · 5.31 KB

V3 Cert Creation Notes

As of this moment, V3 is in a beta state. We are currently having support for creating V3 credential templates & batches with cert-tools. There are some notes to go over as we move from the Open Badges standard to the Verifiable Credentials standard.

Verifiable Credentials Overview

Here is an example Verifiable Credential:

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/blockcerts/v3.0-beta"
  ],
  "id": "urn:uuid:bbba8553-8ec1-445f-82c9-a57251dd731c",
  "type": [
    "VerifiableCredential",
    "BlockcertsCredential"
  ],
  "issuer": "https://raw.githubusercontent.com/blockchain-certificates/cert-issuer/master/examples/issuer/profile.json",
  "issuanceDate": "2010-01-01T19:33:24Z",
  "credentialSubject": {
    "id": "did:example:ebfeb1f712ebc6f1c276e12ec21"
  },
  "metadata": "{\"classOf\":\"2021\"}",
  "display": {
    "contentMediaType": "text/html",
    "content": "<html><body><h1>Some content</h1></body></html>"
  },
  "proof": {
    "type": "MerkleProof2019",
    "created": "2021-04-27T17:50:20.584628",
    "proofValue": "z4zvrPUULnHmaio8hk6bUGzF57JJoPdTmCHK8s8HdJiDAFRqAN46cx1xKyWGFe1fQmBtaRSpuGr21s1b8U9zYUwWLLvM7KeaQ248CCFjFNNYGmumJiMjhM6z49SdHVC4rAPYFMXu4kMr6ufMG5fpB2H9ZxXa9uDBqwvbA1xmxUymUPgskWZe8Yp9cF3KspThUZpZej6q2n1Vx1pM66LZxr8aZ6ERfYipZchxC3Qbnmb8mSRZapJ5t318TQwwjAVYvSj7sptStJJJn5GKujdvS9M2XgM1kfBPeB9a6DCVufLoqyfCP63KUmPnK7df38bB7BGEhJBGFvSPUgnERFTu1dAABuXV7fHqAt2zPw4CDi8kmETgYxLWG8bpDtduM4sAritb6Mfd5exehkjUmXn",
    "proofPurpose": "assertionMethod",
    "verificationMethod": "did:example:23adb1f712ebc6f1c276eba4dfa#key-1"
  }
}

If you're familiar with Open Badges, you'd notice there's quite a bit different. Verifiable Credentials has a lot of flexibility when it comes down to the content of the credential. As you can see, there's no "badge", "signature", "image", etc. as required by the Open Badges standard.

The main thing that is of importance, as far as credential content goes, is the credentialSubject field.

In cert-tools, if you run it as is with no configuration options, you'd get a credential similar to above. We provided an example alumniOf credentialSubject type, from the schema context located here: https://www.w3.org/2018/credentials/examples/v1.

You'd want to find or create one that matches your uses. In the beginning stages of Verifiable Credentials, there might not be a lot of general widespread examples being used, but as time goes on, institutions and communities will adapt and consolidate schema's to be interoperable. Be sure to follow the work happening in the W3C CCG for more info.

Customizing Credential Subject

Using the methods already deployed by cert-tools, one can easily create their own configs with their own credentialSubject types.

Here is an example config value for additional_global_fields adding custom context fields & overriding credentialSubject to be of something different:

{"fields":[{"path":"$.display.content","value":"<h1>Some html code</h1>"}, {"path":"$.display.contentMediaType","value":"text/html"},{"path":"$.@context","value":["https://www.w3.org/2018/credentials/v1","https://w3id.org/blockcerts/v3.0-beta"]},{"path":"$.credentialSubject","value": {"id": "did:example:ebfeb1f712ebc6f1c276e12ec21"}}]}

Using that example, we now get a credential like below:

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/blockcerts/v3.0-beta"
  ],
  "id": "urn:uuid:bbba8553-8ec1-445f-82c9-a57251dd731c",
  "type": [
    "VerifiableCredential",
    "BlockcertsCredential"
  ],
  "issuer": "https://raw.githubusercontent.com/blockchain-certificates/cert-issuer/master/examples/issuer/profile.json",
  "issuanceDate": "2010-01-01T19:33:24Z",
  "credentialSubject": {
    "id": "did:example:ebfeb1f712ebc6f1c276e12ec21"
  },
  "metadata": "{\"classOf\":\"2021\"}",
  "display": {
    "contentMediaType": "text/html",
    "content": "<html><body><h1>Some content</h1></body></html>"
  },
  "proof": {
    "type": "MerkleProof2019",
    "created": "2021-04-27T17:50:20.584628",
    "proofValue": "z4zvrPUULnHmaio8hk6bUGzF57JJoPdTmCHK8s8HdJiDAFRqAN46cx1xKyWGFe1fQmBtaRSpuGr21s1b8U9zYUwWLLvM7KeaQ248CCFjFNNYGmumJiMjhM6z49SdHVC4rAPYFMXu4kMr6ufMG5fpB2H9ZxXa9uDBqwvbA1xmxUymUPgskWZe8Yp9cF3KspThUZpZej6q2n1Vx1pM66LZxr8aZ6ERfYipZchxC3Qbnmb8mSRZapJ5t318TQwwjAVYvSj7sptStJJJn5GKujdvS9M2XgM1kfBPeB9a6DCVufLoqyfCP63KUmPnK7df38bB7BGEhJBGFvSPUgnERFTu1dAABuXV7fHqAt2zPw4CDi8kmETgYxLWG8bpDtduM4sAritb6Mfd5exehkjUmXn",
    "proofPurpose": "assertionMethod",
    "verificationMethod": "did:example:23adb1f712ebc6f1c276eba4dfa#key-1"
  }
}

For more info on injecting custom parameters, see the main readme on adding custom fields.

Running cert-tools for V3

While V3 is in beta stages, the main commands (create-certificate-template,instantiate-certificate-batch) will stay pointed to V2.

2 new commands, along with a new config file can be used to create V3 credentials:

Installing is the same:

pip install.

For creating templates:

create-certificate-template_v3 -c conf_v3.ini

For creating batches from a roster list:

instantiate-certificate-batch_v3 -c conf_v3.ini

Please see the main configuration sections for more info. There are not new V3 config parameters for this to work.