Skip to content

Commit

Permalink
Merge pull request #1726 from ianco/fix/endorse-did
Browse files Browse the repository at this point in the history
Use provided connection_id if provided
  • Loading branch information
swcurran authored Apr 12, 2022
2 parents 9712d0d + 6e76073 commit 66735f3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 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 @@ -786,9 +793,10 @@ async def on_register_nym_event(profile: Profile, event: Event):
"endorser.auto_promote_author_did"
):
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 66735f3

Please sign in to comment.