Added verify_presentation bindings

This commit is contained in:
Daniel Armengod 2023-11-27 07:26:02 +01:00
parent ac588d4d84
commit 1f54d806ab
3 changed files with 21 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.idea/ .idea/
__pycache__

View File

@ -83,3 +83,14 @@ def issue_verifiable_presentation(vc_list: list[str], jwk_holder: str, holder_di
return asyncio.run(inner()) 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())

View File

@ -34,6 +34,15 @@ def issue_vc_test():
def issue_vp_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_issuer = didkit.generate_ed25519_key()
jwk_issuer2 = didkit.generate_ed25519_key() jwk_issuer2 = didkit.generate_ed25519_key()
jwk_subject = didkit.generate_ed25519_key() jwk_subject = didkit.generate_ed25519_key()