From 3649008e19981130e33405b8debc3c79e3b3f604 Mon Sep 17 00:00:00 2001 From: Albin Antony Date: Wed, 21 Aug 2024 10:25:15 +0530 Subject: [PATCH] Fix L3-iGrant/api#479: Ability to customise metadata during issuance --- sdjwt/sdjwt.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdjwt/sdjwt.py b/sdjwt/sdjwt.py index 9a45b65..8cddc05 100644 --- a/sdjwt/sdjwt.py +++ b/sdjwt/sdjwt.py @@ -434,6 +434,7 @@ def create_w3c_vc_jwt_with_disclosure_mapping( credential_status: typing.Optional[dict] = None, terms_of_use: typing.Optional[typing.Union[dict, typing.List[dict]]] = None, disclosure_mapping: typing.Optional[dict] = None, + credential_metadata: typing.Optional[dict] = None, ) -> str: expiry_in_seconds = 2592000 issuance_epoch, issuance_8601 = ( @@ -506,6 +507,8 @@ def iterate_mapping(obj, path): vc["credentialStatus"] = credential_status if terms_of_use: vc["termsOfUse"] = terms_of_use + if credential_metadata: + vc.update(credential_metadata) jwt_credential = create_jwt( vc=vc, @@ -540,6 +543,7 @@ def create_w3c_vc_jwt_with_disclosure_mapping_v2( terms_of_use: typing.Optional[typing.Union[dict, typing.List[dict]]] = None, disclosure_mapping: typing.Optional[dict] = None, expiry_in_seconds: typing.Optional[int] = None, + credential_metadata: typing.Optional[dict] = None, ) -> str: if not expiry_in_seconds: expiry_in_seconds = 2592000 @@ -613,6 +617,8 @@ def iterate_mapping(obj, path): vc["credentialStatus"] = credential_status if terms_of_use: vc["termsOfUse"] = terms_of_use + if credential_metadata: + vc.update(credential_metadata) jwt_credential = create_jwt( vc=vc,