Commit Graph

14300 Commits

Author SHA1 Message Date
Damir Jelić
c19ac306a1 refactor: Rename invalid version into invalid type 2026-01-30 10:19:46 +01:00
Damir Jelić
38731f12de refactor(crypto): Abstract away QrLoginData so we can support multiple MSC versions
This patch modifies the QrLoginData, it now hides all its public fields
and appropriate getters have been created for it instead.

This is necessary to hide the MSC specific parts of the data type thus
allowing support of multiple versions of the data type.
2026-01-30 10:19:46 +01:00
Damir Jelić
2d4053bed3 refactor(crypto): Create a MSC4108 submodule for the qr login types
Our current implementation of this QR code data type corresponds to the
data type defined in MSC4108. The data format has been updated a bit in
MSC4833 and thus we'll need to support both formats for a while.

This moves al the MSC4108-specific parts into a separate MSC-specific
submodule.

MSC4108: https://github.com/matrix-org/matrix-spec-proposals/pull/4108
2026-01-30 10:19:46 +01:00
Damir Jelić
faf7f5577a refactor(crypto): Create a submodule tree for the qr login types 2026-01-30 10:19:46 +01:00
Kévin Commaille
4feaa0ba49 Upgrade Ruma
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-30 10:16:06 +01:00
Damir Jelić
4e7b77d7d0 refactor(qr-login): Attempt to export the secrets bundle sooner in the login process
This ensures that, if we don't have a valid secrets bundle at hand we
error out as early es possible.
2026-01-30 10:15:26 +01:00
Stefan Ceriu
712c99f3cf chore(spaces): reduce m.space.child and m.space.parent deserialisation failure log levels as they are expected when removing either from the hierarchy 2026-01-29 19:42:16 +02:00
Andy Balaam
5d1382f507 Log our cross-signing and backup status after we receive a secret 2026-01-29 17:38:44 +00:00
Andy Balaam
8932869423 Log more information about gossip requests
So we can track which `m.secret.send` messages were successfully sent or
retried, and which secrets were contained in them.

Part of #6058
2026-01-29 13:24:15 +00:00
Tobias Fella
225644111c docs(sdk): Fix grammar 2026-01-29 14:18:18 +01:00
Kévin Commaille
1807a8765b refactor(crypto): Use to_canonical_value() directly
Instead of going through `serde_json::to_value()` and then converting it
to canonical JSON to serialize it.

Currently `to_canonical_value()` has the same behavior internally as
here, but an upcoming change in Ruma makes it use its own `Serializer`
so it is directly serialized as a `CanonicalJsonValue` which should be
somewhat more efficient.

This upcoming change also removes the `CanonicalJsonError::SerDe`
variant, so it is not as straightforward to propagate
`serde_json::Error`s.

This commit also removes outdated `#[allow(clippy::…)]` attributes.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-28 14:29:39 +01:00
Benjamin Bouvier
c420d45e64 test(wasm): allow running the wasm tests with only one runner
Sometimes, running the wasm tests with a given runner will fail with
obscure, undecipherable reasons. As a result, it's convenient to be able
to locally run the wasm-pack tests with only a single runner, which this
commit allows.
2026-01-28 14:16:51 +01:00
Damir Jelić
1fb2ca5843 refactor(crypto-ffi): Serialize the secrets bundle when exporting it 2026-01-28 10:30:20 +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
Benjamin Bouvier
e601c1d9b4 test: test that one can store the same event in multiple linked chunks 2026-01-27 16:02:20 +01:00
Benjamin Bouvier
2a968661e7 feat(sqlite): allow storing the same events in multiple linked chunks 2026-01-27 16:02:20 +01:00
Johannes Marbach
67a45b0772 feat(timeline): remove the obsolete event type filter
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2026-01-27 14:43:57 +01:00
Jonas Platte
fccf44f285 fix: Add 'bellow' as a forbidden word (#6073)
Signed-off-by: Jonas Platte
2026-01-27 10:53:07 +00:00
Benjamin Bouvier
9f093737c4 doc(r2d2): tweak links and fix a few typos in the doc comment of r2d2 2026-01-27 11:27:12 +01:00
Jorge Martín
731cb0b426 fix(ffi): Temporarily remove checksums for Android bindings
There is an error in how JNA performs the API checksums that results in incorrect checks that make the app fail as soon as any SDK method is called, since initializing the SDK performs these checks
matrix-sdk-ffi/20260127
2026-01-27 11:21:11 +01:00
Benjamin Bouvier
ae428446f9 test(http client): make the test_retry_limit_http_requests test more resilient
This test was setting a client-wide retry limit of 3 attempts for every
single network request. It happens that it was using the login method,
which unconditionally overrides this retry limit to 3 anyways, in
`LoginBuilder::send()`, so it worked only because the two retry limits
were accidentally in sync. Changing the retry limit in the test to 4
would make it thus fail; the test has been changed so it tries to use
the /whoami endpoint instead of login, as the former doesn't override
the retry limit.
2026-01-27 10:58:02 +01:00
Benjamin Bouvier
d099239427 chore(http client): rename a variable to make it clearer what its role is
The `default_timeout` is a timeout value provided by `backon`, and
that's a suggestion of what the timeout value should be for the next
request (based on the backoff method used under the hood — in our case,
the exponential backoff). Since we have another concept of a default
timeout (the one present in the RequestConfig), it seems better to call
the timeout suggested by backon in a different manner, that's more
explicit in the given context.
2026-01-27 10:58:02 +01:00
dependabot[bot]
b16d12568a chore(deps): bump oneshot from 0.1.11 to 0.1.13
Bumps [oneshot](https://github.com/faern/oneshot) from 0.1.11 to 0.1.13.
- [Changelog](https://github.com/faern/oneshot/blob/v0.1.13/CHANGELOG.md)
- [Commits](https://github.com/faern/oneshot/compare/v0.1.11...v0.1.13)

---
updated-dependencies:
- dependency-name: oneshot
  dependency-version: 0.1.13
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-27 10:02:51 +01:00
Jorge Martín
db56d14177 fix(ui): Simplify event handler check in NotificationClient::try_sliding_sync
Past me: wtf?
2026-01-27 09:08:59 +01:00
Jorge Martín
4ee3a6d0a6 fix(ui): make m.room.avatar part of the required state for the sliding sync in the NotificationClient 2026-01-27 09:08:59 +01:00
Jorge Martín
19724cf2c2 fix(sdk): Fix latest event erasing RoomInfo
The sync lock was acquired too late in `LatestEvent::store`, which could lead to a race condition where we read some room info, that room info was modified and saved in parallel somewhere else, and then we modified the copy of the room info and overwrote that saved data with it, resulting in data loss.

In the clients, this was experienced as notifications sometimes lacking the room display name
2026-01-27 09:08:59 +01:00
dependabot[bot]
fb0713275e chore(deps): bump CodSpeedHQ/action from 4.7.0 to 4.8.2
Bumps [CodSpeedHQ/action](https://github.com/codspeedhq/action) from 4.7.0 to 4.8.2.
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](0700edb451...e736f0d2ae)

---
updated-dependencies:
- dependency-name: CodSpeedHQ/action
  dependency-version: 4.8.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-27 08:52:17 +02:00
Johannes Marbach
8f4ac73ca9 feat(timeline): add filter for membership and profile changes
Use case: Display membership changes (join, leave, etc.) in the timeline but suppress profile changes (display name or avatar URL). This is currently not possible with `TimelineEventTypeFilter` because both types of changes have the same event type (`m.room.member`).

This pull request introduces a new `TimelineEventFilter` for filtering on either the event type or parts of its content. Content filters are only added for membership and profile changes but more enum variants can be added in future.
2026-01-26 14:50:49 +00:00
Skye Elliot
3924463c6d fix: Correctly store rooms with downloaded keys in SQLite and IndexedDB. (#6044)
While https://github.com/matrix-org/matrix-rust-sdk/pull/6017 is mostly
functional, there are two issues:

- I did not process `changes.room_key_bundles_fully_downloaded` in
`matrix-sdk-sqlite`, meaning any updates made via `Changes` would not be
persisted;
- I used a non-encrypting `JsValue` serialisation for the same field in
`matrix-sdk-indexeddb`, which causes errors when passed to the
decryption-enabled deserializer.

Solutions:

- Process the aforementioned changes such that keys are added to SQLite;
- Use a non-encrypting deserialiser, since this is effectively a
hash-set, and the contents aren't sensitive.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-01-26 14:12:54 +00:00
Johannes Marbach
bd77f6673c chore(ffi): update uniffi to 0.31.0
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2026-01-26 14:05:04 +01:00
Kévin Commaille
3be8726afb test(ui): Test space child changes in SpaceService
Checks that adding and removing space children from sync works.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-26 10:23:45 +01:00
Kévin Commaille
3852129612 refactor(base): Improve logs
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-23 16:24:47 +01:00
Kévin Commaille
be8abdc1cf test(sdk): Add tests about handling invalid state events
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-23 16:24:47 +01:00
Kévin Commaille
e77e2ae18f fix(base): Handle sync state events that fail to deserialize
If the homeserver provides a state event to a client, it means that it
considers the event to be valid. If a state event is valid, it always
updates the state map of the room. So ignoring events that fail to
deserialize means that the local state map is different than the one
from the server.

In some cases the Matrix spec even explicitly says that if a required
field is missing from the content of a state event, it should be treated
as if the event is missing from the state map. And if a required field
is missing, the event will fail to deserialize.

So this handles state events very closely to how a server would we only
deserialize the event type and the state key first to make sure that a
valid state event always updates the local state map. Then we only
deserialize the events lazily when we encounter an event type that
updates the `RoomInfo`. Because we deserialize the event lazily and some
methods might edit parts of an event before passing it to `RoomInfo`,
the (possibly edited) deserialized event is cached alongside the raw
event and its keys to be able to pass it further down the chain.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-23 16:24:47 +01:00
Kévin Commaille
9590b3c683 refactor(base): Move state event decryption logic in separate function
To simplify the match arms of `dispatch`.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-23 16:24:47 +01:00
Ivan Enderlin
9cf649eb60 fix(sdk): EventCacheInner::by_room can be a HashMap.
This patch replaces `HashMap` by `BTreeMap` in `EventCacheInner` as
we don't need any ordering. It is then faster to get (or insert) a new
`RoomEventCache`:

- an insert is O(1) for `HashMap` vs. O(log(n)) for `BTreeMap`,
- a get is O(1) for `HashMap` vs. O(log(n)) for `BTreeMap`.
2026-01-23 16:17:54 +01:00
Mauro Romito
b0bc4b2af9 fix: better owner check comparison using the int type from ruma 2026-01-23 14:51:58 +01:00
Mauro Romito
f524b28d36 fix: avoided creating an additional vector 2026-01-23 14:51:58 +01:00
Mauro Romito
debc8e5e65 fix: adjusted an issue with the test not, including the creator in the PL which is not allowed on v12 2026-01-23 14:51:58 +01:00
Mauro Romito
50a5a1d0a8 refactor: refactored LeaveSpaceRoom to also account for v12 rooms where creators have infinite PL and users with PL 150 are considered owners. Included also are_creators_privileged to let clients know if we are in a v12 room.
# Conflicts:
#	crates/matrix-sdk-ui/src/spaces/leave.rs

# Conflicts:
#	crates/matrix-sdk-ui/src/spaces/leave.rs

# Conflicts:
#	bindings/matrix-sdk-ffi/src/spaces.rs
#	crates/matrix-sdk-ui/src/spaces/leave.rs
2026-01-23 14:51:58 +01:00
Damir Jelić
6d5a43b47a feat(crypto-ffi): Add bindings to export a secrets bundle 2026-01-23 14:46:16 +01:00
Damir Jelić
4fcb553880 feat: Add uniffi headers to some more types
This patch allows uniffi to re-export some types related to secret
bundles.
2026-01-23 14:46:16 +01:00
Ivan Enderlin
a1b3cd48fe doc(common): Update the CHANGELOG.md. 2026-01-23 13:55:21 +01:00
Ivan Enderlin
77515dda8e fix(common): Fix an off-by-one index removal in LinkedChunk::remove_item_at.
This patch fix an off-by-one check for `Error::InvalidItemIndex` in
`LinkedChunk::remove_item_at`.

This patch updates the `test_remove_item_at` test to cover this bug.
2026-01-23 13:55:21 +01:00
Kévin Commaille
e69f9e4f89 refactor(base): Remove unused beacons from BaseRoomInfo
This field was added already unused in the initial PR
https://github.com/matrix-org/matrix-rust-sdk/pull/3741 for live
location sharing.

The follow up live location PRs didn't make use of it either:

- https://github.com/matrix-org/matrix-rust-sdk/pull/3771
- https://github.com/matrix-org/matrix-rust-sdk/pull/3794
- https://github.com/matrix-org/matrix-rust-sdk/pull/4025

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-01-22 18:25:48 +02:00
Benjamin Bouvier
3989e483d5 chore(send queue): save the thumbnail as the thumbnail of itself 2026-01-22 13:31:49 +01:00
Benjamin Bouvier
ab53ec7c67 test(timeline): add a test that a thumbnail can be loaded without network access, after we sent it 2026-01-22 13:31:49 +01:00
Benjamin Bouvier
3b339be422 refactor(media): remove the now unused make_local_thumbnail_media_request 2026-01-22 13:31:49 +01:00
Benjamin Bouvier
32666e4c24 feat(send queue): cache a thumbnail as such for the media that we just uploaded
Before: after uploading a media and a thumbnail with the send queue, the
thumbnail would be cached only as a "file", and not as a thumbnail. This
is wasteful, if the embedder is interested in getting a thumbnail of the
exact same dimensions, for the file they've updated; there's no good
reason to wait for the server to return it back.

However, there were good reasons to store it as a file in the past. So,
we're choosing here to duplicate the thumbnail in the media store:
- it's saved as a file for its own MXC URI (which preserves the previous
behavior)
- it's also saved as a thumbnail for the media MXC URI (which implements
the desired behavior).

Tests are updated to reflect this.
2026-01-22 13:31:49 +01:00
Benjamin Bouvier
a32c11f5ee chore: make clippy happy 2026-01-20 17:07:46 +01:00