Skip to content

Commit 606e5ee

Browse files
committed
🎨 Call notify issuer placeholder
1 parent 8835ba5 commit 606e5ee

2 files changed

Lines changed: 64 additions & 13 deletions

File tree

acapy_agent/anoncreds/revocation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def create_rev_reg_def() -> Tuple[
288288
# Generate and set the public tails URI
289289
public_tails_uri = self.generate_public_tails_uri(rev_reg_def)
290290
rev_reg_def.value.tails_location = public_tails_uri
291-
291+
292292
# Upload tails file
293293
await self.upload_tails_file(rev_reg_def)
294294

@@ -616,7 +616,7 @@ async def get_created_revocation_registry_definition(
616616

617617
async def set_active_registry(self, rev_reg_def_id: str) -> None:
618618
"""Mark a registry as active."""
619-
LOGGER.debug("Setting registry %s as active", rev_reg_def_id)
619+
LOGGER.debug("Setting registry as active: %s", rev_reg_def_id)
620620
async with self.profile.transaction() as txn:
621621
entry = await txn.handle.fetch(
622622
CATEGORY_REV_REG_DEF,

acapy_agent/anoncreds/revocation_setup.py

Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,16 @@ async def on_registry_create_response(
292292
)
293293

294294
# Check if resource already exists; recover by fetching existing registry
295-
if "Resource already exists" in error_info.error_msg:
295+
if "already exists" in error_info.error_msg:
296296
LOGGER.error(
297-
"Resource already exists for %s registry, "
298-
"attempting to fetch existing resource",
297+
"Resource already exists for %s registry",
299298
registry_type_name,
300299
)
301300

302-
# TODO: Implement recovery
301+
# Note: It's possible to recover by fetching the existing registry def
302+
# but if we don't have the rev-reg-def-id, we don't know which to fetch
303+
# Cheqd already recovers from this automatically in the plugin
304+
error_info.should_retry = False
303305

304306
# Handle retry with structured data
305307
if error_info.should_retry and error_info.retry_count < self.MAX_RETRY_COUNT:
@@ -345,7 +347,14 @@ async def on_registry_create_response(
345347
event_type=RECORD_TYPE_REV_REG_DEF_CREATE_EVENT,
346348
correlation_id=correlation_id,
347349
)
348-
# TODO: Implement notification to issuer about failure
350+
351+
self._notify_issuer_about_failure(
352+
profile=profile,
353+
failure_type="registry_create",
354+
identifier=payload.rev_reg_def.cred_def_id,
355+
error_msg=error_info.error_msg,
356+
options=payload.options,
357+
)
349358
else:
350359
# Handle success - emit store request event
351360
revoc = AnonCredsRevocation(profile)
@@ -464,7 +473,14 @@ async def on_registry_store_response(
464473
event_type=RECORD_TYPE_REV_REG_DEF_STORE_EVENT,
465474
correlation_id=correlation_id,
466475
)
467-
# TODO: Implement notification to issuer about failure
476+
477+
self._notify_issuer_about_failure(
478+
profile=profile,
479+
failure_type="registry_store",
480+
identifier=payload.rev_reg_def_id,
481+
error_msg=error_info.error_msg,
482+
options=payload.options,
483+
)
468484
else:
469485
# Handle success
470486
LOGGER.info(
@@ -648,7 +664,14 @@ async def on_tails_upload_response(
648664
event_type=RECORD_TYPE_TAILS_UPLOAD_EVENT,
649665
correlation_id=correlation_id,
650666
)
651-
# TODO: Implement notification to issuer about failure
667+
668+
self._notify_issuer_about_failure(
669+
profile=profile,
670+
failure_type="tails_upload",
671+
identifier=payload.rev_reg_def_id,
672+
error_msg=error_info.error_msg,
673+
options=payload.options,
674+
)
652675
else:
653676
# Handle success
654677
LOGGER.info("Tails upload succeeded for: %s", payload.rev_reg_def_id)
@@ -849,7 +872,14 @@ async def on_rev_list_create_response(
849872
event_type=RECORD_TYPE_REV_LIST_CREATE_EVENT,
850873
correlation_id=correlation_id,
851874
)
852-
# TODO: Implement notification to issuer about failure
875+
876+
self._notify_issuer_about_failure(
877+
profile=profile,
878+
failure_type="rev_list_create",
879+
identifier=payload.rev_reg_def_id,
880+
error_msg=error_info.error_msg,
881+
options=payload.options,
882+
)
853883
else:
854884
# Handle success
855885
LOGGER.info(
@@ -985,7 +1015,14 @@ async def on_rev_list_store_response(
9851015
event_type=RECORD_TYPE_REV_LIST_STORE_EVENT,
9861016
correlation_id=correlation_id,
9871017
)
988-
# TODO: Implement notification to issuer about failure
1018+
1019+
self._notify_issuer_about_failure(
1020+
profile=profile,
1021+
failure_type="rev_list_store",
1022+
identifier=payload.rev_reg_def_id,
1023+
error_msg=error_info.error_msg,
1024+
options=payload.options,
1025+
)
9891026
else:
9901027
# Handle success
9911028
LOGGER.info("Revocation list store succeeded for: %s", payload.rev_reg_def_id)
@@ -1118,7 +1155,14 @@ async def on_registry_activation_response(
11181155
event_type=RECORD_TYPE_REV_REG_ACTIVATION_EVENT,
11191156
correlation_id=correlation_id,
11201157
)
1121-
# TODO: Implement notification to issuer about failure
1158+
1159+
self._notify_issuer_about_failure(
1160+
profile=profile,
1161+
failure_type="registry_activation",
1162+
identifier=payload.rev_reg_def_id,
1163+
error_msg=error_info.error_msg,
1164+
options=payload.options,
1165+
)
11221166
else:
11231167
# Handle success
11241168
LOGGER.info("Registry activation succeeded for: %s", payload.rev_reg_def_id)
@@ -1275,7 +1319,14 @@ async def on_registry_full_handling_response(
12751319
event_type=RECORD_TYPE_REV_REG_FULL_HANDLING_EVENT,
12761320
correlation_id=correlation_id,
12771321
)
1278-
# TODO: Implement notification to issuer about failure
1322+
1323+
self._notify_issuer_about_failure(
1324+
profile=profile,
1325+
failure_type="full_registry_handling",
1326+
identifier=payload.old_rev_reg_def_id,
1327+
error_msg=error_info.error_msg,
1328+
options=payload.options,
1329+
)
12791330

12801331
else:
12811332
LOGGER.info(

0 commit comments

Comments
 (0)