Commit Graph

341 Commits

Author SHA1 Message Date
Benjamin Bouvier
50cc5f4102 refactor(pinned events): move pin_event/unpin_event from the Timeline to the Room
These make sense in general, and they will help getting rid of one of
the `PinnedEventsRoom` trait methods in a subsequent PR.
2026-02-04 09:59:47 +01:00
Johannes Marbach
2ebab067b4 feat(timeline): enable focusing a thread root using TimelineFocus::Event
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2026-01-28 07:43:49 +01:00
Skye Elliot
831ab6d429 tests: Check historic room keys fetched from backup.
- Splits `test_secret_gossip_after_interactive_verification ` into a helper method.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-01-13 15:47:02 +00:00
Skye Elliot
a5b1231f8c refactor: Deduplicate shared history test code to helper methods. 2026-01-06 16:18:33 +00:00
Skye Elliot
bfdd3ccc07 test: Ensure forwarder info is not available on unshared events. 2026-01-06 15:00:33 +00:00
Skye Elliot
6fdd83478a tests: Ensure forwarder info accessible via high-level API. 2026-01-06 12:59:54 +00:00
Damir Jelić
972b3dc88b test: Add a test which showcases that redecryption for timelines with an event focus is broken (#5975)
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
2025-12-17 11:38:08 +00:00
Damir Jelić
504d15f171 chore: Fix some spelling issues 2025-12-16 15:46:34 +01:00
Damir Jelić
1302afb844 test: Add another test for pinned timelines
This time we're testing the redecryption of pinned events that were not
part of the main timeline, more importantly we never backpaginated
enough for them to be part of the main timeline and thus never got put
into the event cache.

This test expectedly fails for now.
2025-12-16 15:46:34 +01:00
Damir Jelić
7323c79dc2 test: Refactor the pinned timeline integration test a bit
This should allow us in the future to create more such tests with
many more events.
2025-12-16 15:46:34 +01:00
Damir Jelić
329bdaa785 test(timeline): Add a test that pinned events get replaced after they get redecrypted 2025-12-16 15:46:34 +01:00
Damir Jelić
9bdd2ae977 test: Ensure that the test_enabling_backups_retries_decryption test times out 2025-12-15 14:43:43 +01:00
Damir Jelić
9ff90a9b4d Add an integration test that the send queue can insert encrypted events 2025-12-09 18:49:03 +01:00
Stefan Ceriu
98f34f010c change(room::futures): Use a proper struct instead of a tuple for SendMessageLikeEvent results 2025-12-09 18:49:03 +01:00
Stefan Ceriu
8bd401b003 change(matrix_sdk::Room): Return the used EncryptionInfo when sending MessageLike and RawMessageLike events 2025-12-09 18:49:03 +01:00
Ivan Enderlin
81a8aa063b chore(base): Remove the old latest event API. 2025-12-05 09:40:47 +01:00
Ivan Enderlin
aaff9c5d72 test: Update tests according to last patches. 2025-12-03 13:11:40 +01:00
Richard van der Hoff
60072b3456 Integ test for merging megolm sessions with history sharing
Add an integration test that checks that, when we receive a copy of a megolm
session directly after having previously received it via history sharing, we
get the best bits of both.
2025-11-13 18:37:18 +00:00
Richard van der Hoff
c60f92a917 crypto: correct UtdCause for unshared historical messages
Per https://github.com/element-hq/element-meta/issues/2876, we want messages
where the history was not shared to appear the same as regular "historical"
messages.
2025-11-05 15:08:10 +00:00
Richard van der Hoff
8f726e4fb9 test: use a Timeline for shared_history integ tests
I want to be able to test that the correct `UtdCause` is presented for withheld
historical messages. That means we need to use `/sync` rather than `/event` to
obtain the message (since the MSC4115 `membership` field is missing on `/event`
(https://github.com/element-hq/synapse/issues/17486)). So then the most
realistic way to get hold of the actual UtdCause is to use a Timeline.

Of course, the thing I actually want to test doesn't actually work correctly,
so it's left as a FIXME in this commit.
2025-11-05 15:08:10 +00:00
Richard van der Hoff
3695d76dec crypto: pass on "history_not_shared" withheld notifications
When constructing a key bundle, if we had received a key bundle ourselves, in
which one or more sessions was marked as "history not shared", pass that on to
the new user.
2025-10-31 12:00:06 +00:00
Richard van der Hoff
ef3c6719cf test: integ test for withhelds in history sharing
Add an integration test that ensures that the correct withheld code is sent
when history is marked as "not shareable"
2025-10-30 13:58:38 +00:00
Damir Jelić
3733ee8534 chore: Remove the matrix-sdk-crypto re-export in the matrix-sdk crate 2025-10-24 16:37:15 +02:00
Richard van der Hoff
01e2e4877c test(crypto): Regresion test for #5613
Add a test to ensure that history-sharing still works when "exclude insecure
devices" is enabled.
2025-10-13 16:41:56 +01:00
Kévin Commaille
d01a28c9b2 Upgrade Ruma
Brings a breaking change with event structs being non-exhaustive now,
so they need to be constructed with methods rather than with a struct
declaration.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-06 10:21:00 +02:00
Benjamin Bouvier
e158e8abc0 refactor(timeline): in thread permalinks, avoid back-paginating if the root event is part of the /context response
For thread permalinks, we start with a /context query that will load the
focused event, and maybe a few other in-thread events. In fact, it can
also include the thread root event, which was excluded before. Instead,
we would get a previous-token for back-paginations, which would be used
in /relations. When the request to /relations returns an empty previous
token, that means we've reached the start of the thread, and in this
case we would manually load the root with /event.

We can do better, if the root event is part of the initial /context
response: skip the back-paginations altogether, and make sure to include
the root event in `init_focus()`.
2025-09-25 10:21:19 +02:00
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