Skip to content

Commit ab6c64e

Browse files
authored
Merge branch 'main' into mediator-testing
2 parents 1168ef8 + f857f8c commit ab6c64e

6 files changed

Lines changed: 82 additions & 2 deletions

File tree

aries_cloudagent/transport/inbound/http.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ async def inbound_message_handler(self, request: web.BaseRequest):
9696
raise web.HTTPBadRequest()
9797

9898
if inbound.receipt.direct_response_requested:
99-
response = await session.wait_response()
99+
# Wait for the message to be processed. Only send a response if a response
100+
# buffer is present.
101+
await inbound.wait_processing_complete()
102+
response = (
103+
await session.wait_response() if session.response_buffer else None
104+
)
100105

101106
# no more responses
102107
session.can_respond = False

aries_cloudagent/transport/inbound/manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ def dispatch_complete(self, message: InboundMessage, completed: CompletedTask):
181181
if session and session.accept_undelivered and not session.response_buffered:
182182
self.process_undelivered(session)
183183

184+
message.dispatch_processing_complete()
185+
184186
def closed_session(self, session: InboundSession):
185187
"""
186188
Clean up a closed session.

aries_cloudagent/transport/inbound/message.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Classes representing inbound messages."""
22

3+
import asyncio
34
from typing import Union
45

56
from .receipt import MessageReceipt
@@ -23,3 +24,12 @@ def __init__(
2324
self.receipt = receipt
2425
self.session_id = session_id
2526
self.transport_type = transport_type
27+
self.processing_complete_event = asyncio.Event()
28+
29+
def dispatch_processing_complete(self):
30+
"""Dispatch processing complete."""
31+
self.processing_complete_event.set()
32+
33+
async def wait_processing_complete(self):
34+
"""Wait for processing to complete."""
35+
await self.processing_complete_event.wait()

aries_cloudagent/transport/inbound/tests/test_http_transport.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def receive_message(
6262
message: InboundMessage,
6363
can_respond: bool = False,
6464
):
65+
message.wait_processing_complete = async_mock.CoroutineMock()
6566
self.message_results.append((message.payload, message.receipt, can_respond))
6667
if self.result_event:
6768
self.result_event.set()
@@ -119,13 +120,15 @@ async def test_send_message_outliers(self):
119120
mock_session.return_value = async_mock.MagicMock(
120121
receive=async_mock.CoroutineMock(
121122
return_value=async_mock.MagicMock(
122-
receipt=async_mock.MagicMock(direct_response_requested=True)
123+
receipt=async_mock.MagicMock(direct_response_requested=True),
124+
wait_processing_complete=async_mock.CoroutineMock(),
123125
)
124126
),
125127
can_respond=True,
126128
profile=InMemoryProfile.test_profile(),
127129
clear_response=async_mock.MagicMock(),
128130
wait_response=async_mock.CoroutineMock(return_value=b"Hello world"),
131+
response_buffer="something",
129132
)
130133
async with self.client.post("/", data=test_message) as resp:
131134
result = await resp.text()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import asyncio
2+
3+
from asynctest import TestCase
4+
5+
from ..message import InboundMessage
6+
from ..receipt import MessageReceipt
7+
8+
9+
class TestInboundMessage(TestCase):
10+
async def test_wait_response(self):
11+
message = InboundMessage(
12+
payload="test",
13+
connection_id="conn_id",
14+
receipt=MessageReceipt(),
15+
session_id="session_id",
16+
)
17+
assert not message.processing_complete_event.is_set()
18+
message.dispatch_processing_complete()
19+
assert message.processing_complete_event.is_set()
20+
21+
message = InboundMessage(
22+
payload="test",
23+
connection_id="conn_id",
24+
receipt=MessageReceipt(),
25+
session_id="session_id",
26+
)
27+
assert not message.processing_complete_event.is_set()
28+
task = message.wait_processing_complete()
29+
message.dispatch_processing_complete()
30+
await asyncio.wait_for(task, 1)

docs/GettingStartedAriesDev/CredentialRevocation.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,33 @@ further customize notification handling.
151151
If the argument `--monitor-revocation-notification` is used on startup, a
152152
webhook with the topic `revocation-notification` and a payload containing the
153153
thread ID and comment is emitted to registered webhook urls.
154+
155+
## Manually Creating Revocation Registries
156+
157+
The process for creating revocation registries is completely automated - when you create a Credential Definition with revocation enabled, a revocation registry is automatically created (in fact 2 registries are created), and when a registry fills up, a new one is automatically created.
158+
159+
However the Aca-Py admin api supports endpoints to explicitely create a new revocation registry, if you desire.
160+
161+
There are several endpoints that must be called, and they must be called in this order:
162+
163+
1. Create revoc registry `POST /revocation/create-registry`
164+
165+
- you need to provide the credential definition id and the size of the registry
166+
167+
2. Fix the tails file URI `PATCH /revocation/registry/{rev_reg_id}`
168+
169+
- here you need to provide the full URI that will be written to the ledger, for example:
170+
171+
```
172+
{
173+
"tails_public_uri": "http://host.docker.internal:6543/VDKEEMMSRTEqK4m7iiq5ZL:4:VDKEEMMSRTEqK4m7iiq5ZL:3:CL:8:faber.agent.degree_schema:CL_ACCUM:3cb5c439-928c-483c-a9a8-629c307e6b2d"
174+
}
175+
```
176+
177+
3. Post the revoc def to the ledger `POST /revocation/registry/{rev_reg_id}/definition`
178+
179+
- if you are an author (i.e. have a DID with restricted ledger write access) then this transaction may need to go through an endorser
180+
181+
4. Write the tails file `PUT /revocation/registry/{rev_reg_id}/tails-file`
182+
183+
- the tails server will check that the registry definition is already written to the ledger

0 commit comments

Comments
 (0)