diff --git a/aries_cloudagent/protocols/present_proof/v1_0/manager.py b/aries_cloudagent/protocols/present_proof/v1_0/manager.py index a1a5b10e8c..a0878bf80b 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/manager.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/manager.py @@ -335,13 +335,14 @@ async def create_presentation( revoc_reg_deltas = {} async with ledger: - for referented in requested_referents.values(): - credential_id = referented["cred_id"] + for precis in requested_referents.values(): # cred_id, non-revoc interval + credential_id = precis["cred_id"] if not credentials[credential_id].get("rev_reg_id"): continue - + if "timestamp" in precis: + continue rev_reg_id = credentials[credential_id]["rev_reg_id"] - referent_non_revoc_interval = referented.get( + referent_non_revoc_interval = precis.get( "non_revoked", non_revoc_interval ) @@ -362,7 +363,10 @@ async def create_presentation( delta, delta_timestamp, ) - referented["timestamp"] = revoc_reg_deltas[key][3] + for stamp_me in requested_referents.values(): + # often one cred satisfies many requested attrs/preds + if stamp_me["cred_id"] == credential_id: + stamp_me["timestamp"] = revoc_reg_deltas[key][3] # Get revocation states to prove non-revoked revocation_states = {} @@ -381,7 +385,7 @@ async def create_presentation( try: revocation_states[rev_reg_id][delta_timestamp] = json.loads( await holder.create_revocation_state( - credential["cred_rev_id"], + credentials[credential_id]["cred_rev_id"], rev_reg.reg_def, delta, delta_timestamp, @@ -394,17 +398,17 @@ async def create_presentation( ) raise e - for (referent, referented) in requested_referents.items(): - if "timestamp" not in referented: + for (referent, precis) in requested_referents.items(): + if "timestamp" not in precis: continue if referent in requested_credentials["requested_attributes"]: requested_credentials["requested_attributes"][referent][ "timestamp" - ] = referented["timestamp"] + ] = precis["timestamp"] if referent in requested_credentials["requested_predicates"]: requested_credentials["requested_predicates"][referent][ "timestamp" - ] = referented["timestamp"] + ] = precis["timestamp"] indy_proof_json = await holder.create_presentation( presentation_exchange_record.presentation_request,