Commit Graph

9156 Commits

Author SHA1 Message Date
Damir Jelić fefdfd2e4b test: Add a test to verify that interactive self-verification works
This also checks that secrets are gossiped from one device to the
other and that the recovery and backup states are correctly updated.
2024-06-26 14:31:31 +02:00
Damir Jelić d4bbdfd106 test(integration): Allow the creation of multiple clients for the same user 2024-06-26 14:31:31 +02:00
Kévin Commaille 973df115f8 ci: Bump the version of Rust nightly again
Should get rid of the `rewriting_static` noise when running rustfmt

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 14:10:36 +02:00
Kévin Commaille eaf7a9e350 chore: rustfmt fixes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 14:10:36 +02:00
Kévin Commaille dad2e6eafd ci: Bump the version of Rust nightly
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 14:10:36 +02:00
Kévin Commaille 56739202cf sdk: Disable new rustc warnings
The issue here seems to be that
the `panic!` and `unreachable!()` macros used in the tests return `!`.
In the future, `!` will not fallback to `()`, which is what `dependency_on_unit_never_type_fallback` checks.
`add_event_handler` expects a function that returns an `EventHandlerResult`, but it is only implemented for `()`, not for `!`.

A solution could be to implement that trait for `!` but it is an unstable feature right now.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 14:10:36 +02:00
Kévin Commaille a31d362137 crypto: Disable clippy false positives
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 14:10:36 +02:00
Kévin Commaille 0cc7103fd9 docs: Fix indentation of list items paragraphs
Thanks to the new doc_lazy_continuation clippy lint in nightly.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 14:10:36 +02:00
Kévin Commaille 22171d58de sdk: Mark openidconnect crate as optional
It is only needed with the experimental-oidc and e2e-encryption features.
The former is less likely to be enabled so use it to enable the dependency.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 14:09:40 +02:00
Damir Jelić 3be84a5a30 refactor(sdk-crypto): Room key sharing, introduce extensible strategy
This patch set does two things:

1. Extracted the logic to collect the devices that should receive a room key.
2. Introduce a new CollectStrategy enum which defines which rules are
   used to collect recipient devices for a room key. Currently only the
   existing rules have beenmoved under this enum.
2024-06-25 16:54:25 +02:00
Valere ca6537badc Fix: post rename fix, update test relative paths for json inputs 2024-06-25 16:35:11 +02:00
Kévin Commaille 1221d151df sdk: Add support for authenticated media requests (#3598)
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-25 14:16:58 +00:00
Valere 90f92ac950 Refactor: Move file to match project module naming conventions 2024-06-25 16:01:54 +02:00
Benjamin Bouvier 4d6ee63760 sdk: retry all requests which previous response was a plain 429 without an errcode
This can happen if there's a load-balancer or any modification of the
response by a reverse proxy (e.g. rewrite 5XX errors into 429, to not
let a reverse proxy mark the upstream server as being down, as
Cloudflare seems to do).

As a result, such requests will be retried in multiple places, including
when sending something with the send queue. Also, the send queue will
mark these errors as recoverable instead of unrecoverable.

No test, because the change really is trivial and a regression test
didn't seem worth it, for once.
2024-06-25 13:47:01 +02:00
Benjamin Bouvier 58c687b71b send queue: mark reloaded local echoes as wedged or not
Part of #3361.
2024-06-25 13:30:24 +02:00
Damir Jelić 0ab0678be3 fix(sdk): when an encryption event is received, mark the room encryption as set #3602
RoomInfo::handle_state_event(...) will check this condition so we don't have to later ask the HS whether the room is encrypted or not through room::is_encrypted().

Also, as we need some way to get this info in the room list in our clients, two ways of doing this were added the FFI crate, one through RoomInfo and another one through RoomListItem.
2024-06-25 13:00:03 +02:00
Jorge Martín 0162f6ba49 Add doc clarification for ffi::room_list_item.is_encrypted() 2024-06-25 12:42:59 +02:00
Benjamin Bouvier 0701c7d652 send queue: allow sending raw events from the send queue
This requires a bit of API rejiggering, but turns out not so bad
actually.
2024-06-25 11:31:34 +02:00
Benjamin Bouvier 2855b0f6a8 sdk: bump ruma to get the bug-fix for the serialization issue related to thread replies 2024-06-25 11:31:34 +02:00
Valere 5c93372e8a refactor(sdk-crypto) - RoomKey Sharing | More test 2024-06-25 11:17:54 +02:00
Valere d6e523c1d1 refactor(sdk-crypto) - RoomKey Sharing | add settings for strategy 2024-06-25 11:16:24 +02:00
Valere 9cb068da25 refactor(sdk-crypto) - RoomKey Sharing | extract function 2024-06-25 10:30:36 +02:00
Valere 944972c27a refactor(sdk-crypto) - RoomKey Sharing | extract share module 2024-06-25 09:21:28 +02:00
Jorge Martín d8900bd6d7 Fix clippy 2024-06-24 16:18:18 +02:00
Jorge Martín 912e75c1f8 ffi: add RoomListItem::is_encrypted() function. 2024-06-24 16:01:19 +02:00
Jorge Martín 004941b6b4 ffi: add encryption info to RoomInfo 2024-06-24 16:00:29 +02:00
Jorge Martín 0bc40eadc3 sdk-base: when a m.room.encryption event is received, mark the room encryption as set.
`RoomInfo::handle_state_event` will check this condition so we don't have to later ask the HS whether the room is encrypted or not through `room::is_encrypted()`.
2024-06-24 16:00:07 +02:00
Benjamin Bouvier 74b770f4d6 send queue: use state-store backed storage for remembering events to be sent 2024-06-24 13:56:10 +02:00
Benjamin Bouvier e1e4422670 sdk: update ruma to custom fork with proper event content deserialization 2024-06-24 13:56:10 +02:00
Benjamin Bouvier 90f73195b1 send queue: introduce fallible fake state store in the send queue code 2024-06-24 13:56:10 +02:00
Richard van der Hoff 1b48bf7dc6 crypto: Log content of received m.room_key_withheld messages (#3591) 2024-06-24 11:47:53 +01:00
Doug e89659b69d ffi: Tidy up authentication.rs file.
(Nothing changed, just moving things around)
2024-06-24 10:56:04 +02:00
Doug 6d728be32d ffi: Split up AuthenticationError between ClientBuildError and a new OidcError. 2024-06-24 10:56:04 +02:00
Doug 5cbc803347 ffi: Refactor authentication_service.rs to authentication.rs 2024-06-24 10:56:04 +02:00
Doug 2d479e0177 ffi: Remove the AuthenticationService 2024-06-24 10:56:04 +02:00
Kévin Commaille 730c287201 chore: Fix new clippy nightly lints
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-23 20:20:09 +02:00
Johannes Marbach 3f1b9fe524 fix(ffi): Downgrade security-framework to 2.10.0
Fixes: #3596
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2024-06-21 22:59:08 +02:00
Andy Balaam 2b1bddb2f0 Merge pull request #3587 from matrix-org/doug/client-oidc-helpers
sdk: Move the OIDC helper methods from the FFI's `AuthenticationService` into `Client`
2024-06-21 10:14:35 +01:00
Doug 837cfaed48 sdk: Clarify InvalidState OIDC check and prepare abort method for the FFI. 2024-06-20 15:54:06 +01:00
Doug 655ced2c81 docs: Clarify some of the OIDC helper methods more. 2024-06-20 15:54:06 +01:00
Doug 748f40c250 sdk: Add ClientBuilder::requires_sliding_sync method. 2024-06-20 14:27:55 +02:00
Doug 8bf104c55e ffi: Add ClientBuilder::requires_sliding_sync method. 2024-06-20 14:27:55 +02:00
Doug db38d25b5b sdk: Test the OIDC helper methods. 2024-06-20 13:23:04 +01:00
Damir Jelić af141575c9 chore: Update the changelog 2024-06-20 14:06:01 +02:00
Ivan Enderlin 6701fd0685 Merge pull request #3586 from Hywan/feat-ui-room-list-new-is-infallible 2024-06-20 13:47:28 +02:00
Damir Jelić 6dde95c865 examples: Add a recovery command to the oidc-cli example
This adds support to input your recovery key to the OIDC example which
will allow the OIDC example client to be verified and have access to all
the secrets (cross-signing keys and the backup recovery key).

Not particularly useful right now, but once the OIDC example is able to
log in other devices via a QR code it becomes necessary to have access
to all the secrets.
2024-06-20 13:43:14 +02:00
Doug 082dda0b24 sdk: Add the OIDC helper methods from the FFI. 2024-06-20 12:05:23 +01:00
Benjamin Bouvier 4ee56fa62e room: rename the encrypted log field to is_room_encrypted (#3572) 2024-06-20 12:18:00 +02:00
Benjamin Bouvier c06b6d91c3 timeline: get rid of the indirection for the Unsupported* errors
No idea why we had these wrappers, and IMO they just add unnecessary
noise, so let's get rid of them.
2024-06-20 10:11:47 +02:00
Benjamin Bouvier fd9d3bd3a1 timeline: refactor edit_info/replied_to_info 2024-06-20 10:11:47 +02:00