Skip to content

Commit

Permalink
fix: check req.nested_req
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Simpson <RobS.git9@MailScreen.com>
  • Loading branch information
Robert Simpson authored and Robert Simpson committed Nov 2, 2023
1 parent 37c4bc2 commit 4366643
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions aries_cloudagent/protocols/present_proof/dif/pres_exch_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,30 +1092,33 @@ async def apply_requirements(
nested_result = []
cred_uid_descriptors = {}
# recursion logic for nested requirements
for requirement in req.nested_req:
# recursive call
result = await self.apply_requirements(
requirement, credentials, records_filter
)
if result == {}:
continue
# cred_uid_descriptors maps applicable credentials
# to their respective descriptor.
# Structure: {cred.given_id: {
# desc_id_1: {}
# },
# ......
# }
# This will be used to construct exclude dict.
for descriptor_id in result.keys():
credential_list = result.get(descriptor_id)
for credential in credential_list:
cred_id = credential.given_id or credential.record_id
if cred_id:
cred_uid_descriptors.setdefault(cred_id, {})[descriptor_id] = {}
if req.nested_req:
for requirement in req.nested_req:
# recursive call
result = await self.apply_requirements(
requirement, credentials, records_filter
)
if result == {}:
continue
# cred_uid_descriptors maps applicable credentials
# to their respective descriptor.
# Structure: {cred.given_id: {
# desc_id_1: {}
# },
# ......
# }
# This will be used to construct exclude dict.
for descriptor_id in result.keys():
credential_list = result.get(descriptor_id)
for credential in credential_list:
cred_id = credential.given_id or credential.record_id
if cred_id:
cred_uid_descriptors.setdefault(cred_id, {})[
descriptor_id
] = {}

if len(result.keys()) != 0:
nested_result.append(result)
if len(result.keys()) != 0:
nested_result.append(result)

exclude = {}
for uid in cred_uid_descriptors.keys():
Expand Down

0 comments on commit 4366643

Please sign in to comment.