Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choose each cred rev id by its proper cred in multi-cred proof #601

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions aries_cloudagent/protocols/present_proof/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand All @@ -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 = {}
Expand All @@ -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,
Expand All @@ -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,
Expand Down