15830 Commits

Author SHA1 Message Date
Damir Jelić
87fd444e6a ci: Set the correct version comment for the install-action in th msrv workflow 2026-07-31 14:47:57 +02:00
Jason Volk
0d090f5c44 test(sdk): drive start() through a wiremock Secret Storage round trip.
A stateful account-data mock backs a real SecretStore, so the builder
future, load_key(), and schedule_dehydration() now run in CI instead of
only in the live test. Replaces the ignored SSSS placeholder.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
7ede2bebd8 refactor(sdk, ffi): polish the dehydrated-devices surface.
- Bump the event broadcast capacity to the crate-standard 100.
- Keep a scheduled rotation alive across a standalone rehydrate(): the
  post-drain cleanup now uses a private delete_device() helper while
  stop() stays in the public delete().
- Source the module example pickle key from the caller; a freshly
  generated key can never decrypt an existing device.
- Add the missing #[instrument] on is_key_stored().
- Spell out the sdk_dd import alias as dehydrated_devices.
- Give StartDehydratedDevicesSettings uniffi field defaults matching the
  builder initial state.
- Scope the FFI zeroize doc to the Rust-side copy of the recovery key.
- Complete the truncated license header and spell out abbreviated event
  flags in the live test.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
b99ffcad31 fix(sdk): honor the client decryption settings when rehydrating.
Room keys drained from a dehydrated device were imported with a hardcoded
TrustRequirement::Untrusted, sidestepping the sender-trust policy the
client applies to the same events when they arrive through sync.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
b98c66a189 fix(sdk): keep the dehydrated device when the rehydration drain is truncated.
A drain stopped by the batch cap or a repeated cursor now returns
DehydratedDeviceError::DrainTruncated instead of emitting
RehydrationCompleted and deleting the device, since the server only keeps
the undelivered queue until deletion. A retried rehydrate() resumes from
the full queue and already-imported room keys re-import idempotently.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
9bb46ecf46 test(sdk): adapt the live dehydrated-device test to the new API.
The live MSC3814 round trip now subscribes via `state_stream()` and drives
`start()` through its builder, following the renamed method and the removed
`StartDehydrationOpts` struct.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
7be25d947d fix(sdk): bound the dehydrated-device rehydration drain loop.
The drain loop now stops at a hard `MAX_TO_DEVICE_EVENTS` cap and counts with
saturating arithmetic, so a server that keeps returning fresh events and
cursors cannot loop without end or overflow the counters.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
24cecc86cd feat(sdk): persist the last uploaded dehydrated device id.
The replay check in `rehydrate` compares the served device id against the last
one this client uploaded; that id now lives in the crypto store instead of
process memory, so the check survives a client restart.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
d7ec3c19fa refactor(sdk): make the dehydration rotation interval private.
The `DEHYDRATION_INTERVAL` constant is an internal detail of the rotation task
rather than part of the public API, and its doc no longer refers to another
library.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
be8f2dc0df refactor(sdk, ffi): drive start() with a builder future.
`start()` now returns a `StartDehydration` named future with
`create_new_key()`, `skip_rehydration()`, and `only_if_key_cached()` builder
methods, matching the recovery and backups subsystems, and the
`StartDehydrationOpts` struct is gone.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
aed26ac0bb refactor(sdk, ffi): rename events() to state_stream().
The subscription method is now `state_stream()`, matching the backups and
recovery submodules; `events` was too overloaded a name in a Matrix client.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
c93501abe8 refactor(sdk): rotate dehydrated devices via spawn_infinite_task.
The rotation task now uses `TaskMonitor::spawn_infinite_task` with
`abort_on_drop`, which aborts on every platform including Wasm and reports
accidental panics, so the hand-rolled `Drop` guard and its cfg gate are gone.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
83b39fd9a0 docs(sdk): drop matrix-js-sdk and code-review references.
The public dehydrated-device docs no longer name matrix-js-sdk or point at
an internal code review; the remaining notes describe the event types on
their own.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
bd301fdfcc chore(changelog): add MSC3814 dehydrated-devices fragments.
Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
b9497c14e1 feat(ffi): expose the dehydrated-device manager to FFI consumers.
Mirrors the SDK shape on the FFI `Encryption` struct with
`is_dehydrated_device_supported`, `create_dehydrated_device`,
`rehydrate_dehydrated_device`, `delete_dehydrated_device`,
`start_dehydrated_devices`, `stop_dehydrated_devices`, and a
`dehydrated_device_event_listener` callback interface so
Element X (Kotlin and Swift) can drive MSC3814 without bypassing
the SDK's lifecycle events.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
ec34921ccc test(sdk): live MSC3814 round trip against a real homeserver.
Adds two integration tests under `matrix-sdk-integration-testing`
exercising the wire endpoints end to end: a direct
`create` → `rehydrate` round trip with a locally generated pickle key,
and a `start` lifecycle that resolves the pickle key out of Secret
Storage and asserts that two consecutive `start` calls upload
distinct device IDs.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
efb53838dd test(sdk): integration tests for the MSC3814 dehydrated-devices manager.
Drives the full lifecycle through the new `MatrixMockServer` helpers
across 13 cases covering support probing, create with default and
explicit display names, delete on the three server responses, the
rehydrate round trip with single-page and paginated to-device feeds,
wrong-pickle-key handling, and the empty-server short-circuit.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
f29a0f4391 feat(sdk): MatrixMockServer helpers for MSC3814 dehydrated-device endpoints.
Adds prebuilt mocks for `GET`, `PUT`, `DELETE /dehydrated_device` and
`POST /dehydrated_device/{device_id}/events`, with helpers for the
common success, `M_NOT_FOUND`, and `M_UNRECOGNIZED` responses and
body matchers (`match_next_batch`, `match_missing_next_batch`) so
integration tests can drive the full lifecycle without hand-rolling
wiremock.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
2182e20917 doc(sdk): add usage examples to every public dehydrated-device method.
Each public method on `DehydratedDevices` now carries a runnable `no_run`
example that shows the typical call site, so the docs.rs surface is
discoverable without cross-referencing the integration tests.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jason Volk
cc94eea006 feat(sdk): high-level dehydrated-devices manager (MSC3814).
Adds `Encryption::dehydrated_devices()` returning a manager with
`is_supported`, `create`, `rehydrate`, `delete`, `start`, and `stop`,
plus a Secret Storage round trip for the pickle key, a broadcast
event channel for lifecycle observability, and a weekly rotation
task. The module is gated behind `e2e-encryption` and follows the
matrix-js-sdk `DehydratedDeviceManager` shape so applications can
adopt MSC3814 without writing the wire-glue themselves.

Signed-off-by: Jason Volk <jason@zemos.net>
2026-07-31 14:17:26 +02:00
Jorge Martín
c0884ea864 feat(ffi): Add target and tracing log packs for the search crate 2026-07-31 11:06:57 +02:00
Damir Jelić
35bceef09a Merge pull request #6819 from matrix-org/poljar/bump-deps
Bump most of our deps
2026-07-31 10:51:32 +02:00
Damir Jelić
7044b6bcfe chore: Add a changelog for the check code breaking change 2026-07-31 10:33:27 +02:00
Stefan Ceriu
43565c5550 docs(ffi): document the default build profiles for the iOS and Android xtasks 2026-07-31 10:53:12 +03:00
Damir Jelić
10b5cd1c2b chore: Enable default features on our crypto deps
These crates generally don't introduce unneeded deps, on the other hand
we re-enable all the default features anyways.
2026-07-30 21:05:59 +02:00
Damir Jelić
0452278823 chore: Enable the std feature for the hmac crate 2026-07-30 21:05:59 +02:00
Damir Jelić
95ae01fd12 chore: Remove the getrandom2 dep from the matrix-sdk-store-encryption crate 2026-07-30 21:05:59 +02:00
Damir Jelić
1f4bf29518 chore: Bump vodozemac
This required a bump of the chacha20 dep in the
matrix-sdk-store-encryption crate as well due to conflicting versions of
a common dependency between them.
2026-07-30 21:05:59 +02:00
Damir Jelić
74a797e5b0 chore: Bump our RustCrypto deps 2026-07-30 21:05:59 +02:00
Stefan Ceriu
eb1eb70de4 change(tracing): demote the missing target event id from the redaction event warnings to trace 2026-07-30 19:48:52 +03:00
Stefan Ceriu
b2ffe22cdf change(tracing): demote the latest event timer to debug 2026-07-30 19:48:52 +03:00
Stefan Ceriu
2f2094d848 change(ffi/tracing): bump the matrix_sdk_base::response_processors from debug to info 2026-07-30 19:48:52 +03:00
Stefan Ceriu
9d91d0abcc change(ffi/tracing): Split matrix_sdk_crypto::identities::manager into it's own target and set it to info
To avoid large key query request logs
2026-07-30 19:48:52 +03:00
Damir Jelić
72ce97e2f4 chore: Bump chacha20 2026-07-30 17:04:40 +02:00
Damir Jelić
6c809ea6b0 chore: Bump more deps 2026-07-30 16:15:21 +02:00
Damir Jelić
485179f277 chore: Bump our Wasm-specific deps 2026-07-30 16:15:21 +02:00
Damir Jelić
b9635628e7 chore: Bump many of our deps 2026-07-30 16:15:21 +02:00
Stefan Ceriu
686318a6a5 fix(search): use a manual reload policy for the Tantivy IndexReader
Use `ReloadPolicy::Manual` for the Tantivy `IndexReader` of a `RoomIndex`.
Tantivy's default policy spawns a meta file watcher thread per index, i.e. one
per room, and panics if the thread cannot be spawned. Commits already reload the
reader explicitly, so the watcher is pure overhead.
2026-07-30 15:10:56 +03:00
Damir Jelić
e1717476d6 chore: Bump our MSRV
This is needed because the rusqlite crate uses the cfg_select macro
which got stabilized in Rust 1.95[1].

[1]: https://doc.rust-lang.org/stable/std/macro.cfg_select.html
2026-07-30 13:46:34 +02:00
Damir Jelić
25b1b96d21 chore: Bump rusqlite 2026-07-30 13:46:34 +02:00
Alexandros Lykesas
f448c4672a feat: allow attaching custom fields to outgoing messages and media
Signed-off-by: Alexandros Lykesas <alexookah@me.com>
2026-07-30 13:23:58 +03:00
Stefan Ceriu
ea5193f00b fix(common): keep RingBuffer's capacity across (de)serialization (#6815)
Fixes `RingBuffer` capacity being lost across serialization and
deserialization. The buffer previously relied on the backing
`VecDeque`’s allocation capacity as its logical capacity. Since serde
only serialized the items, deserialization recreated the `VecDeque` with
capacity equal to the number of stored items. A partially filled buffer
could therefore come back effectively full, causing every subsequent
push to evict an existing item.

`RoomReadReceipts::pending` uses a `RingBuffer` to retain read receipts
whose target events are not currently known by the timeline. This can
happen when a receipt arrives before the corresponding event, for
example with limited sync responses or federation delays. Those pending
receipts are persisted as part of `RoomInfo`. After restoring them, the
old implementation could shrink the ring buffer to the number of
currently stored receipts. Once that happened, newly received pending
receipts would evict older ones immediately. In particular, the receipt
needed to advance `latest_active` could be lost, leaving unread counts
incorrect even though the client had received the relevant receipt.

By preserving the logical capacity, pending read receipts survive
persistence and can continue to be matched when their corresponding
events become available.
2026-07-29 19:11:08 +03:00
Alexandros Lykesas
df1f15156b fix(ffi): delete the state store's actual -wal/-shm sidecars in clear_caches
Signed-off-by: Alexandros Lykesas <alexookah@me.com>
2026-07-28 18:34:06 +02:00
Ivan Enderlin
edd30e40dd chore(labs): Increase the recursion limit (for #[instrument]). 2026-07-28 18:04:26 +02:00
Ivan Enderlin
481ac77049 chore(benchmark): Increase the recursion limit (for #[instrument]). 2026-07-28 18:04:26 +02:00
Ivan Enderlin
f6fd03a82b chore(benchmark): Increase the recursion limit (for #[instrument]). 2026-07-28 18:04:26 +02:00
Ivan Enderlin
23603daa32 chore(ui): Increase the recursion limit (for #[instrument]). 2026-07-28 18:04:26 +02:00
Ivan Enderlin
40c84f0deb chore(sdk): Add TracingTimers in th StateLock.
This patch adds `TracingTimer`s in the `StateLock::read`, `write` and
`clear_and_reload` methods. The idea is to get a sense of how long it
takes to compute these locks.

This patch also adds regular logs to indicate when a lock is acquiring,
or acquired.
2026-07-28 18:04:26 +02:00
Ivan Enderlin
6e540bc6c1 chore(search): Use a const expression for MAX_MILLISECONDS. 2026-07-28 17:14:12 +02:00
Ivan Enderlin
58dbb91bec doc(search): Add the changelog file. 2026-07-28 17:14:12 +02:00