From 1f54d806ab8520c7eaaedbab9c173a80ab83f534 Mon Sep 17 00:00:00 2001 From: Daniel Armengod Date: Mon, 27 Nov 2023 07:26:02 +0100 Subject: [PATCH] Added verify_presentation bindings --- .gitignore | 1 + idhub_ssikit/__init__.py | 11 +++++++++++ main.py | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/.gitignore b/.gitignore index 9f11b75..1febf6c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea/ +__pycache__ diff --git a/idhub_ssikit/__init__.py b/idhub_ssikit/__init__.py index 2d2ef27..1a85a43 100644 --- a/idhub_ssikit/__init__.py +++ b/idhub_ssikit/__init__.py @@ -83,3 +83,14 @@ def issue_verifiable_presentation(vc_list: list[str], jwk_holder: str, holder_di return asyncio.run(inner()) +def verify_presentation(vp): + """ + Returns a (bool, str) tuple indicating whether the credential is valid. + If the boolean is true, the credential is valid and the second argument can be ignored. + If it is false, the VC is invalid and the second argument contains a JSON object with further information. + """ + async def inner(): + proof_options = '{"proofFormat": "ldp"}' + return didkit.verify_presentation(vp, proof_options) + + return asyncio.run(inner()) diff --git a/main.py b/main.py index 3ef540e..1b4b307 100644 --- a/main.py +++ b/main.py @@ -34,6 +34,15 @@ def issue_vc_test(): def issue_vp_test(): + """ + In this example execution two Verifiable Credentials associated with a single Holder are issued and then + combined into a single Verifiable Presentation. + The Verifiable Credentials are of two different models. The use-case is meant to mimic + - Holder being a physical person, + - Issuer A being "Pare Manel" foundation, + - Issuer B being "EXO" foundation, + - Verifier (not pictured) being "Som Connexio", which wants verifiable data of the Holder from both Issuers. + """ jwk_issuer = didkit.generate_ed25519_key() jwk_issuer2 = didkit.generate_ed25519_key() jwk_subject = didkit.generate_ed25519_key()