Commit Graph

13223 Commits

Author SHA1 Message Date
Ivan Enderlin
b7bde3cabe feat(crypto): Implement OldMachine::mark_all_tracked_users_as_dirty.
This patch adds the `OldMachine::mark_all_tracked_users_as_dirty`.

This patch rewrites a bit `OlmMachine::new_helper` by extracting some
piece of it inside `OlmMachine::new_helper_prelude`. With that, we
can rewrite `OlmMachine::migration_post_verified_latch_support` to use
`IdentityManager::mark_all_tracked_users_as_dirty`.
This latter is the shared implementation with
`OlmMachine::mark_all_tracked_users_as_dirty`.

This patch adds a test for `OlmMachine:mark_all_tracked_users_as_dirty`.
2024-09-11 10:40:59 +02:00
Benjamin Bouvier
cb825864b9 event cache: reset paginator state when receiving a limited timeline 2024-09-11 09:40:30 +02:00
Jorge Martín
08df153ed9 sdk-ui: create TimelineState::replace_all which combines clear and add_remote_events_at in the same transaction 2024-09-10 17:23:15 +02:00
Ivan Enderlin
a6f84d8513 feat(sdk): Use the user ID to discover the sliding sync proxy.
This patch improves `Client::available_sliding_sync_versions` when
trying to detect the sliding sync proxy. Previously, we were relying
on the `Client::server` to send the `discover_homeserver::Request`.
Sadly, this value is an `Option<_>`, meaning it's not always defined
(it depends how the `Client` has been built with `HomeserverConfig`:
sometimes the homeserver URL is passed directly, so the server cannot
be known).

This patch tries to find to discover the homeserver by using
`Client::server` if it exists, like before, but it also tries by using
`Client::user_id`. Another problem arises then: the user ID indeed
contains a server name, but we don't know whether it's behind HTTPS or
HTTP. Thus, this patch tries both: it starts by testing with `https://`
and then fallbacks to `http://`.

A test has been added accordingly.
2024-09-10 14:09:50 +02:00
Benjamin Bouvier
729ba3e22b ffi: rename RustShieldState to SdkShieldState
This is all Rust code, after all :)
2024-09-10 11:20:52 +02:00
Doug
83cc0acf7b ffi: Expose RoomSendQueue::unwedge to allow resending. 2024-09-09 17:47:06 +02:00
Benjamin Bouvier
ef6237045e timeline: use a RingBuffer instead of a hashmap to put an upper bound on the number of pending edits 2024-09-09 17:13:11 +02:00
Benjamin Bouvier
d005311235 timeline: add comments for each item in TimelineMetadata 2024-09-09 17:13:11 +02:00
Benjamin Bouvier
c66ea8162c timeline: use fewer early returns in code around pending edits
😥
2024-09-09 17:13:11 +02:00
Benjamin Bouvier
40c1e8a2da timeline: add more tests for pending edits 2024-09-09 17:13:11 +02:00
Benjamin Bouvier
d2709c0679 timeline: handle pending poll edits too 2024-09-09 17:13:11 +02:00
Benjamin Bouvier
c9a46173b9 timeline: some renamings around poll edits 2024-09-09 17:13:11 +02:00
Benjamin Bouvier
8a2929fb51 timeline: apply pending edits when adding the new item, not as a separate update 2024-09-09 17:13:11 +02:00
Benjamin Bouvier
79f412790f timeline: stash edits around in case they arrive before the related event 2024-09-09 17:13:11 +02:00
Benjamin Bouvier
5abff2970c room: mark encryption state as missing if a room thinks it's not encrypted after requesting it 2024-09-09 17:04:01 +02:00
Damir Jelić
dcc20b6c96 backups: Rename the term session to room key
The term session is usually only used in the crypto crate to reference a
Megolm session, the rest of the SDK uses the name from the event and the
Matrix spec, this should lower the amount of confusion since the main
crate has already a session concept and its unrelated to end-to-end
encryption.
2024-09-09 16:51:15 +02:00
Damir Jelić
4e541ad825 backups: Expire downloaded room keys so they get retried if a better one is found 2024-09-09 16:51:15 +02:00
Damir Jelić
67a4a322f5 backups: Don't queue up room keys to be downloaded if backups aren't enabled 2024-09-09 16:51:15 +02:00
Damir Jelić
26e6a038a1 backups: Don't mark a room key as downloaded if we did not attempt to download it 2024-09-09 16:51:15 +02:00
Damir Jelić
e8a920118f timeline: Retry decryption if a room key backup gets enabled 2024-09-09 16:51:15 +02:00
Damir Jelić
626b3d152c test: Check that we don't mark keys as downloaded before backups were enabled 2024-09-09 16:51:15 +02:00
Damir Jelić
38ed66c1b1 test: Test that a timeline decrypts an event if a backup got enabled 2024-09-09 16:51:15 +02:00
Benjamin Bouvier
19e89bbd6a tests: make test_incremental_upload_of_keys_sliding_sync less dependent on timing 2024-09-09 14:21:51 +02:00
Benjamin Bouvier
a07be884b7 tests: try to address intermittent failure of test_incremental_upload_of_keys
My theory is that the intermittent failure depends on the ordering of
the requests, and if the /keys/upload request happened before the key
backup request, then after failing the next key backup request wouldn't
run.

This is likely a small typo that the key upload returns a 404 error
instead of a 200, let's see if this improves the situation.
2024-09-09 14:21:51 +02:00
Valere
24d4e60c2b crypto: Bugfix - UTD messages showing unexpected red padlock warning 2024-09-09 14:59:20 +03:00
Benjamin Bouvier
7d7142add3 timeline: check that unique IDs are indeed unique
And log an error in production builds if that's not the case.
2024-09-09 12:10:41 +02:00
Ivan Enderlin
57352f0154 chore(sdk): Rename a variable from_… to with_….
This patch renames the variable `from_msc4186` to `with_msc4186` for
better clarity.
2024-09-09 12:01:33 +02:00
Ivan Enderlin
7eea5628d3 chore: Update Ruma feat-sss to its latest commit.
The new commits from `feat-sss` are about migrating
`unstable-simplified-msc3575` to `unstable-msc4186`.
2024-09-09 12:01:33 +02:00
Ivan Enderlin
ea794bb9f2 chore(sdk): Replace “simplified sliding sync” by “MSC4186”.
Simplified sliding sync finally has an MSC number: 4186. Let's use this
name when possible to clarify the code.
2024-09-09 12:01:33 +02:00
Jorge Martín
10a0d59012 sdk-ui: fix max concurrent requests for pinned events timeline. 2024-09-09 09:37:50 +02:00
Ivan Enderlin
16fd88c419 chore(sdk): Improve a doc and format code. 2024-09-09 09:20:01 +02:00
Damir Jelić
1eecb2d603 ui: Remove the e2e-encryption feature from the matrix-sdk-ui crate
It does not make much sense to create an UI client that does not support
end-to-end encryption, besides disabling the feature was broken for
quite some time.
2024-09-06 15:37:18 +02:00
Damir Jelić
98ba714b20 sdk: Fix a clippy warning 2024-09-06 13:51:04 +02:00
Andy Balaam
07aa6d7bc7 doc: Fix missing 'o' in the doc comment for the recovery module 2024-09-05 17:12:15 +01:00
Benjamin Bouvier
9df1c48079 timeline(tests): ASCII art 2024-09-05 16:46:25 +02:00
Benjamin Bouvier
977a9995fe timeline(tests): simplify matching a day divider or a read marker using public APIs 2024-09-05 16:46:25 +02:00
Benjamin Bouvier
f978960d30 timeline: don't insert a read marker when all subsequent events have been inserted by ourselves 2024-09-05 16:46:25 +02:00
Benjamin Bouvier
3f93324a85 timeline(style): gather common code under the same arm branches 2024-09-05 16:46:25 +02:00
Richard van der Hoff
3204953738 crypto: update changelog 2024-09-05 13:22:10 +01:00
Richard van der Hoff
88b005ace3 crypto: clarify logging on conclusion of verification requests
* Not verifying the remote device/user is normal: log it at debug rather than
  info.
* On the other hand, if we do verify something, let's log that at info rather
  than trace.

Also fix a comment, while we're here.
2024-09-05 13:22:10 +01:00
Richard van der Hoff
c761a84acd crypto: logging during QR code verifications
* Upgrade the log when we get the "reciprocate" message (which tells us the
   other side has scanned our QR code) to debug, instead of trace.
 * Warn if we get a reciprocate we don't understand
 * Log when the user confirms that the other side has scanned successfully.
2024-09-05 13:22:10 +01:00
Richard van der Hoff
a2bfc07ecc crypto: log the method on an m.verification.start message
This is the message that tells us whether the other side wants to do QR code or
SAS (emoji) verification. Knowing which they have chosen is really helpful for
following the flow!
2024-09-05 13:22:10 +01:00
Richard van der Hoff
b1a533a071 crypto: log flow_id when processing verification requests
Attach the flow_id (the transaction ID or message ID from the `request`
message) to the span, so that it is displayed alongside loglines that happen
when processing the request.
2024-09-05 13:22:10 +01:00
Richard van der Hoff
fed418d9a8 crypto: log when we show a QR code
Take the logging that happens when a QR code verification is added to the
`verification cache`, and push it down to the `VerificationCache` itself. Doing
so means that we will log when we *show* a QR code as well as when we scan it.

I would have found this helpful when trying to debug a verification flow this
week.
2024-09-05 13:22:10 +01:00
Richard van der Hoff
2c2d8e9ff0 crypto: log details of our public identity when we update it
For debugging, it's useful to have a record of what we believe our own public
cross-signing keys to be. Currently, we log the keys at startup if we restore
them from the database, but if we subsequently create, or download, a set of
keys, they aren't logged.
2024-09-05 13:22:10 +01:00
Andy Balaam
b9b8de7ff1 crypto: Mark all new SenderData info as non-legacy
Since we now have a clear idea of the structure, and anything we create
now should be usable in future.
2024-09-05 13:54:01 +02:00
Benjamin Bouvier
552df0e4c6 timeline(tests): use the event factory in a few more places 2024-09-05 10:01:37 +02:00
Benjamin Bouvier
12f36d5972 timeline: document and rename some concepts around pending poll events 2024-09-05 10:01:37 +02:00
Richard van der Hoff
f7ee643475 crypto: update changelog 2024-09-04 16:07:03 +01:00
Richard van der Hoff
73486b2b7b crypto: update senderdata integration tests
Extend the integration tests for megolm sender data to check that we update
existing inbound group sessions when we get a `/keys/query` response.
2024-09-04 16:07:03 +01:00