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

Commit 9d2c890

Browse files
committed
Rename get_server_keys_json to get_server_keys_json_for_remote.
1 parent 1270a5d commit 9d2c890

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

synapse/rest/key/v2/remote_key_resource.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def query_keys(
155155
for key_id in key_ids:
156156
store_queries.append((server_name, key_id, None))
157157

158-
cached = await self.store.get_server_keys_json(store_queries)
158+
cached = await self.store.get_server_keys_json_for_remote(store_queries)
159159

160160
json_results: Set[bytes] = set()
161161

synapse/storage/databases/main/keys.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,18 @@ async def store_server_keys_json(
181181
desc="store_server_keys_json",
182182
)
183183

184-
async def get_server_keys_json(
184+
async def get_server_keys_json_for_remote(
185185
self, server_keys: Iterable[Tuple[str, Optional[str], Optional[str]]]
186186
) -> Dict[Tuple[str, Optional[str], Optional[str]], List[Dict[str, Any]]]:
187187
"""Retrieve the key json for a list of server_keys and key ids.
188188
If no keys are found for a given server, key_id and source then
189189
that server, key_id, and source triplet entry will be an empty list.
190190
The JSON is returned as a byte array so that it can be efficiently
191191
used in an HTTP response.
192+
192193
Args:
193194
server_keys: List of (server_name, key_id, source) triplets.
195+
194196
Returns:
195197
A mapping from (server_name, key_id, source) triplets to a list of dicts
196198
"""

tests/crypto/test_keyring.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ async def get_json(destination: str, path: str, **kwargs: Any) -> JsonDict:
464464
# check that the perspectives store is correctly updated
465465
lookup_triplet = (SERVER_NAME, testverifykey_id, None)
466466
key_json = self.get_success(
467-
self.hs.get_datastores().main.get_server_keys_json([lookup_triplet])
467+
self.hs.get_datastores().main.get_server_keys_json_for_remote([lookup_triplet])
468468
)
469469
res_keys = key_json[lookup_triplet]
470470
self.assertEqual(len(res_keys), 1)
@@ -582,7 +582,9 @@ def test_get_keys_from_perspectives(self) -> None:
582582
# check that the perspectives store is correctly updated
583583
lookup_triplet = (SERVER_NAME, testverifykey_id, None)
584584
key_json = self.get_success(
585-
self.hs.get_datastores().main.get_server_keys_json([lookup_triplet])
585+
self.hs.get_datastores().main.get_server_keys_json_for_remote(
586+
[lookup_triplet]
587+
)
586588
)
587589
res_keys = key_json[lookup_triplet]
588590
self.assertEqual(len(res_keys), 1)
@@ -703,7 +705,9 @@ def test_get_perspectives_own_key(self) -> None:
703705
# check that the perspectives store is correctly updated
704706
lookup_triplet = (SERVER_NAME, testverifykey_id, None)
705707
key_json = self.get_success(
706-
self.hs.get_datastores().main.get_server_keys_json([lookup_triplet])
708+
self.hs.get_datastores().main.get_server_keys_json_for_remote(
709+
[lookup_triplet]
710+
)
707711
)
708712
res_keys = key_json[lookup_triplet]
709713
self.assertEqual(len(res_keys), 1)

0 commit comments

Comments
 (0)