From 1651667717d9f804a1c4a991199b2d8dffa33393 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 6 Jun 2024 13:48:22 +0200 Subject: [PATCH] change create_verifiable_presentation for sign --- oidc4vp/forms.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/oidc4vp/forms.py b/oidc4vp/forms.py index 1c4b19a..688094e 100644 --- a/oidc4vp/forms.py +++ b/oidc4vp/forms.py @@ -1,11 +1,12 @@ import json +import uuid from django import forms from django.template.loader import get_template from django.utils.translation import gettext_lazy as _ from django.core.exceptions import ValidationError -from utils.idhub_ssikit import create_verifiable_presentation +from pyvckit.sign import sign from idhub.models import VerificableCredential @@ -72,13 +73,16 @@ class AuthorizeForm(forms.Form): def get_verificable_presentation(self): did = self.subject_did + vc_list = [json.loads(x) for x in self.list_credentials] vp_template = get_template('credentials/verifiable_presentation.json') - vc_list = json.dumps([json.loads(x) for x in self.list_credentials]) context = { "holder_did": did.did, - "verifiable_credential_list": vc_list + "verificable_credentials": vc_list, + "id": str(uuid.uuid4()) } unsigned_vp = vp_template.render(context) + key_material = did.get_key_material() - self.vp = create_verifiable_presentation(key_material, unsigned_vp) + self.vp = sign(key_material, unsigned_vp, did.did) +