Commit Graph

14300 Commits

Author SHA1 Message Date
Damir Jelić
3a0a5b9888 feat(redecryptor): Use the room to redecrypt events
This allows us to properly calculate the push actions.
2025-11-07 15:38:35 +01:00
Damir Jelić
621d936b4c feat(redecryptor): Let the redecryptor listen to room key withheld updates 2025-11-07 15:38:35 +01:00
Damir Jelić
a2f89e85b9 feat: Redecryptor start to send out redecryptor reports 2025-11-07 15:38:35 +01:00
Damir Jelić
4ed239351a feat(event cache): Enable the redecryptor in the event cache 2025-11-07 15:38:35 +01:00
Damir Jelić
5c3bca86a4 doc(event cache): Document the redecryptor 2025-11-07 15:38:35 +01:00
Damir Jelić
e934235045 feat(redecryptor): Rejigger things so we can relisten to the room key stream 2025-11-07 15:38:35 +01:00
Damir Jelić
f2cc6c650a test(redecryptor): Add a test to show that the redecryptor works 2025-11-07 15:38:35 +01:00
Damir Jelić
8103b9cc23 feat(event cache): Create the redecryptor 2025-11-07 15:29:07 +01:00
Damir Jelić
d3c839a2d0 feat(event cache): Add a method to access the linked chunk mutably 2025-11-07 15:14:42 +01:00
Ivan Enderlin
3b1418463b doc(common): Fix a link in the CHANGELOG.md. 2025-11-07 11:26:09 +01:00
Ivan Enderlin
9f248affa9 doc(common): Update CHANGELOG.md. 2025-11-07 11:26:09 +01:00
Ivan Enderlin
edf7604d30 feat(common): Detect when the cross-process lock has been dirtied.
This patch detects when the cross-process lock has been dirtied.

A new `CrossProcessLockResult` enum is introduced to simplify the
returned value of `try_lock_once` and `spin_lock`. It flattens the
previous `Result<Option<_>>` by providing 3 variants: `Clean`, `Dirty`
and `Unobtained`.
2025-11-07 11:26:09 +01:00
Ivan Enderlin
f7a767ce97 feat(indexeddb): Add Lease::generation in crypto, media, and event cache stores.
This patch adds `Lease::generation` support in the crypto, media and
event cache stores.

For the crypto store, we add the new `lease_locks` object store/table.
Previously, `Lease` was stored in `core`, but without any prefix, it's
easy to overwrite another records, it's dangerous. The sad thing is
that it's hard to delete the existing leases in `core` because the keys
aren't known. See the comment in the code explaining the tradeoff.

For media and event cache stores, the already existing `leases` object
store/table is cleared so that we can change the format of `Lease`
easily.
2025-11-07 11:26:09 +01:00
Ivan Enderlin
6c922e69d0 feat(common): Add a cross-process lock generation.
This patch adds `CrossProcessLockGeneration`. A lock generation is an
integer incremented each time the lock is taken by another holder. If
the generation changes, it means the lock is _dirtied_. This _dirtying_
aspect is going to be expanded in the next patches. This patch focuses
on the introduction of this _generation_.

The `CrossProcessLock::try_lock_once` method, and
the `TryLock::try_lock` method, both returns a
`Option<CrossProcessLockGeneration>` instead of a `bool`: `true` is
replaced by `Some(_)`, `false` by `None`.
2025-11-07 11:26:09 +01:00
Ivan Enderlin
01d75e939c chore(indexeddb): Run rustfmt. 2025-11-07 11:26:09 +01:00
Jorge Martín
8b805b1ea5 refactor: Try to avoid filtering all event items before finding one with the wanted id 2025-11-07 10:42:53 +01:00
Jorge Martín
a1768ea518 refactor: Add profile cache for handle_remote_event 2025-11-07 10:42:53 +01:00
Johannes Marbach
0b66019632 feat(ffi): add bindings for granting login with a QR code
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-06 15:15:59 +01:00
Richard van der Hoff
c064ca8b18 Merge pull request #5834 from matrix-org/rav/history_sharing/fix_withheld_utd_cause
crypto: correct UtdCause for unshared historical messages
2025-11-06 11:45:06 +00:00
Jorge Martín
fa6d18b55f refactor(sdk): Make the deserialization of the ignored users happen in parallel too 2025-11-06 11:13:23 +01:00
Jorge Martín
17de97e98e refactor(sdk): Fetch member data concurrently
Creating a `RoomMember` takes a lot of store queries, and previously all of them were done sequentially. I've tried to make this process run as much in parallel as I can.
2025-11-06 11:13:23 +01:00
Richard van der Hoff
c60f92a917 crypto: correct UtdCause for unshared historical messages
Per https://github.com/element-hq/element-meta/issues/2876, we want messages
where the history was not shared to appear the same as regular "historical"
messages.
2025-11-05 15:08:10 +00:00
Richard van der Hoff
0865e96f08 refactor(crypto): simplify UtdCause logic
I find a single match statement easier to reason about than one nested in another.

Also, import `UnableToDecryptReason::*`, to shorten the match lines.
2025-11-05 15:08:10 +00:00
Richard van der Hoff
8f726e4fb9 test: use a Timeline for shared_history integ tests
I want to be able to test that the correct `UtdCause` is presented for withheld
historical messages. That means we need to use `/sync` rather than `/event` to
obtain the message (since the MSC4115 `membership` field is missing on `/event`
(https://github.com/element-hq/synapse/issues/17486)). So then the most
realistic way to get hold of the actual UtdCause is to use a Timeline.

Of course, the thing I actually want to test doesn't actually work correctly,
so it's left as a FIXME in this commit.
2025-11-05 15:08:10 +00:00
Johannes Marbach
b4ebc8bc25 feat(oauth): add flow for granting login by scanning a QR code
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
da1369b9c2 refactor(oauth): rename request_login to request_login_with_scanned_qr_code to avoid future name clashes for the opposite flow
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
d122f10147 fix(oauth): fix doc comment for GrantLoginWithGeneratedQrCode::subscribe_to_progress
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
bcf81c89e9 refactor(oauth): make device creation timeout configurable and use a lower value for tests to speed them up
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
d3dd9d28c8 refactor(oauth): extend doc comment of GrantLoginWithQrCodeBuilder::generate for better usability and to match the login flow
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
dcd08e8d3b refactor(oauth): move QrProgress to module file for later reuse
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
82c583b5bc feat(ffi): expose Client::register_notification_handler
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 10:09:31 +01:00
Ivan Enderlin
81ff96d569 fix(sqlite): Fix the database version.
The database has been updated but the version hasn't been bumped.
2025-11-04 14:59:15 +01:00
Damir Jelić
49db60d951 feat: Allow events to be fetched by event type 2025-11-04 13:58:49 +01:00
Damir Jelić
8f4267332a test: Allow to create encrypted events in the event factory 2025-11-04 13:58:49 +01:00
Damir Jelić
950c42742d refactor(sqlite): Save the event type of an event in the SQLite event cache 2025-11-04 13:58:49 +01:00
Damir Jelić
f91ffb4c31 feat: Add a method to get the event type of a TimelineEventKind 2025-11-04 13:58:49 +01:00
Richard van der Hoff
301ca5e2b8 Fix up changelogs incorrectly updated since 0.14.0 (#5828)
All of these entries have been incorrectly added to the changelogs
*since* 0.14.0 was released :(
2025-11-04 12:50:49 +00:00
Doug
1a384f0049 xtask: Workaround UniFFI's noHandle generation for Swift.
https://github.com/mozilla/uniffi-rs/issues/2717
matrix-sdk-ffi/20251104
2025-11-04 14:11:14 +02:00
Damir Jelić
781df5526d Revert "fix: Allow /versions requests to refresh the token"
This reverts commit 05b40af2c1.
2025-11-04 09:50:37 +01:00
dependabot[bot]
ea07d0199a chore(deps): bump crate-ci/typos from 1.38.1 to 1.39.0
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.38.1 to 1.39.0.
- [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.38.1...v1.39.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-03 15:46:41 +01:00
dependabot[bot]
ddfd2fb570 chore(deps): bump bnjbvr/cargo-machete
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from 53dce01c203a6a857c9544ebec630a370d596d65 to e7d460faa33cbba452e69e8b1700e6a75e8a72b8.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](53dce01c20...e7d460faa3)

---
updated-dependencies:
- dependency-name: bnjbvr/cargo-machete
  dependency-version: e7d460faa33cbba452e69e8b1700e6a75e8a72b8
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-03 15:41:54 +01:00
Richard van der Hoff
3b5f1eee27 Merge pull request #5820 from matrix-org/rav/history_sharing/transitive_withheld_code
crypto: pass on "history_not_shared" withheld notifications
2025-11-03 12:58:04 +00:00
Richard van der Hoff
99ae08ebfe Merge remote-tracking branch 'origin/main' into rav/history_sharing/transitive_withheld_code 2025-11-03 12:15:52 +00:00
Richard van der Hoff
9efb0de4d7 Merge pull request #5819 from matrix-org/rav/cryptostore_withheld_sessions_by_room_id
crypto: add new `CryptoStore` method `get_withheld_sessions_by_room_id`
2025-11-03 12:13:48 +00:00
Damir Jelić
05b40af2c1 fix: Allow /versions requests to refresh the token 2025-10-31 15:58:44 +01:00
Damir Jelić
09ee1375cd fix: Skip authorization headers when doing a /versions while doing a token refresh 2025-10-31 15:58:44 +01:00
Damir Jelić
a96485c07a test: Test that we don't end up in a deadlock when fetching the version 2025-10-31 15:58:44 +01:00
Damir Jelić
9680fc3a0f test: Test that the skip_auth option works correctly 2025-10-31 15:58:44 +01:00
Damir Jelić
422f925033 feat: Allow authorization headers to be skipped with the RequestConfig 2025-10-31 15:58:44 +01:00
Richard van der Hoff
3695d76dec crypto: pass on "history_not_shared" withheld notifications
When constructing a key bundle, if we had received a key bundle ourselves, in
which one or more sessions was marked as "history not shared", pass that on to
the new user.
2025-10-31 12:00:06 +00:00