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

simplify non-revoc tweak at verifier for non-revocable creds #703

Merged
Show file tree
Hide file tree
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: 11 additions & 13 deletions aries_cloudagent/verifier/indy.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, ledger: BaseLedger):
"""
self.ledger = ledger

def non_revoc_intervals(self, pres_req: dict, pres: dict, pop_global: bool):
def non_revoc_intervals(self, pres_req: dict, pres: dict):
"""
Remove superfluous non-revocation intervals in presentation request.

Expand All @@ -46,7 +46,6 @@ def non_revoc_intervals(self, pres_req: dict, pres: dict, pop_global: bool):
Args:
pres_req: presentation request
pres: corresponding presentation
pop_global: whether to excise global non-revocation interval if present

"""

Expand All @@ -72,15 +71,15 @@ def non_revoc_intervals(self, pres_req: dict, pres: dict, pop_global: bool):
uuid,
)

if pop_global:
if pres_req.pop("non_revoked", None):
LOGGER.warning(
(
"Amended presentation request (nonce=%s); removed global "
"non-revocation interval; no revocable credentials in proof"
),
pres_req["nonce"],
)
if all(spec.get("timestamp") is None for spec in pres["identifiers"]):
pres_req.pop("non_revoked", None)
LOGGER.warning(
(
"Amended presentation request (nonce=%s); removed global "
"non-revocation interval; no revocable credentials in proof"
),
pres_req["nonce"],
)

async def pre_verify(self, pres_req: dict, pres: dict) -> (PreVerifyResult, str):
"""
Expand Down Expand Up @@ -239,8 +238,7 @@ async def verify_presentation(
rev_reg_entries: revocation registry entries
"""

print(f"\n\n## Verifying, input: {json.dumps(presentation)}")
self.non_revoc_intervals(presentation_request, presentation, not rev_reg_defs)
self.non_revoc_intervals(presentation_request, presentation)

(pv_result, pv_msg) = await self.pre_verify(presentation_request, presentation)
if pv_result != PreVerifyResult.OK:
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/verifier/tests/test_indy.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ async def test_non_revoc_intervals(self, mock_verify):
],
}

self.verifier.non_revoc_intervals(big_pres_req, big_pres, True)
self.verifier.non_revoc_intervals(big_pres_req, big_pres)

assert "non_revoked" not in big_pres_req
for spec in big_pres_req["requested_attributes"].values():
Expand Down