From 2ff55e02c1617e0bc61d482aba0bd9cd05d38dc9 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 16 Apr 2020 17:59:47 +0100 Subject: [PATCH] Add comment explaining why this is useful --- synapse/handlers/e2e_keys.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/synapse/handlers/e2e_keys.py b/synapse/handlers/e2e_keys.py index 1df1f85c4e..afeb6121f9 100644 --- a/synapse/handlers/e2e_keys.py +++ b/synapse/handlers/e2e_keys.py @@ -980,7 +980,7 @@ class E2eKeysHandler(object): Raises: NotFoundError: if the key is not found - SynapseError: if the user_id is invalid + SynapseError: if `user_id` is invalid """ user = UserID.from_string(user_id) key = yield self.store.get_e2e_cross_signing_key( @@ -989,6 +989,11 @@ class E2eKeysHandler(object): # If we still can't find the key, and we're looking for keys of another user, # then attempt to fetch the missing key from the remote user's server. + # + # We may run into this in possible edge cases where a user tries to + # cross-sign a remote user, but does not share any rooms with them yet. + # Thus, we would not have their key list yet. We fetch the key here and + # store it just in case. if ( key is None and not self.is_mine(user)