Skip to content

Commit

Permalink
chore: rename dereference_external -> dereference
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <[email protected]>
  • Loading branch information
dbluhm committed Feb 4, 2021
1 parent 28049d1 commit e4ba21f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions aries_cloudagent/resolver/did_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ async def resolve(
self, profile: Profile, did: Union[str, DID]
) -> ResolvedDIDDoc:
"""Retrieve did doc from public registry."""
# TODO Cache results
if isinstance(did, str):
did = DID(did)
for resolver in self._match_did_to_resolver(did):
Expand Down Expand Up @@ -61,10 +62,11 @@ def _match_did_to_resolver(self, did: DID) -> BaseDIDResolver:
raise DIDMethodNotSupported(f"{did.method} not supported")
return resolvers

async def dereference_external(
async def dereference(
self, profile: Profile, did_url: str
) -> ResolvedDIDDoc:
"""Retrieve an external did in doc service from a public registry."""
"""Dereference a DID URL to its corresponding DID Doc object."""
# TODO Use cached DID Docs when possible
did_url = DIDUrl.parse(did_url)
doc = await self.resolve(profile, did_url.did)
return doc.dereference(did_url)
4 changes: 2 additions & 2 deletions aries_cloudagent/resolver/tests/test_did_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ def test_match_did_to_resolver_registration_order():


@pytest.mark.asyncio
async def test_dereference_external(resolver, profile):
async def test_dereference(resolver, profile):
url = "did:example:1234abcd#4"
assert DOC["verificationMethod"][1] == await resolver.dereference_external(
assert DOC["verificationMethod"][1] == await resolver.dereference(
profile, url
)

Expand Down

0 comments on commit e4ba21f

Please sign in to comment.