Keyring: isolate the keyfetching mechanism
So I can call it from federation senders
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user