Skip to content

Commit

Permalink
feat: Add sliding sync timeline events and extensions (#1054)
Browse files Browse the repository at this point in the history
Add general extension framework for sliding sync, implementing the e2ee, to-device and account-data extensions as per existing proxy implementation. Add a new (ffi exposed) function to use activate the extensions.

Also extends jack-in to have permanent login and storage support now, rather than posting an access token and expose messages inside the sliding-sync layer to actually use the decrypted messages if given. Contains a lot of fixes around these aspects, too, like uploading any remaining messages from the olm-machine on every sliding-sync-request or processing even if no room data is present (which can happen now as processing only extensions might takes place).
  • Loading branch information
gnunicorn authored Oct 25, 2022
1 parent 2232092 commit a443e72
Show file tree
Hide file tree
Showing 24 changed files with 669 additions and 350 deletions.
109 changes: 109 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bindings/matrix-sdk-crypto-ffi/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl OlmMachine {
key_counts: HashMap<String, i32>,
unused_fallback_keys: Option<Vec<String>>,
) -> Result<String, CryptoStoreError> {
let events: ToDevice = serde_json::from_str(events)?;
let to_device: ToDevice = serde_json::from_str(events)?;
let device_changes: RumaDeviceLists = device_changes.into();
let key_counts: BTreeMap<DeviceKeyAlgorithm, UInt> = key_counts
.into_iter()
Expand All @@ -437,7 +437,7 @@ impl OlmMachine {
unused_fallback_keys.map(|u| u.into_iter().map(DeviceKeyAlgorithm::from).collect());

let events = self.runtime.block_on(self.inner.receive_sync_changes(
events,
to_device.events,
&device_changes,
&key_counts,
unused_fallback_keys.as_deref(),
Expand Down
2 changes: 1 addition & 1 deletion bindings/matrix-sdk-crypto-ffi/src/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use ruma::{
},
},
message::send_message_event::v3::Response as RoomMessageResponse,
sync::sync_events::v3::DeviceLists as RumaDeviceLists,
sync::sync_events::DeviceLists as RumaDeviceLists,
to_device::send_event_to_device::v3::Response as ToDeviceResponse,
},
assign,
Expand Down
4 changes: 2 additions & 2 deletions bindings/matrix-sdk-crypto-js/src/sync_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{identifiers, js::downcast};
#[wasm_bindgen]
#[derive(Debug)]
pub struct DeviceLists {
pub(crate) inner: ruma::api::client::sync::sync_events::v3::DeviceLists,
pub(crate) inner: ruma::api::client::sync::sync_events::DeviceLists,
}

#[wasm_bindgen]
Expand All @@ -19,7 +19,7 @@ impl DeviceLists {
/// `changed` and `left` must be an array of `UserId`.
#[wasm_bindgen(constructor)]
pub fn new(changed: Option<Array>, left: Option<Array>) -> Result<DeviceLists, JsError> {
let mut inner = ruma::api::client::sync::sync_events::v3::DeviceLists::default();
let mut inner = ruma::api::client::sync::sync_events::DeviceLists::default();

inner.changed = changed
.unwrap_or_default()
Expand Down
Loading

0 comments on commit a443e72

Please sign in to comment.