6134c7ce46 | ||
---|---|---|
idhub_ssikit | ||
schemas@e033da1e8a | ||
.gitignore | ||
.gitmodules | ||
README.md | ||
didkit-0.3.2-cp311-cp311-manylinux_2_34_x86_64.whl | ||
main.py | ||
requirements.txt | ||
sample_usage |
README.md
Helper routines to manage DIDs/VC/VPs
This module is a wrapper around the functions exported by SpruceID's DIDKit
framework.
Verifiable Credential issuance
Verifiable Credential templates are stored as Jinja2 (TBD) templates in /vc_templates
folder. Please examine each template to see what data must be passed to it in order to render.
The data passed to the template must at a minimum include:
- issuer_did
- subject_did
- vc_id
For example, in order to render /schemas/member-credential.json
:
from jinja2 import Environment, FileSystemLoader, select_autoescape
import idhub_ssikit
env = Environment(
loader=FileSystemLoader("vc_templates"),
autoescape=select_autoescape()
)
unsigned_vc_template = env.get_template("member-credential.json")
issuer_user = request.user
jwk_issuer = didkit.generate_ed25519_key()
jwk_subject = didkit.generate_ed25519_key()
did_issuer = didkit.key_to_did("key", jwk_issuer)
did_subject = didkit.key_to_did("key", jwk_subject)
data = {
"vc_id": "http://pangea.org/credentials/3731",
"issuer_did": did_issuer,
"subject_did": "did:web:[...]",
"issuance_date": "2020-08-19T21:41:50Z",
"subject_is_member_of": "Pangea"
}
signed_credential = idhub_ssikit.render_and_sign_credential(
unsigned_vc_template,
issuer_did_controller_key,
data
)