diff --git a/synapse/crypto/keyring.py b/synapse/crypto/keyring.py index 69310d90351c..afd75287a686 100644 --- a/synapse/crypto/keyring.py +++ b/synapse/crypto/keyring.py @@ -154,8 +154,11 @@ def __init__( if key_fetchers is None: key_fetchers = ( + # Fetch keys from the database. StoreKeyFetcher(hs), + # Fetch keys from a configured Perspectives server. PerspectivesKeyFetcher(hs), + # Fetch keys from the origin server directly. ServerKeyFetcher(hs), ) self._key_fetchers = key_fetchers @@ -279,6 +282,10 @@ async def process_request(self, verify_request: VerifyJsonRequest) -> None: key_ids_to_find = set(verify_request.key_ids) - found_keys.keys() if key_ids_to_find: + # We're still missing some keys. Consult each of our `KeyFetcher` instances + # (stored in `self._key_fetchers`) to try and find them. Key fetch attempts + # are queued via `self._server_queue` below. + # Add the keys we need to verify to the queue for retrieval. We queue # up requests for the same server so we don't end up with many in flight # requests for the same keys.