Skip to content

Commit

Permalink
fix: auto accept for acapy
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Mar 13, 2022
1 parent b697371 commit 9851fce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
4 changes: 3 additions & 1 deletion aries-backchannels/acapy/acapy_backchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down
15 changes: 2 additions & 13 deletions aries-backchannels/acapy/routes/mediation_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down

0 comments on commit 9851fce

Please sign in to comment.