From 9851fcec80df91f5cb810be13f4f92265ed5f28d Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Sun, 13 Mar 2022 12:26:47 +0100 Subject: [PATCH] fix: auto accept for acapy Signed-off-by: Timo Glastra --- aries-backchannels/acapy/acapy_backchannel.py | 4 +++- .../acapy/routes/mediation_routes.py | 15 ++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/aries-backchannels/acapy/acapy_backchannel.py b/aries-backchannels/acapy/acapy_backchannel.py index 79b7f6ff8..8e2df0787 100644 --- a/aries-backchannels/acapy/acapy_backchannel.py +++ b/aries-backchannels/acapy/acapy_backchannel.py @@ -218,7 +218,7 @@ def get_agent_args(self): ("--label", self.label), # "--auto-ping-connection", # "--auto-accept-invites", - # "--auto-accept-requests", + "--auto-accept-requests", # "--auto-respond-messages", # "--auto-respond-credential-proposal", # "--auto-respond-credential-offer", @@ -231,6 +231,8 @@ def get_agent_args(self): ("--wallet-type", self.wallet_type), ("--wallet-name", self.wallet_name), ("--wallet-key", self.wallet_key), + "--open-mediation", + "--enable-undelivered-queue" ] # Backchannel needs to handle operations that may be called in the protocol by the tests diff --git a/aries-backchannels/acapy/routes/mediation_routes.py b/aries-backchannels/acapy/routes/mediation_routes.py index 9bc68c00f..25022c4fb 100644 --- a/aries-backchannels/acapy/routes/mediation_routes.py +++ b/aries-backchannels/acapy/routes/mediation_routes.py @@ -98,23 +98,12 @@ async def mediation_send_grant(request: web.Request): connection_id: str = body.get("id") backchannel: "AcaPyAgentBackchannel" = request["backchannel"] - # This seems to need a sleep to work - sleep(2) - mediation_record = await get_mediation_record_by_connection_id( backchannel, connection_id ) - mediation_id = mediation_record["mediation_id"] - - (resp_status, resp_text) = await backchannel.admin_POST( - f"/mediation/requests/{mediation_id}/grant", {} - ) - if resp_status != 201: - return web.Response(text=resp_text, status=resp_status) - - resp_json = json.loads(resp_text) - return web.json_response(mediation_record_to_response(resp_json)) + # Auto accept is enabled, so we're not granting the mediation explicitly + return web.json_response(mediation_record_to_response(mediation_record)) @routes.post("/agent/command/mediation/send-deny/")