Commit Graph

9194 Commits

Author SHA1 Message Date
Damir Jelić
a819dd568d utils: Return the old value in the set method of ChannelObservable 2024-07-01 14:38:26 +02:00
Kévin Commaille
7fee66da11 ui: Rename EventItemIdentifier to TimelineEventItemId
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-07-01 14:32:16 +02:00
Kévin Commaille
9f929f7670 ui: Docs fixes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-07-01 14:32:16 +02:00
Kévin Commaille
b9d0aa9b54 ui: Expose content of RepliedToInfo and EditInfo
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-07-01 14:32:16 +02:00
Kévin Commaille
f0867262c7 ui: Get rid of TimelineEventItemId
There is EventItemIdentifier for the same purpose.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-07-01 14:32:16 +02:00
Benjamin Bouvier
2507a450df send queue: add useful logs when aborting/editing a local echo 2024-07-01 14:12:44 +02:00
Kévin Commaille
a7e4849f25 sdk: Use strongly-typed strings where it makes sense
Where a string is clearly documented as a room ID, event ID or mxc URI,
use OwnedRoomId, OwnedEventId and OwnedMxcURI, respectively.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-07-01 12:55:15 +02:00
Damir Jelić
769fe8bb7d ci: Add a github workflow to fail when fixup commits exist
We tend to use fixup commits quite a bit, and in the heat of the moment
we sometimes forget to squash them before the final merge.

This should prevent us from doing so.
2024-07-01 12:30:02 +02:00
Benjamin Bouvier
52fa00e474 sdk: remove Error::InconsistentState as it was unused 2024-07-01 08:57:09 +02:00
Benjamin Bouvier
17d18321f2 send queue: mark ConcurrentRequestFailed as recoverable
This will still disable the room's send queue, but the embedder may then
decide whether to re-enable the queue or not, based on network
connectivity. Ideally, we'd implement some retry mechanism here too, but
since we're at a different layer than the HTTP one, we can't get that
"for free", so let the embedder decide what to do here.
2024-07-01 08:56:55 +02:00
Kévin Commaille
374da7674e crypto: Remove assert_matches2 from regular dependencies
It was added as a regular dependency in #3517
but it is only used in tests.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-07-01 08:36:32 +02:00
Stefan Ceriu
38a18c3c8e feat(ffi): add Element specific well known struct and a way to deserialize it from external clients 2024-06-28 16:58:55 +02:00
Stefan Ceriu
70fddc0e1b feat(ffi): expose method for reading the server name part of the current user's identifier. 2024-06-28 16:58:55 +02:00
Stefan Ceriu
84796ab32a feat(ffi): expose method for sending generic GET requests through the SDK's inner HTTP client. 2024-06-28 16:58:55 +02:00
Andy Balaam
6464d21813 crypto: Storage changes for keeping sender data with InboundGroupSessions (#3556)
Signed-off-by: Andy Balaam <mail@artificialworlds.net>
Co-authored-by: Damir Jelić <poljar@termina.org.uk>
2024-06-28 14:14:55 +02:00
Hubert Chathi
cb4c575234 Reshare Megolm session after the other party unwedges (#3604)
For each recipient device, we keep an "Olm wedging index" that indicates (approximately) how many times they tried to unwedge the Olm session. When we share a Megolm session, we store the Olm wedging index. This allows us to tell whether the Olm session was unwedged since we shared the Megolm session, so that we know if we should re-share it.

We detect an attempt to unwedge the Olm session by checking if the Olm message that we decrypted is from a brand new Olm session. This is not entirely accurate, since this could happen, for example, if Alice and Bob create Olm sessions at the same time. This may result in some Megolm sessions being re-shared unnecessarily, but should not make a huge difference.
2024-06-28 10:08:58 +02:00
Benjamin Bouvier
1c92633a23 ffi: add new error conversions into ClientError
*sigh*
2024-06-27 18:53:00 +02:00
Benjamin Bouvier
c3cdc4526e ffi: rename Timeline::edit to Timeline::edit_by_event_id, and introduce a more general Timeline::edit 2024-06-27 18:53:00 +02:00
Benjamin Bouvier
58e2b618b7 timeline: allow editing a local echo too 2024-06-27 18:53:00 +02:00
Benjamin Bouvier
e808153473 timeline: react to send queue local echo updates (for room-message events) 2024-06-27 18:53:00 +02:00
Benjamin Bouvier
d49190ade4 send queue: allow editing a local echo 2024-06-27 18:53:00 +02:00
Benjamin Bouvier
45c6efcc65 state store: add method to update the content of a send queue event
It also resets the wedged state, so that the queue will retry to send
this event later. This will show useful in the following case: when an
event is too big, we can now retry to send it, even if it was blocked,
by splitting the event instead of copy/abort/recreate it.
2024-06-27 18:53:00 +02:00
Benjamin Bouvier
43d9abae73 base: tweak SerializableEventContent::new signature
The first parameter doesn't need to be taken by ownership, reference is
sufficient.
2024-06-27 18:53:00 +02:00
Benjamin Bouvier
394effbc72 send queue: rename AbortSendHandle to SendHandle 2024-06-27 18:53:00 +02:00
Hubert Chathi
d41af396cc Embed device keys in Olm-encrypted messages (#3517)
This patch implements MSC4147[1].

Signed-off-by: Hubert Chathi <hubertc@matrix.org>

[1]: https://github.com/matrix-org/matrix-spec-proposals/pull/4147
2024-06-27 12:18:52 +02:00
Ivan Enderlin
37c125c306 Merge pull request #3615 from Hywan/feat-base-synctimelinevent-constructor
chore(base): Use constructors of `SyncTimelineEvent` to simplify code
2024-06-27 11:11:16 +02:00
Benjamin Bouvier
8e8d793f0d fixup! state store: change schema for send_queue_events table 2024-06-26 19:42:14 +02:00
Benjamin Bouvier
29ac3e0dda fixup! state store: change schema for send_queue_events table 2024-06-26 19:42:14 +02:00
Benjamin Bouvier
7f0b035e86 ffi: respawn send queue tasks just before subscribing to the client-wide send q errors 2024-06-26 19:42:14 +02:00
Benjamin Bouvier
7daf493313 send queue: improve the module doc comment 2024-06-26 19:42:14 +02:00
Benjamin Bouvier
419dd57116 tracing timers: drive-by fix recursive macro usage 2024-06-26 19:42:14 +02:00
Benjamin Bouvier
a4098291af send queue: add a way to spawn tasks for all the rooms which had unsent events 2024-06-26 19:42:14 +02:00
Benjamin Bouvier
62801f1a6c state store: change schema for send_queue_events table
It turns out that so as to be able to read the room ids, they need to be
*values*, not only *keys* (since keys are one-way hashed). This means we
need to duplicate the room_id field in indexeddb/sqlite, so each entry
contains both the room_id as a key (for queries) and as a value (to
return it).

Since there's no meaningful migration we can apply, the way to go is to
drop the pending events table and recreate it from the ground up. It is
assumed that no one has used the store on indexeddb; otherwise the
workaround would be to drop and recreate it.
2024-06-26 19:42:14 +02:00
Benjamin Bouvier
24f62a5912 indexeddb: rename (de)serialize_event to (de)serialize_value 2024-06-26 19:42:14 +02:00
Ivan Enderlin
d59b28e121 chore(base): Use constructors of SyncTimelineEvent to simplify code. 2024-06-26 16:59:22 +02:00
Andy Balaam
ed9ab879c9 Merge pull request #3614 from zecakeh/reexport-eyeball-im
ui: Reexport eyeball-im
2024-06-26 15:22:10 +01:00
Kévin Commaille
28d6401c4f ui: Make public all timeline module errors
A few were missing in the public API like SendEventError and RedactEventError and their dependencies.
This uses a wildcard because it should be rare to not want to expose an error type.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 15:58:33 +02:00
Kévin Commaille
b8c2005422 ui: Reexport eyeball-im
A user of the library needs to add this crate as a dependency just to be able to match on `VectorDiff`.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-26 15:46:43 +02:00
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