Commit Graph

315 Commits

Author SHA1 Message Date
Damir Jelić
1e30916754 chore: Bump most of our deps 2025-09-01 16:33:10 +02:00
Skye Elliot
baa75368d6 ci: Add feature matrix for integration testing
This will resolve a number of transitive dependency issues when testing
crates that do not enable the `experimental-encrypted-state-events` feature
flag by default.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-27 14:55:45 +02:00
Skye Elliot
8e5075569e feat: Add top-level support for decrypting state events (#5552)
Implements support for decryption of state events

- [ ] Introduce a case for `AnySyncStateEvent::RoomEncrypted` to the
`state_events` sync response processor.
- [ ] Introduce modified `Room::decrypt_event` and
`::try_decrypt_room_event`.
- [ ] Introduce testing macro
`assert_let_decrypted_state_event_content`.
- [ ] Add casts and explicit type hints where necessary.

---------

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-27 10:53:55 +01:00
Kévin Commaille
a3a239f999 Upgrade Ruma: revert StrippedState
Handle the previous breaking change that was reverted: `StrippedState`
was removed and `AnyStrippedStateEvent` is used again.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-14 08:57:52 +02:00
multisme
a66b2c5123 feat(test): add a test utils crate to make log initialization possible everywhere
This PR allows `init_tracing_for_test` to be called by any other crate in the sdk

Signed-off-by: multi [multiestunhappydev@gmail.com](mailto:multiestunhappydev@gmail.com)
2025-08-14 05:24:03 +00:00
Johannes Marbach
0a796cb468 feat(timeline): communicate media upload progress through EventSendState::NotSentYet
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-08-12 12:57:18 +02:00
Damir Jelić
b29886c0df test(crypto): Add a test that we refuse bundles if the sender isn't trusted enough 2025-08-08 15:56:13 +02:00
Kévin Commaille
b02e1da471 Upgrade Ruma
This brings in a new breaking change from Ruma, because not all events
are stripped in a room's stripped state. For simplicity, this still
considers the events as stripped during deserialization for now, since
this format is compatible with the other possible formats.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-01 14:07:28 +02:00
Kévin Commaille
4931c0749e Upgrade Ruma again
This patch updates our `Raw` API usage since the newly added `JsonCastable` that disallows Raw casts that are known to fail deserialization. 

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-22 12:59:26 +00:00
Kévin Commaille
37626b5ad9 Bump Ruma
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-07-22 14:00:53 +02:00
Jonas Platte
7d9d5bf3b4 refactor: Use if-let chain 2025-07-15 08:41:44 +02:00
Jonas Platte
ea076b3d76 chore: Upgrade testing crates to Rust Edition 2024 2025-07-15 08:41:44 +02:00
Jonas Platte
07808b4301 refactor: Enable extra code style clippy lints 2025-07-05 21:20:34 +02:00
Benjamin Bouvier
f0b6225e40 feat(notifications): provide the NotificationStatus as the return type when getting notifications
This is more explicit for these API's users, which can decide to do
different things based on whether an event has been ignored, or filtered
out.
2025-07-03 17:14:56 +02:00
Richard van der Hoff
4ecd599c15 fix(sdk): correctly import e2ee history in join_room_by_id (#5284)
It turns out that downstream clients can and do call
`Client::join_room_by_id()` rather than `Room::join`, so we need to do
the room key history import in the lower-level method.

---------

Signed-off-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Benjamin Bouvier <benjamin@bouvier.cc>
2025-06-27 12:29:01 +01:00
Damir Jelić
3a98d46bfa feat: Add a stream to listen for historic room key bundles 2025-06-26 13:22:24 +02:00
Benjamin Bouvier
bc9192f818 refactor!(sdk): make the join_rule and related getters optional
The join rule state event can be missing from a room state. In this
case, it's an API footgun to return a default value; instead, we should
return none and let the caller decide what to do with missing
information.
2025-06-25 10:32:01 +02:00
Valere Fedronic
7126fc8a29 feat(crypto): Emmit EncryptionInfo with event handlers for to-device messages as well 2025-06-13 14:31:22 +02:00
Daniel Salinas
d3be744244 feat(wasm): Remove direct use of tokio::spawn in favor of matrix-sdk-common (#5159)
Mechanical move from tokio::spawn to matrix_sdk_common::executor::spawn
that has support for Wasm platforms. On non-Wasm, this shim defaults to
tokio::spawn.
2025-06-03 12:22:53 -04:00
Richard van der Hoff
a1e2eed467 sdk: Add ClientBuilder::with_enable_share_history_on_invite (#5141)
Replace `experimental-share-history-on-invite` feature flag with a
runtime flag on the `Client`.
2025-06-03 11:36:48 +01:00
Damir Jelić
42ade32bea feat(sdk): Fallback to the device keys in the Olm event for room key bundles
This makes it possible to correctly accept a historic room key bundle if
we previously didn't know about the device of the sender of the bundle.
2025-05-30 15:45:27 +02:00
Jonas Platte
8eec683793 refactor: Use inline format arguments more
Automated with cargo clippy --fix --workspace --all-targets.
2025-05-29 13:19:59 +02:00
Damir Jelić
60d3b3d56b test: Finish up the shared history integration test 2025-05-27 17:46:10 +02:00
Damir Jelić
995838d9d3 refactor(tests): Move the shared history test into its own module 2025-05-27 17:46:10 +02:00
Damir Jelić
1d4d4bc741 refactor(tests): Create a submodule for the end-to-end encryption integration tests 2025-05-27 17:46:10 +02:00
Benjamin Bouvier
42a4a6c1a8 refactor(ui): get rid of the RoomListService::Room wrapper
It's just a room, now! Since there were some users of the
`latest_event()` that returned an `EventTimelineItem`, I kept this
method as a method in the Room trait extension that's in the UI crate,
so it's still convenient to use.
2025-05-26 14:48:16 +02:00
Jonas Platte
3aa356dcd6 chore: Use shorter syntax for workspace inheritance where possible 2025-05-23 10:23:36 +02:00
Jonas Platte
491f7cd529 chore: Clean up Cargo.toml formatting 2025-05-23 10:23:36 +02:00
Benjamin Bouvier
16fe53c40d refactor!(timeline): have TimelineItem::reactions() return an Option<&ReactionsByKeyBySender> instead of owned non-optional 2025-05-20 13:50:02 +02:00
Ivan Enderlin
2649587d2f refactor(sdk): Use the Event Cache for read_receipts::compute_unread_counts.
The `read_receipts::compute_unread_counts` function needs the _previous
events_ to compute the read receipt correctly. These previous events
were store in `SlidingSyncRoom::timeline_queue`. Since the removal of
`timeline_queue` in the previous patches, this patch uses the Event
Cache to fetch them. It only uses events that are loaded in memory.
This is as correct as the prior behaviour, even this is still incorrect
since it doesn't back-paginate to get a better view. This is for
later. The goal of this patch is to restore the same behaviour, without
`timeline_queue`.

The main problem is that read receipts are computed in
`matrix-sdk-base`, and that the Event Cache lives in `matrix-sdk`. Thus,
we change the `SlidingSyncResponseProcessor` to handle read receipt
in particular.

The
`matrix_sdk_base::response_processors::rooms::msc4186::extensions::dispa
tch_ephemeral_events` function has been split in
two methods `dispatch_typing_ephemeral_events`, and
`dispatch_receipt_ephemeral_event_for_room`. The workflow has been a
little bit redesigned to fit in the new `SlidingSyncResponseProcessor`
constraints.

This patch moves one test from `matrix-sdk-base` into `matrix-sdk`,
because to compute the read receipt, the Event Cache must be
enabled/listening to sync updates.
2025-05-16 14:43:45 +02:00
Ivan Enderlin
c426c03624 refactor(sdk): Remove timeline and prev_batch from SlidingSyncRoom. 2025-05-16 14:43:45 +02:00
Ivan Enderlin
bf5e0124ab refactor(ui): Reduce the size of NotificationEvent.
This patch reduces the size of `NotificationEvent` from 576 bytes to
16 bytes.
2025-05-16 14:27:49 +02:00
Ivan Enderlin
d56ad64cc2 refactor(ui): Reduce the size of NotificationStatus.
This patch reduces the size of `NotificationStatus` from 216 bytes to
16 bytes.
2025-05-16 14:27:49 +02:00
Andy Balaam
91d085c41b task(tests): Ignore test_new_users_first_messages_dont_warn_about_insecure_device_if_it_is_secure because it is flaky 2025-04-24 15:14:58 +01:00
Benjamin Bouvier
9492614ea6 refactor(sdk): rename a few push_action_ctx variables back into push_ctx 2025-04-23 14:49:49 +02:00
Benjamin Bouvier
55342a84fa refactor(sdk): explicit the case where we can't compute the push actions 2025-04-23 14:49:49 +02:00
Benjamin Bouvier
9950268164 refactor(sdk): rename Room::push_action_ctx to Room::push_context() (and associated type too) 2025-04-23 14:49:49 +02:00
Benjamin Bouvier
93c961d673 refactor(sdk): avoid recomputing the push context and ruleset for every single event when decrypting a batch 2025-04-23 14:49:49 +02:00
Richard van der Hoff
7272a347fa Merge pull request #4961 from matrix-org/rav/history_sharing/deflake_integ_test
test: attempt to deflake history-sharing integ test
2025-04-23 11:49:41 +01:00
Richard van der Hoff
6d1c24f6fb test: attempt to deflake history-sharing test
Rather than attempting to trigger Alice's encryption sync loop with an incoming
message from Bob, instead have Alice send a message once Bob has joined the
room.
2025-04-23 11:33:06 +01:00
Richard van der Hoff
4300148663 test: factour out new helper wait_until_some. 2025-04-23 11:33:06 +01:00
Richard van der Hoff
75cde02283 Merge pull request #4946 from matrix-org/rav/history_sharing/share_on_invite
sdk: share room history when we send an invite, subject to an experimental feature flag.
2025-04-23 11:15:57 +01:00
Andy Balaam
d2874afb75 fix(integration-tests): Fixes #4871 (hopefully). Repeatedly sync in a test after other user cross-signs 2025-04-17 13:51:32 +02:00
Richard van der Hoff
96bdd91bad sdk: share room history when we send an invite
... subject to an experimental feature flag.
2025-04-16 16:53:27 +01:00
Richard van der Hoff
bce6c19bba Merge branch 'main' into rav/history_sharing/upload_bundle
Signed-off-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2025-04-15 14:32:42 +01:00
Ivan Enderlin
bad1c683f8 chore(base): Rename fields of RoomUpdate.
This patch renames the fields in `RoomUpdate`: `join` becomes `joined`,
`leave` becomes `left`, `invite` becomes `invited`, to match their
associate type.
2025-04-15 14:17:07 +02:00
Richard van der Hoff
9ef1a040dd test: add the start of an integration test for room history sharing
This is only a partial test, since we haven't yet implemented the receiver side
of the history-sharing messages.
2025-04-15 12:55:55 +01:00
Andy Balaam
d34e11b9f6 Fixes #4871 (hopefully). In test code, sync after other user cross-signs 2025-04-01 14:56:13 +02:00
Richard van der Hoff
192cf0154a integration-test: Remove postgres container (#4858)
Followup on https://github.com/matrix-org/matrix-rust-sdk/pull/3983: now
that we don't have a sliding sync proxy, we don't need a postgres
container.
2025-03-28 16:51:12 +00:00
Stefan Ceriu
cb92971657 chore(ui): move TimelineItemContent::UnableToDecrypt to MsgLikeKind::UnableToDecrypt 2025-03-28 15:30:47 +02:00