@@ -471,6 +471,8 @@ async def _inner_fetch_key_request(
471
471
472
472
473
473
class KeyFetcher (metaclass = abc .ABCMeta ):
474
+ """Abstract gadget for fetching keys to validate other homeservers' signatures."""
475
+
474
476
def __init__ (self , hs : "HomeServer" ):
475
477
self ._queue = BatchingQueue (
476
478
self .__class__ .__name__ , hs .get_clock (), self ._fetch_keys
@@ -492,11 +494,15 @@ async def get_keys(
492
494
async def _fetch_keys (
493
495
self , keys_to_fetch : List [_FetchKeyRequest ]
494
496
) -> Dict [str , Dict [str , FetchKeyResult ]]:
497
+ """
498
+ Returns:
499
+ Map from server_name -> key_id -> FetchKeyResult
500
+ """
495
501
pass
496
502
497
503
498
504
class StoreKeyFetcher (KeyFetcher ):
499
- """KeyFetcher impl which fetches keys from our data store """
505
+ """Try to retrieve a previously-fetched key from the DB. """
500
506
501
507
def __init__ (self , hs : "HomeServer" ):
502
508
super ().__init__ (hs )
@@ -520,6 +526,8 @@ async def _fetch_keys(
520
526
521
527
522
528
class BaseV2KeyFetcher (KeyFetcher ):
529
+ """Abstract helper. Fetch keys by requesting it from some server."""
530
+
523
531
def __init__ (self , hs : "HomeServer" ):
524
532
super ().__init__ (hs )
525
533
@@ -622,7 +630,10 @@ async def process_v2_response(
622
630
623
631
624
632
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
+ """
626
637
627
638
def __init__ (self , hs : "HomeServer" ):
628
639
super ().__init__ (hs )
@@ -805,7 +816,7 @@ def _validate_perspectives_response(
805
816
806
817
807
818
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. """
809
820
810
821
def __init__ (self , hs : "HomeServer" ):
811
822
super ().__init__ (hs )
0 commit comments