diff --git a/aries_cloudagent/resolver/did_resolver.py b/aries_cloudagent/resolver/did_resolver.py index 60dcdf0efe..7fcc4dec82 100644 --- a/aries_cloudagent/resolver/did_resolver.py +++ b/aries_cloudagent/resolver/did_resolver.py @@ -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): @@ -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) diff --git a/aries_cloudagent/resolver/tests/test_did_resolver.py b/aries_cloudagent/resolver/tests/test_did_resolver.py index 166bb982d1..315cc7318f 100644 --- a/aries_cloudagent/resolver/tests/test_did_resolver.py +++ b/aries_cloudagent/resolver/tests/test_did_resolver.py @@ -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 )