summary refs log tree commit diff
path: root/synapse/handlers/e2e_keys.py
diff options
context:
space:
mode:
authorHugh Nimmo-Smith <hughns@users.noreply.github.com>2023-03-02 10:34:59 +0000
committerGitHub <noreply@github.com>2023-03-02 10:34:59 +0000
commit916b8061d20dc0902b7f2d42d994efc20300e9e7 (patch)
treebf06dc8e7e62246d70ae81879aa19bee173a25bc /synapse/handlers/e2e_keys.py
parentRemove support for aggregating reactions (#15172) (diff)
downloadsynapse-916b8061d20dc0902b7f2d42d994efc20300e9e7.tar.xz
Implementation of MSC3967: Don't require UIA for initial upload of cross signing keys (#15077)
Diffstat (limited to 'synapse/handlers/e2e_keys.py')
-rw-r--r--synapse/handlers/e2e_keys.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/handlers/e2e_keys.py b/synapse/handlers/e2e_keys.py
index 43cbece21b..4e9c8d8db0 100644
--- a/synapse/handlers/e2e_keys.py
+++ b/synapse/handlers/e2e_keys.py
@@ -1301,6 +1301,20 @@ class E2eKeysHandler:
 
         return desired_key_data
 
+    async def is_cross_signing_set_up_for_user(self, user_id: str) -> bool:
+        """Checks if the user has cross-signing set up
+
+        Args:
+            user_id: The user to check
+
+        Returns:
+            True if the user has cross-signing set up, False otherwise
+        """
+        existing_master_key = await self.store.get_e2e_cross_signing_key(
+            user_id, "master"
+        )
+        return existing_master_key is not None
+
 
 def _check_cross_signing_key(
     key: JsonDict, user_id: str, key_type: str, signing_key: Optional[VerifyKey] = None