Skip to content

Commit

Permalink
fix: multiuse oob issues
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <[email protected]>
  • Loading branch information
dbluhm committed Mar 24, 2024
1 parent 33ca55c commit c031040
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 32 deletions.
27 changes: 10 additions & 17 deletions controller/protocols.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Defintions of protocols flows."""

import asyncio
import json
import logging
from secrets import randbelow, token_hex
Expand All @@ -10,7 +11,6 @@
from .models import (
AdminConfig,
ConnRecord,
ConnectionList,
CredAttrSpec,
Credential,
CredentialDefinitionSendRequest,
Expand Down Expand Up @@ -217,21 +217,6 @@ async def didexchange(
if not invite:
invite = await oob_invitation(inviter)

inviter_conn = (
await inviter.get(
"/connections",
params={"invitation_msg_id": invite.id},
response=ConnectionList,
)
).results[0]

inviter_oob_record = await inviter.record_with_values(
topic="out_of_band",
record_type=OobRecord,
connection_id=inviter_conn.connection_id,
state="await-response",
)

invitee_oob_record = await invitee.post(
"/out-of-band/receive-invitation",
json=invite,
Expand Down Expand Up @@ -261,13 +246,21 @@ async def didexchange(
f"/didexchange/{invitee_oob_record.connection_id}/accept-invitation",
response=ConnRecord,
)
# Overwrite multiuse invitation connection with actual connection
inviter_oob_record = await inviter.record_with_values(
topic="out_of_band",
invi_msg_id=invite.id,
state="done",
record_type=OobRecord,
)
inviter_conn = await inviter.record_with_values(
topic="connections",
record_type=ConnRecord,
rfc23_state="request-received",
invitation_key=inviter_oob_record.our_recipient_key,
)
# TODO Remove after ACA-Py 0.12.0
# There's a bug with race conditions in the OOB multiuse handling
await asyncio.sleep(1)
inviter_conn = await inviter.post(
f"/didexchange/{inviter_conn.connection_id}/accept-request",
response=ConnRecord,
Expand Down
19 changes: 4 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version: "3"
services:
alice:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.10.1
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0
# image: acapy-test-image
# build:
# context: .
Expand All @@ -15,12 +15,12 @@ services:
- ./configs:/configs:ro,z
command: >
start
--label Alice
--inbound-transport http 0.0.0.0 3000
--outbound-transport http
--endpoint http://alice:3000
--admin 0.0.0.0 3001
--admin-insecure-mode
--webhook-url http://webhook-listener:8080
--tails-server-base-url http://tails:6543
--genesis-url https://raw.githubusercontent.com/Indicio-tech/indicio-network/main/genesis_files/pool_transactions_testnet_genesis
--wallet-type askar
Expand All @@ -36,13 +36,11 @@ services:
timeout: 5s
retries: 5
depends_on:
webhook-listener:
condition: service_started
tails:
condition: service_started

bob:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.10.1
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0
# image: acapy-test-image
# build:
# context: .
Expand All @@ -55,12 +53,12 @@ services:
- ./configs:/configs:ro,z
command: >
start
--label Bob
--inbound-transport http 0.0.0.0 3000
--outbound-transport http
--endpoint http://bob:3000
--admin 0.0.0.0 3001
--admin-insecure-mode
--webhook-url http://webhook-listener:8080
--tails-server-base-url http://tails:6543
--genesis-url https://raw.githubusercontent.com/Indicio-tech/indicio-network/main/genesis_files/pool_transactions_testnet_genesis
--wallet-type askar
Expand All @@ -69,17 +67,13 @@ services:
--auto-provision
--log-level debug
--debug-webhooks
--webhook-url http://webhook-listener:8080
--monitor-revocation-notification
healthcheck:
test: curl -s -o /dev/null -w '%{http_code}' "http://localhost:3001/status/live" | grep "200" > /dev/null
start_period: 30s
interval: 7s
timeout: 5s
retries: 5
depends_on:
webhook-listener:
condition: service_started

tails:
image: ghcr.io/bcgov/tails-server:latest
Expand All @@ -94,11 +88,6 @@ services:
--storage-path /tmp/tails-files
--log-level INFO
webhook-listener:
image: mendhak/http-https-echo:18
environment:
- HTTP_PORT=8080

tests:
container_name: juggernaut
build:
Expand Down

0 comments on commit c031040

Please sign in to comment.