Skip to content

Commit

Permalink
Use provided connection_id if provided
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Costanzo <[email protected]>
  • Loading branch information
ianco committed Apr 11, 2022
1 parent 5077299 commit 9e43317
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions aries_cloudagent/wallet/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."""

Expand All @@ -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")

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9e43317

Please sign in to comment.