From 9e43317ba96a4e12a336849975e472a0dec6f5d6 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Mon, 11 Apr 2022 14:39:17 -0700 Subject: [PATCH 1/2] Use provided connection_id if provided Signed-off-by: Ian Costanzo --- aries_cloudagent/wallet/routes.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/aries_cloudagent/wallet/routes.py b/aries_cloudagent/wallet/routes.py index a7772be595..1c23f01fbd 100644 --- a/aries_cloudagent/wallet/routes.py +++ b/aries_cloudagent/wallet/routes.py @@ -441,7 +441,12 @@ async def wallet_set_public_did(request: web.BaseRequest): info: DIDInfo = None try: info, attrib_def = await promote_wallet_public_did( - context.profile, context, context.session, did, write_ledger=write_ledger + context.profile, + context, + context.session, + did, + write_ledger=write_ledger, + connection_id=connection_id, ) except LookupError as err: raise web.HTTPNotFound(reason=str(err)) from err @@ -487,6 +492,7 @@ async def promote_wallet_public_did( session_fn, did: str, write_ledger: bool = False, + connection_id: str = None, ) -> DIDInfo: """Promote supplied DID to the wallet public DID.""" @@ -512,7 +518,8 @@ async def promote_wallet_public_did( write_ledger = False # author has not provided a connection id, so determine which to use - connection_id = await get_endorser_connection_id(context.profile) + if not connection_id: + connection_id = await get_endorser_connection_id(context.profile) if not connection_id: raise web.HTTPBadRequest(reason="No endorser connection found") @@ -785,10 +792,12 @@ async def on_register_nym_event(profile: Profile, event: Event): if is_author_role(profile) and profile.context.settings.get_value( "endorser.auto_promote_author_did" ): + print(">>> payload =", event.payload) did = event.payload["did"] + connection_id = event.payload.get("connection_id") try: await promote_wallet_public_did( - profile, profile.context, profile.session, did + profile, profile.context, profile.session, did, connection_id ) except Exception: # log the error, but continue From 9296ff35a78a14c9f643d1d0cfa991f0b98115b1 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Tue, 12 Apr 2022 09:56:14 -0700 Subject: [PATCH 2/2] Remove debugging Signed-off-by: Ian Costanzo --- aries_cloudagent/wallet/routes.py | 1 - 1 file changed, 1 deletion(-) diff --git a/aries_cloudagent/wallet/routes.py b/aries_cloudagent/wallet/routes.py index 1c23f01fbd..0acff9d4cc 100644 --- a/aries_cloudagent/wallet/routes.py +++ b/aries_cloudagent/wallet/routes.py @@ -792,7 +792,6 @@ async def on_register_nym_event(profile: Profile, event: Event): if is_author_role(profile) and profile.context.settings.get_value( "endorser.auto_promote_author_did" ): - print(">>> payload =", event.payload) did = event.payload["did"] connection_id = event.payload.get("connection_id") try: