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

Commit 7da24b9

Browse files
authored
Always send device_one_time_keys_count (#10457)
As per comment Fixes #10456 See also element-hq/element-android#3725
1 parent 519ec82 commit 7da24b9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

changelog.d/10457.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

synapse/rest/client/v2_alpha/sync.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,13 @@ async def encode_response(self, time_now, sync_result, access_token_id, filter):
252252
if sync_result.device_lists.left:
253253
response["device_lists"]["left"] = list(sync_result.device_lists.left)
254254

255-
if sync_result.device_one_time_keys_count:
256-
response[
257-
"device_one_time_keys_count"
258-
] = sync_result.device_one_time_keys_count
255+
# We always include this because https://github.com/vector-im/element-android/issues/3725
256+
# The spec isn't terribly clear on when this can be omitted and how a client would tell
257+
# the difference between "no keys present" and "nothing changed" in terms of whole field
258+
# absent / individual key type entry absent
259+
# Corresponding synapse issue: https://github.com/matrix-org/synapse/issues/10456
260+
response["device_one_time_keys_count"] = sync_result.device_one_time_keys_count
261+
259262
if sync_result.device_unused_fallback_key_types:
260263
response[
261264
"org.matrix.msc2732.device_unused_fallback_key_types"

0 commit comments

Comments
 (0)