Commit Graph

8426 Commits

Author SHA1 Message Date
Andy Balaam
4bdcedbc66 Merge pull request #3221 from matrix-org/andybalaam/store-trackedusers-in-memorystore
crypto: Store TrackedUsers in MemoryStore
2024-03-19 15:29:13 +00:00
Damir Jelić
3ccd2e9f8f crypto: Remove the KeysBackup variant of the OutgoingRequest enum
Backing up room keys isn't part of the outgoing requests processing
loop, instead the user is supposed to have a separate loop calling
`BackupMachine::backup()`.
2024-03-19 16:23:13 +01:00
Andy Balaam
099c855049 crypto: Store TrackedUsers in MemoryStore 2024-03-19 15:16:53 +00:00
Hubert Chathi
1e35188aec Add a dehydrated flag to device_keys of dehydrated devices (#3164)
Signed-off-by: Hubert Chathi <hubert@uhoreg.ca>
Co-authored-by: Damir Jelić <poljar@termina.org.uk>
2024-03-19 14:33:13 +00:00
Benjamin Bouvier
c6da40cf55 ffi: bump opentelemetry crates
This gets rid of multiple duplicate crates in the dependency tree.
2024-03-19 14:21:59 +01:00
Kévin Commaille
0ff9e066fb sdk: Don't enable default features of mas-oidc-client
We don't need the `hyper` feature as we use our own HTTP client,
and the `keystore` will not be used in most cases.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-03-19 14:01:53 +01:00
Damir Jelić
c59465c54c crypto: Rotate fallback keys in a time-based manner (#3151)
Fallback keys until now have been rotated on the basis that the
homeserver tells us that a fallback key has been used.

Now this leads to various problems if the server tells us too often that
it has been used, i.e. if we receive the same sync response too often.
It leaves us also open to the homeserver being dishonest and never
telling us that the fallback key has been used.

Let's avoid all these problems by just rotating the fallback key in a
time-based manner.

Signed-off-by: Damir Jelić <poljar@termina.org.uk>
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
2024-03-19 13:16:37 +01:00
Jorge Martin Espinosa
0c4b62f664 sdk: move get_profile from Client to Account (#3238)
This also renames and streamlines the existing `Account::get_profile` function to `Account::fetch_profile` which now calls the more general function.
2024-03-19 12:03:32 +00:00
Andy Balaam
8c2831a5da Merge pull request #3220 from matrix-org/andybalaam/save-outbound-sessions-in-memorystore
crypto: Save outbound sessions in MemoryStore
2024-03-19 11:38:59 +00:00
依云
4e8cee162a sdk: make content of RawEvent public (#3239)
This way it can be moved out and converted to other types like ruma::Serde::Raw.

Signed-off-by: lilydjwg <lilydjwg@gmail.com>
2024-03-19 11:28:34 +00:00
Andy Balaam
1e11ac406f crypto: Use a BTreeMap for MemoryStores' OutboundGroupSessions 2024-03-19 11:26:20 +00:00
Marco Antonio Alvarez
10069fbead MSC2530: added the ability to send media with captions (#3226)
Now that there is some support for [MSC2530](https://github.com/matrix-org/matrix-spec-proposals/pull/2530), I gave adding sending captions a try. ( This is my first time with Rust 😄  )

I tried it on Element X with a hardcoded caption and it seems to work well
![image](https://github.com/matrix-org/matrix-rust-sdk/assets/683652/597e5ebf-f7f2-498f-97a4-ac98613c1134)

(It even got forwarded through mautrix-whatsapp and the caption was visible on the Whatsapp side)

---

* ffi: Expose filename and formatted body fields for media captions

In relevance to MSC2530

* MSC2530: added the ability to send media with captions

Signed-off-by: Marco Antonio Alvarez <surakin@gmail.com>

* signoff

Signed-off-by: Marco Antonio Alvarez <surakin@gmail.com>

* fixing the import messup

* fix missing parameters in documentation

* fix formatting

* move optional parameters to the end

* more formatting fixes

* more formatting fixes

* rename url parameter to filename in send_attachment and helpers

* fix send_attachment documentation example

* move caption and formatted_caption into attachmentconfig

* fix formatting

* fix formatting

* fix formatting (hopefully the last one)

* updated stale comments

* simplify attachment message comments

---------

Signed-off-by: Marco Antonio Alvarez <surakin@gmail.com>
Co-authored-by: SpiritCroc <dev@spiritcroc.de>
2024-03-19 11:08:47 +01:00
Andy Balaam
56da4a31a4 Merge pull request #3231 from matrix-org/andybalaam/wiremock-as-workspace-dep
build: Make wiremock a workspace dependency
2024-03-19 10:04:04 +00:00
Andy Balaam
ca13be020c build: Make wiremock a workspace dependency 2024-03-19 09:39:31 +00:00
Samy Djemaï
baf97c69b1 chore: upgrade uniffi-rs to latest commit
Signed-off-by: Samy Djemaï <53857555+SamyDjemai@users.noreply.github.com>
2024-03-19 10:37:26 +01:00
Andy Balaam
b2c96b72b0 ci: Add a CI workflow to verify the minimum supported Rust version 2024-03-18 18:39:07 +01:00
Andy Balaam
9d281937d5 build: Add a missing dependency on wiremock even when testing feature is not enabled 2024-03-18 18:39:07 +01:00
Benjamin Bouvier
818a435f9e event cache: rename backpaginate_with_token to backpaginate 2024-03-18 17:02:05 +01:00
Andy Balaam
486b6d6e2b crypto: Save outbound sessions in MemoryStore 2024-03-18 15:21:41 +00:00
Andy Balaam
32edfb1a9f Merge pull request #3219 from matrix-org/andybalaam/fix-warnings-in-integration-tests
crypto: Fix warnings in integration_tests.rs (and a tiny bug)
2024-03-18 15:11:53 +00:00
Andy Balaam
9159a5983b crypto: Fix typo bug in integration tests 2024-03-18 14:54:59 +00:00
Andy Balaam
69ac7e07e6 crypto: Fix warnings in integration tests 2024-03-18 14:54:59 +00:00
Andy Balaam
ee23839259 crypto: Remove unused imports from integration_tests.rs
The warnings were hidden because no-one within this crate used this macro.
2024-03-18 14:54:59 +00:00
Ivan Enderlin
555dfe0e77 feat(sdk): LinkedChunk can hold a value for Gaps
feat(sdk): `LinkedChunk` can hold a value for `Gap`s
2024-03-18 12:50:25 +01:00
Ivan Enderlin
7f7d9b8175 chore(sdk): Rename T and U in LinkedChunk.
This patch renames the generic parameters `T` and `U` to `Item` and
`Gap` for the `LinkedChunk` type and siblings.
2024-03-18 12:36:51 +01:00
Benjamin Bouvier
57f6715784 timeline: get rid of the update_timeline_item! macro and replace it with function calls 2024-03-18 12:36:35 +01:00
Benjamin Bouvier
b587c064d7 timeline: prefix more tests with test_ 2024-03-18 12:36:35 +01:00
Benjamin Bouvier
52dc64e0db timeline: add doc comments here and there 2024-03-18 12:36:35 +01:00
Andy Balaam
7b7ee980e8 build: Update minimum supported Rust version to 1.76
This reflects the reality of the situation at the moment: we need 1.76.
to compile, and Ruma requires 1.75.
2024-03-18 11:45:02 +01:00
Ivan Enderlin
5591be9a8e feat(sdk): LinkedChunk can hold a value for Gaps.
This patch updates `ChunkContent::Gap` to hold a content `U`. Thus,
`Chunk` and LinkedChunk` both get a new generic parameter `U`. Some
methods like `new_gap` or `insert_gap_at` take a new `content: U`
parameter.

This type `RoomEvents` (that uses `LinkedChunk`) is also updated
accordingly.
2024-03-18 10:52:46 +01:00
Kévin Commaille
876d3237eb sdk: Check if server name points to homeserver during discovery (#3218)
The small first commit reintroduces `sanitize_server_name` in the public API. In Fractal, we use it to validate the string in the input before allowing the user to trigger the discovery.

The main commit changes a bit the discovery process: before, server names like `example.org` would only be checked for the presence of a well-known, and only URLs like `https://example.org` would be checked as a homeserver. Now, providing `example.org` will also check if `https://example.org` is the URL of a homeserver.

Sadly I don't think it's possible to add tests for it as it would require to have a homeserver accessible via HTTPS.

---

* sdk: Restore sanitize_server_name in the public API

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* sdk: Check if a provided server name points to a homeserver during discovery

Before, only URLs like `https://example.org` would be checked as a homeserver.
Providing `example.org` will check if `https://example.org` is the URL of a homeserver.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Refactor to avoid duplication

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-03-15 19:18:33 +00:00
Benjamin Bouvier
cabab289c9 timeline: get rid of ManuallyDrop in the TimelineInnerStateTransaction 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
a98779dfbb timeline: use u64 for all the fields of PaginationOutcome 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
182e84cd3d timeline: get rid of deref/deref_mut from TimelineInnerState to TimelineInnerMetadata 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
5c049d6e2e timeline: rename handle_joined_room_update to handle_sync_events 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
057bca070c timeline: get rid of the synthetic Timeline and JoinedRoomUpdate when updating the timeline 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
75871216d2 timeline: sanitize usage of meta in the TimelineInnerStateTransaction
Before this patch, the meta field would be mutated, even when the transaction would be aborted. This changes the update scheme to meta
with the following:

- when creating the transaction, clone the meta (but keep the pointer location to the previous one)
- all the transaction's methods operate on the WIP meta
- when committing, replace the previous meta with the current one
2024-03-15 15:08:10 +01:00
Benjamin Bouvier
4661ca810a timeline: get rid of deref/deref_mut from TimelineInnerStateTransaction to TimelineInnerMetadata 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
f3687dc4c7 timeline: don't return the unused event id in handle_remote_event 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
694fb57c17 timeline: lower the number of methods to add events 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
e1b9fe266d timeline: prefix a few tests with test_ 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
35a1596755 timeline: change number of added/updated items to u64 in `HandleManyEventsResult
u64 should be enough for everyone?
2024-03-15 15:08:10 +01:00
Benjamin Bouvier
117307eaff timeline: inline TimelineInnerStateTransaction::handle_live_event 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
52a5a86cf9 event cache: important status update 2024-03-15 15:08:10 +01:00
Benjamin Bouvier
9faa839f56 event cache: don't return the prev_batch token anymore \o/
It's now the event cache's responsibility to handle back-pagination, so the timeline doesn't have to do it anymore.
2024-03-15 15:08:10 +01:00
bitfriend
5f960d889e Append the missed cancel codes 2024-03-15 11:52:08 +01:00
Richard van der Hoff
a328d8787a crypto: Log errors from Olm decryption (#3212)
When we fail to decrypt an olm message, it is useful to know *why* it
failed. Include the details of the failures in the warning message.
2024-03-14 15:22:46 +00:00
Benjamin Bouvier
d1e92ece42 timeline: move the back-pagination code into the timeline/pagination.rs file
No changes in behavior, just pure code motion.
2024-03-14 15:47:53 +01:00
Benjamin Bouvier
ff4a8f0ba5 timeline: integrate the event cache pagination into the UI timeline 2024-03-14 15:47:53 +01:00
Ivan Enderlin
0a7e28f681 Merge pull request #3166 from Hywan/feat-sdk-event-cache-store-experimental
feat(sdk): Event cache experimental store
2024-03-14 15:27:22 +01:00