summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-07-22 15:42:45 +0100
committerErik Johnston <erik@matrix.org>2021-07-22 15:42:45 +0100
commit4565063e361602613b95716a44f8565a689c9b5d (patch)
treef4d7b0d911ffe34472dff9e42291793396e9b6d8
parentMove the docker image build to Github Actions (#10416) (diff)
parentAlways send device_one_time_keys_count (#10457) (diff)
downloadsynapse-4565063e361602613b95716a44f8565a689c9b5d.tar.xz
Merge commit '7da24b975dfb10c277cf963dfddb88f55b1ca598' into release-v1.39
-rw-r--r--changelog.d/10457.bugfix1
-rw-r--r--synapse/rest/client/v2_alpha/sync.py11
2 files changed, 8 insertions, 4 deletions
diff --git a/changelog.d/10457.bugfix b/changelog.d/10457.bugfix
new file mode 100644
index 0000000000..ec950b5846
--- /dev/null
+++ b/changelog.d/10457.bugfix
@@ -0,0 +1 @@
+Always include `device_one_time_keys_count` key in `/sync` response to work around a bug in Element Android that broke encryption for new devices.
diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py
index ecbbcf3851..32e8500795 100644
--- a/synapse/rest/client/v2_alpha/sync.py
+++ b/synapse/rest/client/v2_alpha/sync.py
@@ -252,10 +252,13 @@ class SyncRestServlet(RestServlet):
         if sync_result.device_lists.left:
             response["device_lists"]["left"] = list(sync_result.device_lists.left)
 
-        if sync_result.device_one_time_keys_count:
-            response[
-                "device_one_time_keys_count"
-            ] = sync_result.device_one_time_keys_count
+        # We always include this because https://github.com/vector-im/element-android/issues/3725
+        # The spec isn't terribly clear on when this can be omitted and how a client would tell
+        # the difference between "no keys present" and "nothing changed" in terms of whole field
+        # absent / individual key type entry absent
+        # Corresponding synapse issue: https://github.com/matrix-org/synapse/issues/10456
+        response["device_one_time_keys_count"] = sync_result.device_one_time_keys_count
+
         if sync_result.device_unused_fallback_key_types:
             response[
                 "org.matrix.msc2732.device_unused_fallback_key_types"