From ee017b7302da804034c891c1dbf4a82689fae48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 9 Dec 2021 13:15:54 +0100 Subject: [PATCH] rust: Bump the sdk version This updates the rust-sdk to support fallback keys, note that fallback keys are not yet uploaded, they just can be used when downloaded and info about the fallback keys coming from a sync can be passed to the rust side. --- .../org/matrix/android/sdk/internal/crypto/OlmMachine.kt | 4 +++- rust-sdk/Cargo.toml | 6 +++--- rust-sdk/src/machine.rs | 5 +++++ rust-sdk/src/olm.udl | 3 ++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt index 16ca58a8fa..b3cb03d657 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt @@ -309,7 +309,9 @@ internal class OlmMachine( MoshiProvider.providesMoshi().adapter(ToDeviceSyncResponse::class.java) val events = adapter.toJson(toDevice ?: ToDeviceSyncResponse())!! - adapter.fromJson(inner.receiveSyncChanges(events, devices, counts)) ?: ToDeviceSyncResponse() + // TODO once our sync response type parses the unused fallback key + // field pass in the list of unused fallback keys here + adapter.fromJson(inner.receiveSyncChanges(events, devices, counts, unusedFallbackKeys = null)) ?: ToDeviceSyncResponse() } // We may get cross signing keys over a to-device event, update our listeners. diff --git a/rust-sdk/Cargo.toml b/rust-sdk/Cargo.toml index 203ceec70f..11c5d47ccd 100644 --- a/rust-sdk/Cargo.toml +++ b/rust-sdk/Cargo.toml @@ -29,11 +29,11 @@ features = ["lax_deserialize"] [dependencies.matrix-sdk-common] git = "https://github.com/matrix-org/matrix-rust-sdk/" -rev = "8494f105837af824f4637c05e9e01b0854d7109b" +rev = "009ead2eeaf365e1fb0f790557f20d4eaf6874ae" [dependencies.matrix-sdk-crypto] git = "https://github.com/matrix-org/matrix-rust-sdk/" -rev = "8494f105837af824f4637c05e9e01b0854d7109b" +rev = "009ead2eeaf365e1fb0f790557f20d4eaf6874ae" features = ["sled_cryptostore", "qrcode", "backups_v1"] [dependencies.tokio] @@ -43,7 +43,7 @@ features = ["rt-multi-thread"] [dependencies.ruma] git = "https://github.com/ruma/ruma" -rev = "6c4892664" +rev = "fdbc4d6d1dd273c8a6ac95b329943ed8c68df70d" features = ["client-api-c"] [build-dependencies] diff --git a/rust-sdk/src/machine.rs b/rust-sdk/src/machine.rs index 0c0947fe9e..441322dca2 100644 --- a/rust-sdk/src/machine.rs +++ b/rust-sdk/src/machine.rs @@ -344,6 +344,7 @@ impl OlmMachine { events: &str, device_changes: DeviceLists, key_counts: HashMap, + unused_fallback_keys: Option>, ) -> Result { let events: ToDevice = serde_json::from_str(events)?; let device_changes: RumaDeviceLists = device_changes.into(); @@ -359,10 +360,14 @@ impl OlmMachine { }) .collect(); + let unused_fallback_keys: Option> = + unused_fallback_keys.map(|u| u.into_iter().map(DeviceKeyAlgorithm::from).collect()); + let events = self.runtime.block_on(self.inner.receive_sync_changes( events, &device_changes, &key_counts, + unused_fallback_keys.as_deref(), ))?; Ok(serde_json::to_string(&events)?) diff --git a/rust-sdk/src/olm.udl b/rust-sdk/src/olm.udl index 675dc466e6..4adbdd98b9 100644 --- a/rust-sdk/src/olm.udl +++ b/rust-sdk/src/olm.udl @@ -244,7 +244,8 @@ interface OlmMachine { [Throws=CryptoStoreError] string receive_sync_changes([ByRef] string events, DeviceLists device_changes, - record key_counts); + record key_counts, + sequence? unused_fallback_keys); [Throws=CryptoStoreError] sequence outgoing_requests(); [Throws=CryptoStoreError]