Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Chatterji <[email protected]>
  • Loading branch information
codespree authored and dbluhm committed Oct 16, 2023
1 parent b1eb224 commit 718e74c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions aries_cloudagent/resolver/default/legacy_peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,17 @@ def recip_base58_to_ref(vms: List[dict], recip: str) -> str:
return recip

@classmethod
def didcomm_services_recip_keys_are_refs_routing_keys_are_did_key(
def did_key_to_did_key_ref(cls, key:str):
# Check if key is already a ref
if key.rfind("#") != -1:
return key
# Get the value after removing did:key:
value = key.replace("did:key:", "")

return key + "#" + value

@classmethod
def didcomm_services_recip_keys_are_refs_routing_keys_are_did_key_ref(
cls,
value: dict,
) -> dict:
Expand All @@ -150,9 +160,9 @@ def didcomm_services_recip_keys_are_refs_routing_keys_are_did_key(
]
if "routingKeys" in service:
service["routingKeys"] = [
DIDKey.from_public_key_b58(key, ED25519).key_id
cls.did_key_to_did_key_ref(DIDKey.from_public_key_b58(key, ED25519).key_id)
if "did:key:" not in key
else key
else cls.did_key_to_did_key_ref(key)
for key in service["routingKeys"]
]
return value
Expand Down Expand Up @@ -235,7 +245,7 @@ def apply(cls, value: dict) -> dict:
cls.fully_qualified_ids_and_controllers,
cls.didcomm_services_use_updated_conventions,
cls.remove_routing_keys_from_verification_method,
cls.didcomm_services_recip_keys_are_refs_routing_keys_are_did_key,
cls.didcomm_services_recip_keys_are_refs_routing_keys_are_did_key_ref,
):
value = correction(value)

Expand Down

0 comments on commit 718e74c

Please sign in to comment.