|
1 | 1 | """Utilities for dealing with Indy conventions."""
|
2 | 2 |
|
3 |
| -import asyncio |
4 | 3 | import logging
|
5 | 4 | import os
|
6 | 5 | from os import getenv, makedirs, urandom
|
|
9 | 8 | from platform import system
|
10 | 9 | from typing import Optional
|
11 | 10 |
|
12 |
| -from ..core.profile import Profile |
13 |
| -from ..revocation.models.issuer_rev_reg_record import IssuerRevRegRecord |
14 |
| -from .issuer import IndyIssuerError |
15 |
| - |
16 | 11 | LOGGER = logging.getLogger(__name__)
|
17 | 12 |
|
18 | 13 | REVOCATION_REGISTRY_CREATION_TIMEOUT = float(
|
@@ -52,69 +47,3 @@ def indy_client_dir(subpath: Optional[str] = None, create: bool = False) -> str:
|
52 | 47 | makedirs(target_dir, exist_ok=True)
|
53 | 48 |
|
54 | 49 | return target_dir
|
55 |
| - |
56 |
| - |
57 |
| -async def wait_for_active_revocation_registry(profile: Profile, cred_def_id: str) -> None: |
58 |
| - """Wait for revocation registry setup to complete. |
59 |
| -
|
60 |
| - Polls for the creation of revocation registry definitions until we have |
61 |
| - the 1 active registry or timeout occurs. |
62 |
| -
|
63 |
| - Args: |
64 |
| - profile: The profile |
65 |
| - cred_def_id: The credential definition ID |
66 |
| -
|
67 |
| - Raises: |
68 |
| - IndyIssuerError: If timeout occurs before completion |
69 |
| - """ |
70 |
| - LOGGER.debug( |
71 |
| - "Waiting for revocation setup completion for cred_def_id: %s", cred_def_id |
72 |
| - ) |
73 |
| - |
74 |
| - expected_count = 1 # Active registry |
75 |
| - poll_interval = 0.5 # Poll every 500ms |
76 |
| - max_iterations = int(REVOCATION_REGISTRY_CREATION_TIMEOUT / poll_interval) |
77 |
| - registries = [] |
78 |
| - |
79 |
| - for _iteration in range(max_iterations): |
80 |
| - try: |
81 |
| - # Check for finished revocation registry definitions |
82 |
| - async with profile.session() as session: |
83 |
| - registries = await IssuerRevRegRecord.query_by_cred_def_id( |
84 |
| - session, cred_def_id, IssuerRevRegRecord.STATE_ACTIVE |
85 |
| - ) |
86 |
| - |
87 |
| - current_count = len(registries) |
88 |
| - LOGGER.debug( |
89 |
| - "Revocation setup progress for %s: %d registries active", |
90 |
| - cred_def_id, |
91 |
| - current_count, |
92 |
| - ) |
93 |
| - |
94 |
| - if current_count >= expected_count: |
95 |
| - LOGGER.info( |
96 |
| - "Revocation setup completed for cred_def_id: %s " |
97 |
| - "(%d registries created)", |
98 |
| - cred_def_id, |
99 |
| - current_count, |
100 |
| - ) |
101 |
| - return |
102 |
| - |
103 |
| - except Exception as e: |
104 |
| - LOGGER.warning( |
105 |
| - "Error checking revocation setup progress for %s: %s", cred_def_id, e |
106 |
| - ) |
107 |
| - # Continue polling despite errors - they might be transient |
108 |
| - |
109 |
| - await asyncio.sleep(poll_interval) # Wait before next poll |
110 |
| - |
111 |
| - # Timeout occurred |
112 |
| - current_count = len(registries) |
113 |
| - |
114 |
| - raise IndyIssuerError( |
115 |
| - "Timeout waiting for revocation setup completion for credential definition " |
116 |
| - f"{cred_def_id}. Expected 1 active revocation registries, but none " |
117 |
| - f"were active within {REVOCATION_REGISTRY_CREATION_TIMEOUT} seconds. " |
118 |
| - "Note: Revocation registry creation may still be in progress in the " |
119 |
| - "background. You can check status using the revocation registry endpoints." |
120 |
| - ) |
0 commit comments