Commit Graph

13030 Commits

Author SHA1 Message Date
Ivan Enderlin
63defca8af chore(sdk): Add mark_ prefix. 2025-08-19 16:35:41 +02:00
Ivan Enderlin
fd83904b4d feat(sdk): Handle replacing a local event by a non-suitable latest event value.
This patch handles the case where a local event is replaced by another
local event which isn't suitable for being a latest event value. In this
case, the previous existing latest event value should be removed from
the buffer.
2025-08-19 16:35:41 +02:00
Ivan Enderlin
9254c38a8d chore(sdk): Log all deserialize errors in latest_events. 2025-08-19 16:35:41 +02:00
Ivan Enderlin
63d9dd5c6e refactor(sdk): Rename find_and_map_any_message… to extract_content_from_any_message_like. 2025-08-19 16:35:41 +02:00
Ivan Enderlin
23dacc329e refactor(sdk): Rename LatestEventKind to LatestEventContent. 2025-08-19 16:35:41 +02:00
Ivan Enderlin
5896a438f5 chore(sdk): Change error! to warn! when channels have been closed.
This patch reduces the level of logs when channels have been closed in
`LatestEvents`' tasks from `error` to `warn`. Indeed, when the `Client`
shutdowns, the channels will be closed, but it's not an error at all.
2025-08-19 16:35:41 +02:00
Ivan Enderlin
31a3d76436 feat(sdk): Introduce LatestEventKind::Redacted.
This patch introduces `LatestEventKind::Redacted` to handle the case
where an event is supposed to be a latest event but has been redacted.
2025-08-19 16:35:41 +02:00
Ivan Enderlin
dfaaf323ad test(sdk): Test that a None latest event value is ignored. 2025-08-19 16:35:41 +02:00
Ivan Enderlin
94439d8913 test(sdk): Write tests for LatestEvent and SendQueue. 2025-08-19 16:35:41 +02:00
Ivan Enderlin
9cc29d7c65 feat(sdk): Implement LatestEvent::update_with_send_queue.
This patch implements `LatestEvent::update_with_send_queue`.
It introduces an intermediate type, for the sake of clarity,
`LatestEventValuesForLocalEvents`.

The difficulty here is to keep a buffer of `LatestEventValue`s requested
by the `SendQueue`. Why? Because we want the latest event value, but we
only receive `RoomSendQueueUpdate`s, we can't iterate over local events
in the `SendQueue` like we do for the `EventCache` to re-compute the
latest event if a local event has been cancelled or updated.

A particular care must also be applied when a local event is wedged:
this local event and all its followings must be marked as wedged too,
so that the `LatestEventValue` is `LocalIsWedged`. Same when the local
event is unwedged.
2025-08-19 16:35:41 +02:00
Ivan Enderlin
f2fbdfbac2 chore(sdk): Rename and split a couple of types in latest_event.
This patch splits the `LatestEventValue` type into `LatestEventValue`
+ `LatestEventKind`. Basically, all variants in `LatestEventValue` are
moved inside the new `LatestEventKind` enum. `LatestEventValue` keeps
`None`, and see the new `Remote`, `LocalIsSending` and `LocalIsWedged`
variants.

This patch also extracts the message-like handling of `find_and_map`
(now renamed `find_and_map_timeline_event`) into its own function:
`find_and_map_any_message_like_event_content`. This is going to be
handful for the send queue part.
2025-08-19 16:35:41 +02:00
Ivan Enderlin
fd34927f61 feat(sdk): compute_latest_events broadcasts the update to LatestEvent.
This patch updates `compute_latest_events` to broadcast a
`RoomSendQueueUpdate` onto `LatestEvent`. It introduces the new
`update_with_send_queue` method.
2025-08-19 16:35:41 +02:00
Ivan Enderlin
0190d3556d chore(sdk): Rename update to update_with_event_cache in latest_events.
This patch renames the `update` methods to `update_with_event_cache`
in the `latest_events` module. It frees the road to introduce
`update_with_send_queue`.
2025-08-19 16:35:41 +02:00
Ivan Enderlin
2d657fe908 feat(sdk): LatestEvents listens to the SendQueue.
This patch updates `LatestEvents` to listen to the updates from the
`SendQueue`. The `listen_to_event_cache_and_send_queue_updates` function
contains the important change. A new `LatestEventQueueUpdate` enum is
added to represent either an update from the event cache, or from the
send queue.

So far, `compute_latest_events` does nothing in particular, apart from
panicking with a `todo!()` when a send queue update is met.
2025-08-19 16:35:41 +02:00
Ivan Enderlin
5e43177d3a chore(sdk): Simplify code in listen_to_event_cache_and_send_queue_updates_task.
This patch removes the intermediate `rooms` variable in a new block. The
read-lock can be used immediately.
2025-08-19 16:35:41 +02:00
Michael Goldenberg
4882c98f99 refactor(indexeddb): allow IndexeddbSerializer::hash_key to be unused until event cache store is a default feature
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
4bf0187310 style(indexeddb): format event cache store impl by temporarily removing enclosing macro
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
10ca400d4d docs(indexeddb): correct key docs to express that keys are hashed, not encrypted
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
cc61e123b7 docs(indexeddb): remove references to room where relevant in transaction docs
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
6f23981268 refactor(indexeddb): log linked chunk id rather than room id in handle_linked_chunk_updates
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
859044285a test(indexeddb): use event cache store integration tests from matrix_sdk_base
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
6c1134006e fix(indexeddb): integrate linked chunk id into relevant chunk- and gap-related types and fns
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
6d1cdbc613 fix(indexeddb): integrate linked chunk id into relevant event-related types and fns
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
6160c15103 refactor(indexeddb): re-organize type synonyms in event_cache_store::serializer
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
100cbde526 refactor(indexeddb): use room-based queries in event-related fns that don't use linked chunk ids
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
6ff8a26cca refactor(indexeddb): add room-based index to event object store in preparation for linked chunk id as primary key
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
a1c484fb6e refactor(indexeddb): expose hash_key fn in serializer for keys represented as bytes rather than strings
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
d2ecc77014 feat(linked chunk): derive ser/de traits for OwnedLinkedChunkId
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
2e86fbc234 feat(linked chunk): add display impl for LinkedChunkId
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
64698eaf1a feat(linked chunk): add trait-based conversions between owned and borrowed linked chunk id
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Michael Goldenberg
f180a14c88 feat(linked chunk): expose OwnedLinkedChunkId::as_ref for use in other crates
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-08-19 14:46:05 +02:00
Benjamin Bouvier
bb0d480f24 fix(ci): clean more space in the CI runner for the codecov space
An idea courtesy from the gentle folks at apache/arrow.
2025-08-19 14:25:13 +02:00
Richard van der Hoff
7af1d3ab0e Merge pull request #5539 from matrix-org/kaylendog/msc3414/crypto
feat(crypto): Add support for encrypted state events to `matrix-sdk-crypto`
2025-08-19 10:55:38 +01:00
Skye Elliot
13ee4c8098 tests(crypto): Document introduced tests and helper
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-19 10:17:14 +01:00
dependabot[bot]
7bbd02ca73 chore(deps): bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-19 10:33:03 +02:00
dependabot[bot]
e22a7a2ed5 chore(deps): bump bnjbvr/cargo-machete from 0.8.0 to 0.9.1
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from 0.8.0 to 0.9.1.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bnjbvr/cargo-machete/compare/v0.8.0...v0.9.1)

---
updated-dependencies:
- dependency-name: bnjbvr/cargo-machete
  dependency-version: 0.9.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-19 10:16:04 +02:00
dependabot[bot]
4aad2c6b07 chore(deps): bump crate-ci/typos from 1.35.0 to 1.35.4
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.35.0 to 1.35.4.
- [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.35.0...v1.35.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-19 10:14:26 +02:00
Skye Elliot
960162453c feat(base): Add EncryptionState::StateEncrypted
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-18 17:46:46 +02:00
Benjamin Bouvier
1ea2162012 chore(ci): add a search feature to try out the experimental-search branch in CI 2025-08-18 17:33:34 +02:00
Benjamin Bouvier
1f0151705a fix(search): make the experimental-search feature compile
And simplify the code for parsing in the event cache.
2025-08-18 17:33:34 +02:00
Skye Elliot
84ebbd913c feat: Add naive state key verification to OlmMachine
Modifies `OlmMachine::decrypt_room_event_inner` to call a new method
`OlmMachine::verify_packed_state_key` which, if the event is a state
event, verifies that the original event's state key, when unpacked,
matches the state key and event type in the decrypted event content.

Introduces MegolmError::StateKeyVerificationFailed and
UnableToDecryptReason::StateKeyVerificationFailed which are thrown when
the verification fails.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-18 15:56:48 +01:00
Skye Elliot
756d50737e feat(crypto): Add state event encryption methods to OlmMachine
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-18 15:56:45 +01:00
Skye Elliot
c32877284c feat(crypto): Add GroupSessionManager::encrypt_state
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-18 15:56:44 +01:00
Skye Elliot
6260811ea5 feat(crypto): Add OutboundGroupSession::encrypt_state
This commit also refactors out what would be common code between
::encrypt and ::encrypt_state to a helper ::encrypt_inner.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2025-08-18 15:56:38 +01:00
dragonfly1033
4f0415d4d2 add .envrc to .gitignore
Signed-off-by: dragonfly1033 <42915850+dragonfly1033@users.noreply.github.com>
2025-08-18 15:20:31 +02:00
Benjamin Bouvier
b43aac129b chore: address review comments 2025-08-18 15:10:50 +02:00
Benjamin Bouvier
c019009d00 refactor(event cache): avoid deserializing the full event content to be sent, for extracting its thread root 2025-08-18 15:10:50 +02:00
Benjamin Bouvier
a88d6b37dc feat(event cache): also subscribe to a thread if we've sent a message into it 2025-08-18 15:10:50 +02:00
Benjamin Bouvier
705d6f870e refactor(event cache): move the listening to linked chunk updates to its own function, and introduce a select! at the top level 2025-08-18 15:10:50 +02:00
Benjamin Bouvier
4fc28c4701 feat(multiverse): enable threading support for multiverse with subscriptions 2025-08-18 15:10:50 +02:00