As of this moment, V3 is available for certs. 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.
Here is an example Verifiable Credential:
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/blockcerts/v3"
],
"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 of a difference. 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.
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"]},{"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"
],
"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.
With V3 available, the main commands (create-certificate-template
,instantiate-certificate-batch
) now create V3 certs.
One may still use cert-tools to create V2 credentials:
Installing is the same:
pip install .
For creating templates:
create-certificate-template_v2 -c conf_v2.ini
For creating batches from a roster list:
instantiate-certificate-batch_v2 -c conf_v2.ini
The conf.ini
fields are described below. Optional arguments are in brackets
create-certificate-template_v2 --help
usage: create_v2_certificate_template.py [-h] [-c MY_CONFIG]
[--data_dir DATA_DIR]
[--issuer_logo_file ISSUER_LOGO_FILE]
[--cert_image_file CERT_IMAGE_FILE]
[--issuer_url ISSUER_URL]
[--issuer_certs_url ISSUER_CERTS_URL]
--issuer_email ISSUER_EMAIL
--issuer_name ISSUER_NAME
--issuer_id ISSUER_ID [--issuer_key ISSUER_KEY]
[--certificate_description CERTIFICATE_DESCRIPTION]
--certificate_title CERTIFICATE_TITLE
--criteria_narrative CRITERIA_NARRATIVE
[--template_dir TEMPLATE_DIR]
[--template_file_name TEMPLATE_FILE_NAME]
[--hash_emails]
[--revocation_list REVOCATION_LIST]
[--issuer_public_key ISSUER_PUBLIC_KEY]
--badge_id BADGE_ID
[--issuer_signature_lines ISSUER_SIGNATURE_LINES]
[--additional_global_fields ADDITIONAL_GLOBAL_FIELDS]
[--additional_per_recipient_fields ADDITIONAL_PER_RECIPIENT_FIELDS]
Args that start with '--' (eg. --data_dir) can also be set in a config file (./cert-tools/conf.ini or specified via -c). Config file syntax allows: key=value, flag=true, stuff=[a,b,c] (for details, see syntax at https://goo.gl/R74nmi). If an arg is specified in more than one place, then commandline values override config file values which override defaults.
Argument details:
-h, --help show this help message and exit
-c MY_CONFIG, --my-config MY_CONFIG
config file path (default: None)
--data_dir DATA_DIR where data files are located (default: None)
--issuer_logo_file ISSUER_LOGO_FILE
issuer logo image file, png format (default: None)
--cert_image_file CERT_IMAGE_FILE
issuer logo image file, png format (default: None)
--issuer_url ISSUER_URL
issuer URL (default: None)
--issuer_certs_url ISSUER_CERTS_URL
issuer certificates URL (default: None)
--issuer_email ISSUER_EMAIL
issuer email (default: None)
--issuer_name ISSUER_NAME
issuer name (default: None)
--issuer_id ISSUER_ID
issuer profile (default: None)
--issuer_key ISSUER_KEY
issuer issuing key (default: None)
--certificate_description CERTIFICATE_DESCRIPTION
the display description of the certificate (default:
None)
--certificate_title CERTIFICATE_TITLE
the title of the certificate (default: None)
--criteria_narrative CRITERIA_NARRATIVE
criteria narrative (default: None)
--template_dir TEMPLATE_DIR
the template output directory (default: None)
--template_file_name TEMPLATE_FILE_NAME
the template file name (default: None)
--hash_emails whether to hash emails in the certificate (default:
False)
--revocation_list REVOCATION_LIST
issuer revocation list (default: None)
--issuer_public_key ISSUER_PUBLIC_KEY
issuer public key (default: None)
--badge_id BADGE_ID badge id (default: None)
--issuer_signature_lines ISSUER_SIGNATURE_LINES
issuer signature lines (default: None)
--additional_global_fields ADDITIONAL_GLOBAL_FIELDS
additional global fields (default: None)
--additional_per_recipient_fields ADDITIONAL_PER_RECIPIENT_FIELDS
additional per-recipient fields (default: None)