From cd2b5404fbeb89a44d43830ac34ef844d9235ceb Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 6 Jun 2024 17:06:30 +0200 Subject: [PATCH] fix sing vp --- oidc4vp/forms.py | 6 ++++-- oidc4vp/templates/credentials/verifiable_presentation.json | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/oidc4vp/forms.py b/oidc4vp/forms.py index 688094e..bc91fd4 100644 --- a/oidc4vp/forms.py +++ b/oidc4vp/forms.py @@ -78,11 +78,13 @@ class AuthorizeForm(forms.Form): context = { "holder_did": did.did, - "verificable_credentials": vc_list, "id": str(uuid.uuid4()) } unsigned_vp = vp_template.render(context) + vp = json.loads(unsigned_vp) + vp["verifiableCredential"] = vc_list + vp_str = json.dumps(vp) key_material = did.get_key_material() - self.vp = sign(key_material, unsigned_vp, did.did) + self.vp = sign(vp_str, key_material, did.did) diff --git a/oidc4vp/templates/credentials/verifiable_presentation.json b/oidc4vp/templates/credentials/verifiable_presentation.json index 6573c71..aa5ace8 100644 --- a/oidc4vp/templates/credentials/verifiable_presentation.json +++ b/oidc4vp/templates/credentials/verifiable_presentation.json @@ -2,10 +2,10 @@ "@context": [ "https://www.w3.org/2018/credentials/v1" ], - "id": "{{ id }}"", + "id": "{{ id }}", "type": [ "VerifiablePresentation" ], "holder": "{{ holder_did }}", - "verifiableCredential": {{ verificable_credentials }} + "verifiableCredential": "" }