diff options
-rw-r--r-- | synapse/crypto/keyring.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/crypto/keyring.py b/synapse/crypto/keyring.py index 8e8dbaaf55..b5b57378ef 100644 --- a/synapse/crypto/keyring.py +++ b/synapse/crypto/keyring.py @@ -273,9 +273,7 @@ class Keyring: minimum_valid_until_ts=verify_request.minimum_valid_until_ts, key_ids=list(key_ids_to_find), ) - found_keys_by_server = await self._fetch_keys_queue.add_to_queue( - key_request, key=verify_request.server_name - ) + found_keys_by_server = await self.fetch_keys(key_request) # Since we batch up requests the returned set of keys may contain keys # from other servers, so we pull out only the ones we care about. @@ -302,6 +300,15 @@ class Keyring: Codes.UNAUTHORIZED, ) + async def fetch_keys( + self, key_request: _FetchKeyRequest + ) -> Dict[str, Dict[str, FetchKeyResult]]: + """Returns: {server name: {key id: fetch key result}}""" + found_keys_by_server = await self._fetch_keys_queue.add_to_queue( + key_request, key=key_request.server_name + ) + return found_keys_by_server + async def _process_json( self, verify_key: VerifyKey, verify_request: VerifyJsonRequest ) -> None: |