Skip to content

Commit

Permalink
fix: consider all resolvable dids in invites "public"
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
  • Loading branch information
dbluhm committed Apr 17, 2024
1 parent 33cb2e9 commit 17ea7f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
5 changes: 1 addition & 4 deletions aries_cloudagent/connections/models/conn_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,7 @@ async def find_existing_connection(
session: The active profile session
their_public_did: Inviter public DID (or did:peer)
"""
if their_public_did.startswith("did:peer"):
tag_filter = {"their_did": their_public_did}
else:
tag_filter = {"their_public_did": their_public_did}
tag_filter = {"their_public_did": their_public_did}
conn_records = await cls.query(
session,
tag_filter=tag_filter,
Expand Down
16 changes: 11 additions & 5 deletions aries_cloudagent/protocols/out_of_band/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,14 +705,16 @@ async def receive_invitation(
if (
public_did is not None and use_existing_connection
): # invite has public DID: seek existing connection
LOGGER.debug(
"Trying to find existing connection for oob invitation with "
f"did {public_did}"
)
if public_did.startswith("did:peer:4"):
search_public_did = self.long_did_peer_to_short(public_did)
else:
search_public_did = public_did

LOGGER.debug(
"Trying to find existing connection for oob invitation with "
f"did {search_public_did}"
)

async with self._profile.session() as session:
conn_rec = await ConnRecord.find_existing_connection(
session=session, their_public_did=search_public_did
Expand Down Expand Up @@ -1046,7 +1048,11 @@ async def _perform_handshake(
# in an out-of-band message (RFC 0434).
# OR did:peer:2 or did:peer:4.

if not service.startswith("did:peer"):
if service.startswith("did:peer"):
public_did = service
if public_did.startswith("did:peer:4"):
public_did = self.long_did_peer_to_short(public_did)
else:
public_did = service.split(":")[-1]

# TODO: resolve_invitation should resolve key_info objects
Expand Down

0 comments on commit 17ea7f5

Please sign in to comment.