From 4bd75f1bd89e48a75e60c00eef920e1e44aab5a7 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Sat, 22 Oct 2022 19:17:35 +0100 Subject: [PATCH] allowing the one time keys count to be optional - for dendrite the field is provided in later syncs --- .../app/dapk/st/matrix/sync/internal/request/ApiSyncResponse.kt | 2 +- .../app/dapk/st/matrix/sync/internal/room/SyncSideEffects.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/request/ApiSyncResponse.kt b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/request/ApiSyncResponse.kt index 2bc14c2..39b8a90 100644 --- a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/request/ApiSyncResponse.kt +++ b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/request/ApiSyncResponse.kt @@ -13,7 +13,7 @@ internal data class ApiSyncResponse( @SerialName("account_data") val accountData: ApiAccountData? = null, @SerialName("rooms") val rooms: ApiSyncRooms? = null, @SerialName("to_device") val toDevice: ToDevice? = null, - @SerialName("device_one_time_keys_count") val oneTimeKeysCount: Map, + @SerialName("device_one_time_keys_count") val oneTimeKeysCount: Map? = null, @SerialName("next_batch") val nextBatch: SyncToken, @SerialName("prev_batch") val prevBatch: SyncToken? = null, ) diff --git a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/room/SyncSideEffects.kt b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/room/SyncSideEffects.kt index f08dd1d..ad02e65 100644 --- a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/room/SyncSideEffects.kt +++ b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/room/SyncSideEffects.kt @@ -28,7 +28,7 @@ internal class SyncSideEffects( notifyDevicesUpdated.notifyChanges(it, requestToken) } - oneTimeKeyProducer.onServerKeyCount(response.oneTimeKeysCount["signed_curve25519"] ?: ServerKeyCount(0)) + oneTimeKeyProducer.onServerKeyCount(response.oneTimeKeysCount?.get("signed_curve25519") ?: ServerKeyCount(0)) val decryptedToDeviceEvents = decryptedToDeviceEvents(response) val roomKeys = handleRoomKeyShares(decryptedToDeviceEvents)