743 Commits

Author SHA1 Message Date
Andy Balaam
d49736455b Discard room key if someone leaves a room for a non-leave reason e.g. ban 2026-04-17 09:15:58 +01:00
Andy Balaam
e278a99a20 Factor out parts of test_history_share_on_invite_room_key_rotation 2026-04-17 09:15:58 +01:00
Ivan Enderlin
e69bb96144 test(integration): Fix the test_local_echo_to_send_event_has_encryption_info test.
This test forgot to subscribe to the Event Cache, hence the result
was partially okay. It was working by luck before. With the previous
commits, it was not possible to work without the Event Cache being
listening to the sync.
2026-04-14 14:45:14 +02:00
Damir Jelić
34a35ad32a feat(ffi): Allow passing in a SecretsBundle after logging in (#6212)
This allows people to get a secrets bundle out of band or out of a database and import it
after logging in a new client.

Mainly targeted to support the Element Classic -> Element X migration.

Signed-off-by: Damir Jelić <poljar@termina.org.uk>
Co-authored-by: Benoit Marty <benoitm@matrix.org>
2026-04-08 14:07:57 +00:00
Benjamin Bouvier
1fc7b34016 test: add an integration test reflecting the "bouncing" behavior of the timeline after sending an event 2026-04-01 14:59:33 +02:00
Kévin Commaille
644c5e8a4c Upgrade Ruma to commit after PushCondition breaking changes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-04-01 10:20:21 +01:00
Kévin Commaille
34d5e6da2a Upgrade Ruma to commit after UserIdentifier breaking changes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-04-01 10:20:21 +01:00
Kévin Commaille
5936a7285f Upgrade Ruma to commit after push Action breaking changes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-04-01 10:20:21 +01:00
Damir Jelić
16c1b9b57f chore: Bump rand 2026-03-31 16:57:50 +02:00
Skye Elliot
be47a6435b tests: Add extra sync to history sharing session merge test
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-25 12:57:53 +00:00
Skye Elliot
fd806a9c11 tests: Assert room key rotated on leave event after being offline
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-18 14:25:22 +00:00
Skye Elliot
7a26db66b5 tests: Assert room key is rotated when a member leaves the room
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-18 14:25:22 +00:00
Benjamin Bouvier
f00f6103c8 fix(test): bump the wait time between room-info diffs in integration testing
`test_room_notification_count` started to intermittently fail on main,
because the computation of unread counts has moved from the sliding sync
processing to the event cache. As a result, new irrelevant RoomInfo
updates (related to the unread counts) can happen, and they might happen
quickly enough that the server reponse for sending an event happens
after 2 seconds (remember, we need to factor in the time to do the e2ee
key exchange, and so on and so forth).

Bumping the time between two RoomInfo updates should be sufficient to
avoid the intermittent failure.
2026-03-16 15:50:34 +01:00
Skye Elliot
b6c4bca5a0 Merge pull request #6275 from matrix-org/kaylendog/history-sharing/respect-visibility
feat(sdk): Only share history if room history visibility is shared
2026-03-12 14:55:15 +00:00
Benjamin Bouvier
9a257a4ca3 test(unread count): check that the unread counts get updated after event decryption 2026-03-12 13:28:13 +01:00
Skye Elliot
f7d818a8ba tests(sdk): Ensure shared history respects current history visibility
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-11 14:37:42 +00:00
Skye Elliot
f62fbfc4ee tests(sdk): Create helper assert_utd_with_withheld code
This commit additionally flips the order of a few assertions to
meet developer expectations, i.e. errors are reported as diffs
from expected.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-11 14:33:55 +00:00
rasmus
999d612a33 feat(sdk): add add_mentions toggle to Reply
Signed-off-by: rasmus <mail@rasmusantons.de>
2026-03-11 14:20:40 +01:00
mgoldenberg
b65e450813 Support TLS v1.3 on all platforms (#6053)
**Note:** _this pull request has a companion pull request in the
[`complement-crypto`](https://github.com/matrix-org/complement-crypto/pull/229)
repository, which must be merged in conjunction with this one._

_Before merging, this should be tested in conjunction with the Element X
iOS client to ensure that TLS v1.3 is working properly._ @stefanceriu
has agreed to work on this.

## Overview

The primary change in this pull request upgrades the `reqwest`
dependency to its latest version, which defaults to using `rustls` with
support for `rustls-platform-verifier` instead of `native-tls` (see
[`reqwest@0.13.0`](https://github.com/seanmonstar/reqwest/releases/tag/v0.13.0)).
The benefit here is that `rustls` supports TLS v1.3 on all platforms,
whereas [`native-tls` does
not](https://github.com/sfackler/rust-native-tls/pull/278).

Additionally, this pull request makes `rustls` the default TLS
implementation in all the crates in this repository.

This will be particularly helpful with element-hq/element-x-ios#786.

## Changes

- `reqwest` bumped to `0.13.1`
- The API for adding/replacing certificates has changed a bit, so this
required some updating in `HttpSettings::make_client`
- `oauth2-reqwest` added in favor of `oauth2/reqwest` 
    - This is required in order to be compatible with `reqwest^0.13`
- _**`oauth2-reqwest` is currently in alpha release, so it probably
makes sense to let this stabilize a bit.**_ For details, see
https://github.com/ramosbugs/oauth2-rs/issues/333#issuecomment-3906712203.
- `getrandom` bumped to `0.3.4`
    - This is required in order to be compatible with `oauth2@5.1.0`
- `proptest` bumped to `1.9.0`
    - This is required in order to be compatible with `getrandom@0.3.4` 
- Make `rustls` the default TLS implementation

## Questions

### Mirror feature flag names?

A number of feature flags have been replaced in the dependencies above.

1. _**`reqwest/rustls-tls` => `reqwest/rustls`**_ - this is simply a
name change, but is semantically identical (see
[`reqwest@0.13.0`](https://github.com/seanmonstar/reqwest/releases/tag/v0.13.0)).
2. _**`getrandom/js` => `getrandom/wasm_js`**_ - the semantics here have
changed slightly, but it seems to just make it easier to enable the
`wasm_js` backend (see
[`getrandom@0.3.4`](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md#major-change-to-wasm_js-backend)).

At any rate, I have updated references to these flags in each of the
various `Cargo.toml` files, but have not changed the names of our
exposed features to mimic those in the dependencies.

Any thoughts or preferences on whether to mirror those names? That
would, of course, result in a breaking change.

### Default to using `rustls`? Deprecate `native-tls`?

Now that the dependencies have all been bumped, we can use `rustls` on
all platforms. Should this be the new default given that `native-tls`
will very likely never support TLS v1.3 on Apple devices? And should
`native-tls` be deprecated as a result?

**UPDATE:** _The consensus here seems to be that we should default to
using `rustls`, but that `native-tls` should still be available._

---
Fixes #5800.


- [ ] Public API changes documented in changelogs (optional)

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>

---------

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-03-10 13:38:18 +01:00
Kévin Commaille
7ec331c842 testing: Create realistic modern event IDs in EventFactory
As a fallback when the ID is not provided when constructing the event.
It allows to work with data that looks like what we would get in
production, which is important for benchmarks.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-06 15:00:45 +01:00
Benjamin Bouvier
b0aadd1574 refactor(test): use assert_let_timeout more often
Many of our tests make use of `assert_let` for checking that some value
comes out of a stream, while they could use `assert_let_timeout`, which
provides better ergonomics when the expected value doesn't arrive
immediately, by failing quickly.

This converts a few instances, making those tests easier to debug in the
future, would they fail again.
2026-03-05 15:36:41 +01:00
Stefan Ceriu
17a9ab41e4 chore(tests): add event factory method for building MSC3672 beacon_info state events 2026-03-05 15:55:31 +02:00
Benjamin Bouvier
21e8138805 chore: depersonalize some TODO code comments
Removed a few TODOs that were not applicable anymore, because they were
either very low value (in timeline test code) or already done (in event
cache, with respect to the cross-process locking).

Also removed my nick from some TODOs and comments, as code comments
aren't the best way to store assignees for issues.
2026-03-05 13:35:23 +01:00
Benjamin Bouvier
88eb4a0da9 Merge pull request #6185 from matrix-org/bnjbvr/permalink-linked-chunk
feat: introduce an event-focused linked chunk for event-focused timelines
2026-03-04 11:39:01 +01:00
Kévin Commaille
12b1102ca9 Upgrade Ruma after breaking change about Reply relations
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-04 10:30:25 +00:00
Kévin Commaille
81286ad1e7 Upgrade Ruma after breaking change about EventId constructors
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-04 10:30:25 +00:00
Benjamin Bouvier
0b6d00cfad Merge branch 'main' into bnjbvr/permalink-linked-chunk-backup 2026-03-03 15:49:13 +01:00
Valere Fedronic
cc8d6d8482 bindings: Support audio/video intent in rtc notification event content (#6207)
<!-- description of the changes in this PR -->

Updates ruma from
289bee8797
to
89dab44660
see
4250d65756

Depends on this ruma PR github.com/ruma/ruma/pull/2383

Support for reading the intent from the notification event
(m.call.intent in notification event as per
https://github.com/matrix-org/matrix-spec-proposals/pull/4075)

Parity with js-sdk implementation

bd6547c081/src/matrixrtc/types.ts (L150)

- [ ] I've documented the public API Changes in the appropriate
`CHANGELOG.md` files.
- [ ] I've read [the `CONTRIBUTING.md`
file](https://github.com/matrix-org/matrix-rust-sdk/blob/main/CONTRIBUTING.md),
notably the sections about Pull requests, Commit message format, and AI
policy.
- [ ] This PR was made with the help of AI.

<!-- Sign-off, if not part of the commits -->
<!-- See CONTRIBUTING.md if you don't know what this is -->
Signed-off-by:
2026-03-02 15:31:29 +01:00
Damir Jelić
73028a834e chore: Define the MSRV in all of our private crates 2026-02-27 17:40:08 +01:00
Kévin Commaille
5d18820120 refactor: Use owned_*_id! macros rather than *_id!().to_owned()
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-02-23 14:29:55 +01:00
Kévin Commaille
1dbd2caeb2 testing: Remove once_cell dependency
Use the types that were stabilized in the standard library instead.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-02-23 10:10:14 +00:00
Jorge Martín
54e4cb2d10 refactor: Rename CrossProcessStoreConfig into CrossProcessLockConfig, move it into matrix_sdk_common::cross_process_lock and use it inside CrossProcessLock instead of the previous lock_holder: Option<String> 2026-02-19 17:04:57 +01:00
Jorge Martín
287049c719 refactor: Rename CrossProcessStoreMode to CrossProcessStoreConfig 2026-02-19 17:04:57 +01:00
Jorge Martín
50b1e3baf2 refactor: Use the new APIs everywhere 2026-02-19 17:04:57 +01:00
Jorge Martín
3169c65bf2 refactor(ui): Make NotificationClient use the new CrossProcessStoreMode internally 2026-02-19 17:04:57 +01:00
Benjamin Bouvier
19c22a1883 fix(event cache): have redecryption update the event-focused caches too 2026-02-18 11:35:11 +01:00
Benjamin Bouvier
a6663718d0 refactor(event factory): simplify tag() helper 2026-02-18 10:57:04 +01:00
Benjamin Bouvier
72c6dc8e08 refactor(test): get rid of RoomAccountDataTestEvent 2026-02-18 10:57:04 +01:00
Benjamin Bouvier
961edaf4b9 test(spaces): add an EventFactory method to create an m.space_order event 2026-02-18 10:57:04 +01:00
Benjamin Bouvier
6d2f787623 test(sync_builder): make add_account_data accept impl Into<Raw<...>>
Change JoinedRoomBuilder::add_account_data() to accept any type that
implements Into<Raw<AnyRoomAccountDataEvent>>, preparing for migration
away from RoomAccountDataTestEvent enum.
2026-02-18 10:57:04 +01:00
Benjamin Bouvier
e3042e664b test: delete sync_events.rs
Remove the sync_events module entirely now that all usages have been
migrated to EventFactory.
2026-02-18 10:57:04 +01:00
Benjamin Bouvier
ed4454fcbb test(event_factory): add presence() helper and PresenceBuilder 2026-02-18 10:57:04 +01:00
Benjamin Bouvier
3749c9c616 test(event_factory): add tag() helper for m.tag events 2026-02-18 10:57:04 +01:00
Benjamin Bouvier
b95b0ba1c4 test(event_factory): add room account data support
Add support for room account data events in EventFactory:
- Add RoomAccountData format to EventFormat enum
- Add From implementations for Raw<AnyRoomAccountDataEvent>
- Add room_account_data() generic method
- Add fully_read() helper for m.fully_read events
- Add marked_unread() helper for m.marked_unread events
2026-02-18 10:57:04 +01:00
Benjamin Bouvier
4c6d5f9654 test: replace ENCRYPTION_CONTENT usages with EventFactory
Replace all usages of ENCRYPTION_CONTENT and
ENCRYPTION_WITH_ENCRYPTED_STATE_EVENTS_CONTENT static values
with EventFactory::room_encryption().into_content() calls.

This uses the new into_content() method to get just the event
content for HTTP response mocking.
2026-02-18 10:57:04 +01:00
Benjamin Bouvier
6b99f37268 test(event_factory): add into_content() method to EventBuilder
Add a generic method to EventBuilder that returns just the event
content as a serde_json::Value. This is useful when mocking HTTP
responses that return event content rather than full events.
2026-02-18 10:57:04 +01:00
Benjamin Bouvier
818d0ef233 test: remove unused static JSON values from sync_events.rs 2026-02-18 10:57:04 +01:00
Benjamin Bouvier
079c8175f2 refactor(test): remove the PresenceTestEvent enum that's unused 2026-02-16 10:53:31 +01:00
Benjamin Bouvier
64163c32f6 refactor(test): add an invite_room_state method to the EventBuilder
So we can pass the room state when receiving an invite, using more event
factory!
2026-02-16 10:53:31 +01:00
Benjamin Bouvier
bcb84cc27c refactor(test): remove StrippedStateTestEvent 2026-02-16 10:53:31 +01:00