From db06a980da7bd979fd3b82c65e932d9ed6301f16 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Mon, 31 Jul 2023 17:10:55 -0400 Subject: [PATCH 1/3] fix: save conn rec before keylist update Signed-off-by: Daniel Bluhm --- aries_cloudagent/protocols/didexchange/v1_0/manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aries_cloudagent/protocols/didexchange/v1_0/manager.py b/aries_cloudagent/protocols/didexchange/v1_0/manager.py index 58a03d4a2c..abdb9180f5 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/manager.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/manager.py @@ -296,7 +296,10 @@ async def create_request( method=SOV, key_type=ED25519, ) - conn_rec.my_did = my_info.did + conn_rec.my_did = my_info.did + await conn_rec.save( + session, reason="New DID associated with connection." + ) # Idempotent; if routing has already been set up, no action taken await self._route_manager.route_connection_as_invitee( From 9811395a42725270cd9271cc17e183b027a85b08 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Mon, 31 Jul 2023 18:15:02 -0400 Subject: [PATCH 2/3] docs: small comment on record save Signed-off-by: Daniel Bluhm --- aries_cloudagent/protocols/didexchange/v1_0/manager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aries_cloudagent/protocols/didexchange/v1_0/manager.py b/aries_cloudagent/protocols/didexchange/v1_0/manager.py index abdb9180f5..bb378d52f0 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/manager.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/manager.py @@ -297,6 +297,8 @@ async def create_request( key_type=ED25519, ) conn_rec.my_did = my_info.did + # We must save to correlate routing key sent to mediator back + # to a connection. await conn_rec.save( session, reason="New DID associated with connection." ) From 8b5130aec8a22a6a58dd4720aaf11cdb5f5750a4 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Mon, 31 Jul 2023 18:27:32 -0400 Subject: [PATCH 3/3] fix: emit keylist update after existing save Signed-off-by: Daniel Bluhm --- .../protocols/didexchange/v1_0/manager.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/aries_cloudagent/protocols/didexchange/v1_0/manager.py b/aries_cloudagent/protocols/didexchange/v1_0/manager.py index bb378d52f0..cbfbabd339 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/manager.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/manager.py @@ -297,16 +297,6 @@ async def create_request( key_type=ED25519, ) conn_rec.my_did = my_info.did - # We must save to correlate routing key sent to mediator back - # to a connection. - await conn_rec.save( - session, reason="New DID associated with connection." - ) - - # Idempotent; if routing has already been set up, no action taken - await self._route_manager.route_connection_as_invitee( - self.profile, conn_rec, mediation_record - ) # Create connection request message if my_endpoint: @@ -352,6 +342,11 @@ async def create_request( async with self.profile.session() as session: await conn_rec.save(session, reason="Created connection request") + # Idempotent; if routing has already been set up, no action taken + await self._route_manager.route_connection_as_invitee( + self.profile, conn_rec, mediation_record + ) + return request async def receive_request(