TODO merge with idhub? DID & VC/VP library for use in the Trustchain project.
This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Elijah 08013f06c0 Added clause to execute test_all_use_cases() when running main for the testing pipeline 2024-02-29 17:21:30 +01:00
idhub_ssikit Limpiado el sistema de tests previo a integración en la pipeline automática 2024-02-22 12:09:08 +01:00
schemas@90ce148f88 Limpiado el sistema de tests previo a integración en la pipeline automática 2024-02-22 12:09:08 +01:00
.gitignore Added verify_presentation bindings 2023-11-27 07:26:02 +01:00
.gitmodules Fixed last commit 2024-02-01 21:45:36 +01:00
README.md Añadido el paquete didkit compilado con nuestros cambios y desduplicado los tipos de credencial. 2023-12-12 16:57:37 +01:00
didkit-0.3.2-cp311-cp311-manylinux_2_34_x86_64.whl Cleaned up VC issuance example code and verified it works 2024-02-14 15:43:24 +01:00
main.py Added clause to execute test_all_use_cases() when running main for the testing pipeline 2024-02-29 17:21:30 +01:00
requirements.txt Compilada nueva librería para ultimos contexts 2024-02-09 10:48:15 +01:00
sample_usage Initial commit, added three sample VC templates and basic code showing how to generate VCs 2023-10-24 10:19:55 +02:00

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
)