Commit Graph

14101 Commits

Author SHA1 Message Date
Jonas Platte ebbf34e924 Fix more new clippy lints 2026-01-06 09:51:10 +00:00
Jonas Platte e4aff871de Refactor IndexeddbStateStore::save_changes 2026-01-06 09:51:10 +00:00
Jonas Platte 0a9994c529 Fix new clippy lints 2026-01-06 09:51:10 +00:00
Jonas Platte 06764e2542 Reformat matrix-sdk-indexeddb 2026-01-06 09:51:10 +00:00
Jonas Platte 84cd2a67d4 Upgrade matrix-sdk-indexeddb to Rust edition 2024 2026-01-06 09:51:10 +00:00
Richard van der Hoff e3867aa7df Merge pull request #5959 from matrix-org/rav/clean_up_shield_state
Remove unused `ShieldStateCode::SentInClear`

`VerificationState::to_shield_state_{strict,lax}` return a type `ShieldState`, whose inner
type `ShieldStateCode` currently includes a variant `SentInClear` for "unencrypted event".
This is very misleading, because those functions never actually set that variant.

Rather, there is a separate method in `matrix-sdk-ui`, `EventTimelineItem::get_shield`,
which uses the same type, but *does* set that variant where appropriate.

As a user of matrix-sdk-common, without the matrix-sdk-ui layer, this is dangerously
misleading: it gives the impression that we are checking for unencrypted events, when in
fact we are not.

The solution seems to be to use different types for the different levels of the stack.

While we're at it, we fix up some of the confusion of methods that return an `Option` of an
enum type which itself has a `None` variant.
2026-01-05 16:33:54 +00:00
Skye Elliot cd9f433358 Merge pull request #5945 from matrix-org/kaylendog/history-sharing/encryption-info
feat: Add `forwarder: ForwarderInfo` to `EncryptionInfo`.

Introduces `ForwarderInfo` which which exposes information about the forwarder of the  keys with which an event was encrypted if they were shared as part of an [MSC4268](https://github.com/matrix-org/matrix-spec-proposals/pull/4268) room key bundle.
2025-12-19 17:29:22 +00:00
Skye Elliot 42a5910d8f feat(crypto): Introduce ForwarderData for session forwader info. (#5980)
<!-- description of the changes in this PR -->

- Introduces a new enum `ForwarderData` as a wrapper for valid variants
of `SenderData` for which we can accept key bundles under MSC4268.
- Converts `forwarder_data` in `InboundGroupSession` and
`PickledInboundGroupSession` to use `Option<ForwarderData>` over
`Option<SenderData>`.

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

---------

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-12-19 14:51:15 +00:00
Richard van der Hoff 66daf3f7d3 Merge remote-tracking branch 'origin/main' into rav/clean_up_shield_state 2025-12-19 13:44:41 +00:00
Ivan Enderlin c3c367c54c doc(base): Update CHANGELOG.md. 2025-12-19 14:03:11 +01:00
Ivan Enderlin bf3cb6ba84 chore(sdk): Make Clippy happy :-). 2025-12-19 14:03:11 +01:00
Ivan Enderlin 5c5dcaa027 test(sdk): Add tests for new_remote and erasable values. 2025-12-19 14:03:11 +01:00
Ivan Enderlin ca64af1390 feat(sdk): When a m.room.redaction targets the current [LatestEventValue], it must be erased.
This patch implements a new feature: when a `m.room.redaction` targets
the current [`LatestEventValue`], this one must be erased by the new
computed `LatestEventValue`.
2025-12-19 14:03:11 +01:00
Ivan Enderlin ebe00841fd refactor(sdk): Replace bool by ControlFlow.
This patch replaces the `bool`s returned by `filter_*` functions by
`ControlFlow`s.
2025-12-19 14:03:11 +01:00
Ivan Enderlin 85f321f30a refactor(sdk): LatestEventValueBuilder receives the current value's event ID.
This patch spreads the current value's event ID in
`LatestEventValueBuilder`.

This patch also changes `LatestEventValueBuilder::new_remote` to return
an `Option`, similarly to `new_local`. The `must_overwrite_existing`
variable is set to `true` to keep the existing behaviour, but it's going
to change in the next patch.

This patch is purely a refactoring with no feature change. Most of the
changes are in test to keep track of the _previous value_ so that the
current value's event ID can be calculated instead of hardcoded.
2025-12-19 14:03:11 +01:00
Ivan Enderlin e2ea84f3e3 chore(sdk): Rename a variable.
This patch renames a variable. Since `rfind_map_event_id_memory_by`
returns the previous event instead of the previous event ID, this
variable must have been renamed.
2025-12-19 14:03:11 +01:00
Ivan Enderlin d5898a64ab feat(base): Add LatestEventValue::event_id.
This patch adds the `event_id` method on `LatestEventValue`, along with
the tests.
2025-12-19 14:03:11 +01:00
Ivan Enderlin 42b79d7d8a feat(base): LatestEventValue::LocalHasBeenSent gains an event_id field.
This patch adds the `event_id: OwnedEventId` field to
`LatestEventValue::LocalHasBeenSent`.
2025-12-19 14:03:11 +01:00
Ivan Enderlin 9363745fb0 chore(sdk): Remove timer! logs.
This patch removes `timer!` logs, those are no longer useful.
2025-12-19 14:03:11 +01:00
Richard van der Hoff b5f2128db1 common: remove now-unused ShieldStateCode::SentInClear 2025-12-18 13:54:49 +00:00
Richard van der Hoff d5ce01acab ui: new type for EventTimelineItem::get_shield
Separate the shield types between common and UI, so that we can change common
without breaking UI.

The new type does not include a `message` field: since it cannot be localised,
clients should not be using it.
2025-12-18 13:54:49 +00:00
Richard van der Hoff dbefaef777 bindings: remove message from ShieldState
Since this can't be localised, apps shouldn't be using it.
2025-12-18 13:09:54 +00:00
Richard van der Hoff 7438c59acd bindings: get_shields: stop returning Option
Again, there is no need for an `Option` as well as a `None` variant
2025-12-18 13:07:34 +00:00
Richard van der Hoff f5cda21d59 ui: TimelineEventItem::get_shield: stop returning Option
The `ShieldState` enum has a `None` variant, so we don't need an `Option` on
top of it.
2025-12-18 13:07:34 +00:00
Jorge Martín 759c5a9fcd docs: Add changelog entries 2025-12-18 10:41:43 +01:00
Jorge Martín 1549194b2f feat(ffi): Add an actual ffi::TimelineEventType enum with only the type
Use that for `RoomPowerLevels::events` instead.
2025-12-18 10:41:43 +01:00
Jorge Martín 4665b4343d refactor(ffi): Rename TimelineEventType to TiemlineEventContent since it also contains the event contents for some of the types 2025-12-18 10:41:43 +01:00
Jorge Martín 1f94e9d20c feat(ffi): Add fn RoomPowerLevels::events
With this we can query the power level value for any event type
2025-12-18 10:41:43 +01:00
Skye Elliot b3f6df939b Merge pull request #5943 from matrix-org/kaylendog/history_sharing/store_history_sender_details
feat(crypto): Add `forwarder_data` to `InboundGroupSession` and pickle.
2025-12-17 17:16:57 +00:00
Skye Elliot 0e568a4ee6 refactor: Use impl Iterator<Item = InboundGroupSession> as param. 2025-12-17 16:50:59 +00:00
Skye Elliot f94ce7e91c docs: Improve doc comments, linkify MSC4268. 2025-12-17 16:43:54 +00:00
Stefan Ceriu 6042bc93f6 chore(spaces): move the SpaceServices setup logic to its constructor and make it async 2025-12-17 14:42:14 +02:00
Stefan Ceriu 80be172fdf chore(ui): Move the 5955's changelog to the right position 2025-12-17 14:42:14 +02:00
Stefan Ceriu 4cc863a9fb chore(spaces): add changelogs 2025-12-17 14:42:14 +02:00
Stefan Ceriu 51e07d9fba chore(spaces): Rename subscribe_to_joined_spaces to subscribe_to_top_level_joined_spaces 2025-12-17 14:42:14 +02:00
Stefan Ceriu 143d96e300 chore(spaces): rename the SpaceService's SpaceState's joined_rooms to top_level_joined_spaces 2025-12-17 14:42:14 +02:00
Stefan Ceriu a2fd2536c4 chore(spaces): Rename joined_spaces to top_level_joined_spaces 2025-12-17 14:42:14 +02:00
Stefan Ceriu f5d751b3eb chore(spaces): Rename update_joined_spaces_if_needed to update_space_state_if_needed 2025-12-17 14:42:14 +02:00
Stefan Ceriu 096dfd61cb chore(spaces): rename joined_spaces_for to build_space_state 2025-12-17 14:42:14 +02:00
Stefan Ceriu 89f66ecd10 chore(spaces): Extract the SpaceService's subscription for rooms outside the subscribe_to_joined_spaces and make it explicit.
This will avoid having to awkwardly call `space_service.joined_spaces` without it even being needed.
2025-12-17 14:42:14 +02:00
Skye Elliot 85f07b10ad chore: Remove unused TryFrom<&HistoricRoomKey> implementation. 2025-12-17 12:33:21 +00:00
Skye Elliot 809643a159 tests(crypto): Doctests, update snapshots to include forwarder_data. 2025-12-17 12:33:21 +00:00
Richard van der Hoff f753d478fa feat: Add forwarder_data to InboundGroupSession and pickle.
- Introduces `forwarder_data` to IGS and its pickled form, and a
  helper method to import them from `HistoricRoomKey`s.

Issue: https://github.com/matrix-org/matrix-rust-sdk/issues/5109

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-12-17 12:33:16 +00:00
Damir Jelić 282a2bc8ef refactor(timeline): Don't request redecryptions in the timeline 2025-12-17 13:19:38 +01:00
Damir Jelić c6fb3c25f3 feat(r2d2): Let R2D2 attempt to update encryption info for in-memory events 2025-12-17 13:19:38 +01:00
Damir Jelić 5429106ab3 feat(r2d2): Let R2D2 attempt to redecrypt events that are in the memory of the event cache 2025-12-17 13:19:38 +01:00
Damir Jelić 5c387f2b81 refactor(r2d2): Convert the filter closure for decrypted events into function 2025-12-17 13:19:38 +01:00
Damir Jelić 6c68ca2a64 refactor(r2d2): Split out the encryption info update method into reusable components 2025-12-17 13:19:38 +01:00
Michael Goldenberg 4ee6906f47 doc(sdk): update changelog
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-12-17 12:56:09 +01:00
Michael Goldenberg 46b9c11139 doc(indexeddb): update changelog
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-12-17 12:56:09 +01:00