summary refs log tree commit diff
path: root/synapse/handlers/e2e_keys.py
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2020-10-06 13:26:29 -0400
committerGitHub <noreply@github.com>2020-10-06 13:26:29 -0400
commit3cd78bbe9e208d2e93ccebee5d3586ee5f5a5d31 (patch)
treef893c4e6a1e4129d6f79ed6cada0712ce0d545b8 /synapse/handlers/e2e_keys.py
parentAdditional tests for third-party event rules (#8468) (diff)
downloadsynapse-3cd78bbe9e208d2e93ccebee5d3586ee5f5a5d31.tar.xz
Add support for MSC2732: olm fallback keys (#8312)
Diffstat (limited to 'synapse/handlers/e2e_keys.py')
-rw-r--r--synapse/handlers/e2e_keys.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/handlers/e2e_keys.py b/synapse/handlers/e2e_keys.py
index dd40fd1299..611742ae72 100644
--- a/synapse/handlers/e2e_keys.py
+++ b/synapse/handlers/e2e_keys.py
@@ -496,6 +496,22 @@ class E2eKeysHandler:
             log_kv(
                 {"message": "Did not update one_time_keys", "reason": "no keys given"}
             )
+        fallback_keys = keys.get("org.matrix.msc2732.fallback_keys", None)
+        if fallback_keys and isinstance(fallback_keys, dict):
+            log_kv(
+                {
+                    "message": "Updating fallback_keys for device.",
+                    "user_id": user_id,
+                    "device_id": device_id,
+                }
+            )
+            await self.store.set_e2e_fallback_keys(user_id, device_id, fallback_keys)
+        elif fallback_keys:
+            log_kv({"message": "Did not update fallback_keys", "reason": "not a dict"})
+        else:
+            log_kv(
+                {"message": "Did not update fallback_keys", "reason": "no keys given"}
+            )
 
         # the device should have been registered already, but it may have been
         # deleted due to a race with a DELETE request. Or we may be using an