Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit bab3b58

Browse files
author
David Robertson
committed
Comments
1 parent 8c50676 commit bab3b58

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

synapse/crypto/keyring.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ async def _inner_fetch_key_request(
471471

472472

473473
class KeyFetcher(metaclass=abc.ABCMeta):
474+
"""Abstract gadget for fetching keys to validate other homeservers' signatures."""
475+
474476
def __init__(self, hs: "HomeServer"):
475477
self._queue = BatchingQueue(
476478
self.__class__.__name__, hs.get_clock(), self._fetch_keys
@@ -492,11 +494,15 @@ async def get_keys(
492494
async def _fetch_keys(
493495
self, keys_to_fetch: List[_FetchKeyRequest]
494496
) -> Dict[str, Dict[str, FetchKeyResult]]:
497+
"""
498+
Returns:
499+
Map from server_name -> key_id -> FetchKeyResult
500+
"""
495501
pass
496502

497503

498504
class StoreKeyFetcher(KeyFetcher):
499-
"""KeyFetcher impl which fetches keys from our data store"""
505+
"""Try to retrieve a previously-fetched key from the DB."""
500506

501507
def __init__(self, hs: "HomeServer"):
502508
super().__init__(hs)
@@ -520,6 +526,8 @@ async def _fetch_keys(
520526

521527

522528
class BaseV2KeyFetcher(KeyFetcher):
529+
"""Abstract helper. Fetch keys by requesting it from some server."""
530+
523531
def __init__(self, hs: "HomeServer"):
524532
super().__init__(hs)
525533

@@ -622,7 +630,10 @@ async def process_v2_response(
622630

623631

624632
class PerspectivesKeyFetcher(BaseV2KeyFetcher):
625-
"""KeyFetcher impl which fetches keys from the "perspectives" servers"""
633+
"""Fetch keys for some homeserver X by requesting them from a trusted key server Y.
634+
635+
These trusted key servers were seemingly once known as "perspectives" servers.
636+
"""
626637

627638
def __init__(self, hs: "HomeServer"):
628639
super().__init__(hs)
@@ -805,7 +816,7 @@ def _validate_perspectives_response(
805816

806817

807818
class ServerKeyFetcher(BaseV2KeyFetcher):
808-
"""KeyFetcher impl which fetches keys from the origin servers"""
819+
"""Fetch keys for some homeserver X by requesting them directly from X."""
809820

810821
def __init__(self, hs: "HomeServer"):
811822
super().__init__(hs)

0 commit comments

Comments
 (0)