Commit Graph

13223 Commits

Author SHA1 Message Date
Richard van der Hoff
b22bb3fa86 crypto: Move some test helpers out from sender_data_finder 2025-04-29 12:36:32 +01:00
Michael Goldenberg
c3ed8b9e7b docs(ffi): update changelog
Signed-of-by: Michael Goldenberg <m@mgoldenberg.net>
2025-04-29 12:35:31 +02:00
Michael Goldenberg
6e442d9046 feat(ffi): rename fields in UploadSource to match AttachmentSource
Signed-of-by: Michael Goldenberg <m@mgoldenberg.net>
2025-04-29 12:35:31 +02:00
Michael Goldenberg
79c5edd319 refactor(ffi): add conversion from UploadSource to AttachmentSource
Signed-of-by: Michael Goldenberg <m@mgoldenberg.net>
2025-04-29 12:35:31 +02:00
Michael Goldenberg
bd6361e23a feat(ffi): replace file-related fields with UploadSource in UploadParameters
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-04-29 12:35:31 +02:00
Michael Goldenberg
02fdf8c0d3 feat(ffi): add UploadSource for representing upload data
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-04-29 12:35:31 +02:00
Michael Goldenberg
1e835b24fb feat(ffi): update changelog
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-04-29 12:35:31 +02:00
Michael Goldenberg
1a12ba3ad4 feat(ffi): allow file data to be passed through bindings when sending attachment
Signed-of-by: Michael Goldenberg <m@mgoldenberg.net>
2025-04-29 12:35:31 +02:00
dependabot[bot]
d9f2588561 chore(deps): Bump tj-actions/changed-files
Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from c34c1c13a740b06851baff92ab9a653d93ad6ce7 to 5426ecc3f5c2b10effaefbd374f0abdc6a571b2f.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](c34c1c13a7...5426ecc3f5)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-version: 5426ecc3f5c2b10effaefbd374f0abdc6a571b2f
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-29 12:31:49 +02:00
dependabot[bot]
5268bc35db chore(deps): Bump crate-ci/typos from 1.31.1 to 1.31.2
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.31.1 to 1.31.2.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.31.1...v1.31.2)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-version: 1.31.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-29 12:20:08 +02:00
Valere Fedronic
ff32840387 refactor(crypto): Move session_id from EncryptionInfo to AlgorithmInfo as it is megolm specific
This patch moves the `session_id` field from EncryptionInfo to
AlgorithmInfo::MegolmV1AesSha2 as it is specific to Megolm. We provide
transparent migration of the serialized data from one format to the other.

In the future we plan to reuse `EncryptionInfo` for to_device decryption
(using olm not megolm). So megolm session_id should move to algorithm
specific data.
2025-04-29 08:07:03 +00:00
Mauro Romito
b4afb91de5 feat(bindings): check if report room api is supported 2025-04-29 09:48:29 +03:00
Richard van der Hoff
d800d3c324 crypto: clean up confusing method (#4983)
This method had a confusing name: it didn't receive a key bundle, but
rather the data *about* a key bundle.

Remove the unused `sender_key` parameter while we are at it: we use the
embedded (and already-checked) `event.sender_device_keys` here.
2025-04-28 13:55:51 +01:00
Richard van der Hoff
7c84ab2701 Merge pull request #4982 from matrix-org/rav/random_fix_1
sdk: remove redundant variable
2025-04-28 13:51:12 +01:00
procr1337
6e119c737c fix(crypto): Take into account pending to-device room key sharing requests when collecting devices that have already received a session
This avoids conditions where a key may be shared with a device only
after we decided that it is fine to reuse (and not rotate) the session
based on the wrong assumption that that particular device does not have
the keys.

Signed-off-by: Niklas Baumstark
[niklas.baumstark@gmail.com](mailto:niklas.baumstark@gmail.com)
2025-04-25 15:51:41 +02:00
Valere Fedronic
237c0256a2 fix(tests): tweak a flaky test to make it more stable + logs (#4968)
Tentative fix for
https://github.com/matrix-org/matrix-rust-sdk/issues/4832

Tweaked a bit the timings and added more logging in the UTD manager to
see what is happening exactly in case it is still flaky.

Signed-off-by: Damir Jelić <poljar@termina.org.uk>
Co-authored-by: Damir Jelić <poljar@termina.org.uk>
Co-authored-by: Benjamin Bouvier <benjamin@bouvier.cc>
2025-04-25 10:42:55 +00:00
Benjamin Bouvier
f763d3690d docs(common): add a comment explaining how to use the timer! macro 2025-04-24 18:21:00 +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
procr1337
afb6627bef fix(crypto): Fixed a bug where room keys would be rotated unecessarily
Previously, `is_session_overshared_for_user` did not take into account
that `shared_with_set` also contains withheld device IDs who explicitly
have never received the session keys. This would lead to it mistakenly
determining oversharing for those devices for every event being sent in
the presence of blacklisted/withheld devices in the room, and rotating
the group session accordingly.

The fix is to correctly exclude devices with `ShareInfo::Withheld` from
the enumeration.

Signed-off-by: Niklas Baumstark niklas.baumstark@gmail.com
2025-04-24 14:39:02 +02:00
Benjamin Bouvier
8c3f55456f refactor(widget): reduce indent in a few places thanks to early returns 2025-04-24 14:07:27 +02:00
Benjamin Bouvier
03d9e9b368 refactor(widget): avoid complicated combinators and make decisions more local and explicit 2025-04-24 14:07:27 +02:00
Benjamin Bouvier
75c4af5f4e chore(widget): make some names more explicit 2025-04-24 14:07:27 +02:00
Benjamin Bouvier
c9f6938cb7 refactor(widget): get rid of WidgetDriverRequestHandle::null too 2025-04-24 14:07:27 +02:00
Benjamin Bouvier
939af521f3 refactor(widget): simplify further the MatrixDriverRequestHandle 2025-04-24 14:07:27 +02:00
Benjamin Bouvier
bb9d481d88 refactor(widget): get rid of the null MatrixDriverRequestHandle 2025-04-24 14:07:27 +02:00
Benjamin Bouvier
3df336ab1c refactor(widget): get rid of function used only once 2025-04-24 14:07:27 +02:00
Benjamin Kampmann
12e358a54f fix(sdk): Don't overwrite previously added state events in state_event processing
Fixes #4952 .

Signed-off-by: Benjamin Kampmann <ben@acter.global>
2025-04-24 13:49:22 +02:00
Richard van der Hoff
468e7c35f6 Merge pull request #4932 from matrix-org/rav/history_sharing/save_key_bundle_data
crypto: store received room key bundle data information

Add hooks to the memory store and sqlite store to stash the information about room key data.
2025-04-24 12:22:14 +01:00
Richard van der Hoff
a3cb1cd6b5 Merge branch 'main' into rav/history_sharing/save_key_bundle_data 2025-04-24 12:07:21 +01:00
Johannes Marbach
1554e05d8a refactor(send_queue): generalize SentRequestKey::Media and DependentQueuedRequestKind::UploadFileWithThumbnail to prepare for MSC4274 gallery uploads (#4897)
This was broken out of
https://github.com/matrix-org/matrix-rust-sdk/pull/4838 and is a
preliminary step towards implementing
[MSC4274](https://github.com/matrix-org/matrix-spec-proposals/pull/4274).
`SentRequestKey::Media` and
`DependentQueuedRequestKind::UploadFileWithThumbnail` are generalized to
allow chaining dependent media uploads and accumulating sent media
sources.

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

---------

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
Co-authored-by: Benjamin Bouvier <benjamin@bouvier.cc>
2025-04-24 09:52:33 +00:00
Richard van der Hoff
85e0626d5f indexeddb: fudge implementation of get_received_room_key_bundle_data 2025-04-23 19:59:24 +01:00
Richard van der Hoff
e89c45ba42 sqlite: store data on received room key bundles 2025-04-23 19:59:24 +01:00
Richard van der Hoff
6173aef064 memorystore: store received room key bundle data 2025-04-23 19:59:24 +01:00
Richard van der Hoff
00364d95af crypto: add methods for room key bundles to store traits 2025-04-23 19:59:24 +01:00
Richard van der Hoff
3aa0983a5c crypto: add received room key bundles to store changes list
After we receive a to-device message holding room key bundle info, add the data
to the store's Changes structure
2025-04-23 19:59:24 +01:00
Richard van der Hoff
4be4d39851 crypto: add types to support decryption of RoomKeyHistoryBundle to-device
events
2025-04-23 19:59:24 +01:00
Benjamin Bouvier
884775086a chore: add an intermittent test failure policy 2025-04-23 15:34:26 +02:00
Damir Jelić
a60e336f85 feat(crypto): Start using the stable identifier for the sender device keys
This patch updates the sending side of the `sender_device_keys` field
introduced in MSC4147.

Since the MSC got merged, we're switching from the unstable identifier
to the stable one.

A couple of snapshot tests were added modified to make this happen.
2025-04-23 15:25:11 +02:00
Benjamin Bouvier
426a4ff1bf chore(ci): make clippy happy on all configurations 2025-04-23 14:49:49 +02: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
234e0be337 refactor(timeline): reuse the same push context for all the events we're trying to re-decrypt 2025-04-23 14:49:49 +02:00
Benjamin Bouvier
b6d71a3875 refactor(timeline): make use of PushContext in the RoomDataProvider trait 2025-04-23 14:49:49 +02:00
Benjamin Bouvier
4c8e2fd4ae refactor(sdk): no need to recompute push actions from /messages, since try_decrypt_event does it for us 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
f17c9fb2d5 refactor(sdk): rename Room::push_context() to Room::push_condition_room_ctx() 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
Benjamin Bouvier
6e786e0ede refactor(sdk): use Room::try_decrypt_event in an extra location
The previous code was wrong, in that it wouldn't properly compute push
actions for events that were not encrypted and received with /messages.
2025-04-23 14:49:49 +02:00
Timo
6c4a4382d7 WidgetDriver: Use matrix_sdk_common::executor::spawn instead of tokio::spawn to make it wasm compatible. (#4959)
This PR is a revived version of:
https://github.com/matrix-org/matrix-rust-sdk/pull/4707 since it is now
possible to easily add wasm support thanks to:
https://github.com/matrix-org/matrix-rust-sdk/pull/4572

Using the `executer::spawn` will select `tokio::spawn` or
`wasm_bindgen_futures::spawn_local` based on what platform we are on.

~~They behave differently in that `tokio` actually starts the async
block inside the spawn but the wasm `spawn` wrapper will only start the
part that is not inside the `async` block and the join handle needs to
be awaited for it to work.~~

This has now changed with:
https://github.com/matrix-org/matrix-rust-sdk/pull/4572.
Now they behave the same and this PR becomes a very simple change.
2025-04-23 14:39:34 +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