Skip to content

Commit

Permalink
Add webhooks for OOB connection reuse
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Costanzo <[email protected]>
  • Loading branch information
ianco committed Jan 7, 2022
1 parent a974c63 commit 0049c4b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion aries_cloudagent/protocols/out_of_band/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

LOGGER = logging.getLogger(__name__)
REUSE_WEBHOOK_TOPIC = "acapy::webhook::connection_reuse"
REUSE_ACCEPTED_WEBHOOK_TOPIC = "acapy::webhook:connection_reuse_accepted"
REUSE_ACCEPTED_WEBHOOK_TOPIC = "acapy::webhook::connection_reuse_accepted"


class OutOfBandManagerError(BaseError):
Expand Down
16 changes: 10 additions & 6 deletions demo/runners/agent_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,18 @@ async def handle_oob_invitation(self, message):
pass

async def handle_connection_reuse(self, message):
print("handle_connection_reuse():", json.dumps(message))
# TODO we are reusing an existing connection, set our status to the existing connection
pass
# we are reusing an existing connection, set our status to the existing connection
if not self._connection_ready.done():
self.connection_id = message["connection_id"]
self.log("Connected")
self._connection_ready.set_result(True)

async def handle_connection_reuse_accepted(self, message):
print("handle_connection_reuse_accepted():", json.dumps(message))
# TODO we are reusing an existing connection, set our status to the existing connection
pass
# we are reusing an existing connection, set our status to the existing connection
if not self._connection_ready.done():
self.connection_id = message["connection_id"]
self.log("Connected")
self._connection_ready.set_result(True)

async def handle_connections(self, message):
# a bit of a hack, but for the mediator connection self._connection_ready
Expand Down
1 change: 0 additions & 1 deletion demo/runners/support/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,6 @@ async def handle_webhook(self, topic: str, payload, headers: dict):
handler = f"handle_{topic}"
wallet_id = headers.get("x-wallet-id")
method = getattr(self, handler, None)
print("Handling:", handler, payload)
if method:
EVENT_LOGGER.debug(
"Agent called controller webhook: %s%s%s%s",
Expand Down

0 comments on commit 0049c4b

Please sign in to comment.