From f3142b6e0254a25b6bb8b71a4763e85fcdc6c6ab Mon Sep 17 00:00:00 2001 From: Thiago Romano Date: Tue, 10 Sep 2024 22:44:07 -0300 Subject: [PATCH] fix: anoncreds revocation notification when revoking Signed-off-by: Thiago Romano --- .../revocation_anoncreds/manager.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/aries_cloudagent/revocation_anoncreds/manager.py b/aries_cloudagent/revocation_anoncreds/manager.py index 11d67f697b..c7adfe4a49 100644 --- a/aries_cloudagent/revocation_anoncreds/manager.py +++ b/aries_cloudagent/revocation_anoncreds/manager.py @@ -145,6 +145,18 @@ async def revoke_credential( f"No revocation registry record found for id: {rev_reg_id}" ) + if notify: + thread_id = thread_id or f"indy::{rev_reg_id}::{cred_rev_id}" + rev_notify_rec = RevNotificationRecord( + rev_reg_id=rev_reg_id, + cred_rev_id=cred_rev_id, + thread_id=thread_id, + connection_id=connection_id, + comment=comment, + version=notify_version, + ) + async with self._profile.session() as session: + await rev_notify_rec.save(session, reason="New revocation notification") if publish: await revoc.get_or_fetch_local_tails_path(rev_reg_def) result = await revoc.revoke_pending_credentials( @@ -164,18 +176,6 @@ async def revoke_credential( else: await revoc.mark_pending_revocations(rev_reg_id, int(cred_rev_id)) - if notify: - thread_id = thread_id or f"indy::{rev_reg_id}::{cred_rev_id}" - rev_notify_rec = RevNotificationRecord( - rev_reg_id=rev_reg_id, - cred_rev_id=cred_rev_id, - thread_id=thread_id, - connection_id=connection_id, - comment=comment, - version=notify_version, - ) - async with self._profile.session() as session: - await rev_notify_rec.save(session, reason="New revocation notification") async def update_rev_reg_revoked_state( self,