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.
2023-10-24 08:19:55 +00:00
|
|
|
import asyncio
|
|
|
|
import didkit
|
|
|
|
import json
|
|
|
|
from jinja2 import Environment, FileSystemLoader, select_autoescape
|
2023-11-10 05:45:12 +00:00
|
|
|
import idhub_ssikit
|
2023-10-24 08:19:55 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
2023-11-10 05:45:12 +00:00
|
|
|
env = Environment(
|
|
|
|
loader=FileSystemLoader("vc_templates"),
|
|
|
|
autoescape=select_autoescape()
|
|
|
|
)
|
|
|
|
unsigned_vc_template = env.get_template("member-credential.json")
|
|
|
|
data = {
|
|
|
|
"vc_id": "http://example.org/credentials/3731",
|
|
|
|
"issuer_did": did_issuer,
|
|
|
|
"subject_did": did_subject,
|
|
|
|
"issuance_date": "2020-08-19T21:41:50Z",
|
|
|
|
"subject_is_member_of": "Pangea"
|
|
|
|
}
|
|
|
|
signed_credential = idhub_ssikit.render_and_sign_credential(
|
|
|
|
unsigned_vc_template,
|
|
|
|
jwk_issuer,
|
|
|
|
data
|
|
|
|
)
|
2023-10-24 08:19:55 +00:00
|
|
|
|
2023-11-10 05:45:12 +00:00
|
|
|
print(signed_credential)
|