Commit Graph

9132 Commits

Author SHA1 Message Date
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
Doug
735ae1ce75 ffi: Move OIDC logic into Client. 2024-06-19 18:17:27 +01:00
Kévin Commaille
a2235d50c1 crypto: Decrypt events bundled in unsigned object of another event
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-06-19 17:40:49 +02:00
Ivan Enderlin
96f4a1f085 feat(sdk): room_list_service::Room::new is now infallible.
This patch makes `Room::new` infallible, i.e. it no longer returns a
`Result<Self, _>` but `Self` directly.
2024-06-19 17:14:56 +02:00
Ivan Enderlin
0cd93a2f06 Merge pull request #3578 from Hywan/fix-sdk-linked-chunk-substract-overflow
fix(sdk): Fix a substract with overflow in `LinkedChunk`
2024-06-19 14:05:08 +02:00
Ivan Enderlin
edcd573b6f fix(sdk): Fix a substract with overflow in LinkedChunk. 2024-06-19 12:17:23 +02:00
Damir Jelić
a6c962b9b0 chore: Fix the compilation of the benchmarks outside of the workspace root
The workspace root enables some features which are required to compile
the benchmarks, but if you decide to just compile the benchmarks these
features won't be enabled since they aren't specified in the Cargo.toml
file of the benchmarks.

Let's define all the required features so compilation works in both
cases.
2024-06-19 12:06:53 +02:00
Mauro
306a9f7d3b Allow edit and reply to work also for events that have not yet been paginated (#3553)
Fixes #3538 

The current implementation for send_reply and edit only work with timeline items that have already been paginated.
However given the fact that by restoring drafts, we may restore a reply to an event for timeline where such event has not been paginated, sending such reply would fail (same for the edit event).

So I reworked a bit the code here to use. only the event id, and reuse the existing timeline if available, otherwise we can fetch the event and synthethise the content and still be able to successfully send the event.

This is the third part of the breakdown of the following PR: https://github.com/matrix-org/matrix-rust-sdk/pull/3439
2024-06-19 11:58:57 +02:00
dependabot[bot]
2834fa135a build(deps): bump curve25519-dalek from 4.1.2 to 4.1.3
Bumps [curve25519-dalek](https://github.com/dalek-cryptography/curve25519-dalek) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/dalek-cryptography/curve25519-dalek/releases)
- [Commits](https://github.com/dalek-cryptography/curve25519-dalek/compare/curve25519-4.1.2...curve25519-4.1.3)

---
updated-dependencies:
- dependency-name: curve25519-dalek
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-19 11:41:05 +02:00
Richard van der Hoff
4822057163 sdk: Fix key backup download for ratcheted sessions (#3568)
Fixes https://github.com/matrix-org/matrix-rust-sdk/issues/3446 by checking
that we have the key for the event in question, not just the key for the
session.
2024-06-19 09:40:19 +01:00
Ivan Enderlin
6340eeac0b Merge pull request #3068 from Hywan/feat-roomlist-sorting
feat(base): Implement `Client::rooms_stream`
2024-06-19 08:27:37 +02:00
Ivan Enderlin
717c68d9b4 test(sdk): Test Client::rooms_stream.
This patch adds an integration test for `Client::rooms_stream`.
2024-06-18 17:37:08 +02:00
Ivan Enderlin
1e639c431f doc(base): Improve documentation. 2024-06-18 17:37:07 +02:00
Ivan Enderlin
dd2ef57d37 feat(base): Extract ObservableMap into its own module. 2024-06-18 17:37:07 +02:00
Richard van der Hoff
565f97409e sdk: Rewrite BackupDownloadTask
Change this so that it fires off a task for each UTD event, rather than each
megolm session. This is a step towards considering the message index when
deciding whether to carry on with the download.
2024-06-18 14:17:36 +01:00
Richard van der Hoff
792402eca2 sdk: Expose WeakClient::strong_count
... allowing you to see if the client is alive without the overhead of
constructng a ref to the client.
2024-06-18 14:17:36 +01:00
Richard van der Hoff
53e3a7c242 sdk: BackupDownloadTask: use a new struct for the mpsc queue
We'll need to add more data here soon.
2024-06-18 14:17:36 +01:00
Richard van der Hoff
dc2111f156 sdk: Push deserialization of UTD events down to BackupDownloadTask
This means the higher-level classes can be agnostic about the encryption
algorithm; we don't actually care about that until BackupDownloadTask.
2024-06-18 14:17:36 +01:00
Richard van der Hoff
f1802d9bbe sdk: update Backups::utd_event_handler api
Make it take a `Raw<OriginalSyncRoomEncryptedEvent>`, to be consistent with
`Room::decrypt_event`.
2024-06-18 14:17:36 +01:00
Richard van der Hoff
2b5d2e97c0 sdk: add documentation on Backups::utd_event_handler 2024-06-18 14:17:36 +01:00
Benjamin Bouvier
0b9daa2702 timeline: when deduplicating event meta, keep the most recent instead of the oldest
Not doing this leads to an invalid ordering of events, as shown in the
test: if we increase the timeline limit of a room using sliding sync,
we'll receive a duplicate event, and if we ignore it, it'll be in an
invalid position. The solution is to keep the most recent event (and
remove the old one from event_meta).
matrix-sdk-ffi/20240618
2024-06-18 14:39:27 +02:00
Doug
304350ffd4 ffi: Expose room heroes (adding support for avatars). (#3503)
This PR makes 2 changes:
- Updates the storage of room heroes to be a single array containing the user's complete profile.
- Exposes these to the FFI so that client apps can use these for avatar colours/clusters.

Closes #2702 (again, now with avatars 🖼️)

---

* rooms: Store heroes as a complete user profile.

* ffi: Expose room heroes on Room and RoomInfo.

* chore: Remove TODO comment.

* Update crates/matrix-sdk-base/src/rooms/normal.rs

Signed-off-by: Benjamin Bouvier <public@benj.me>

---------

Signed-off-by: Benjamin Bouvier <public@benj.me>
Co-authored-by: Benjamin Bouvier <public@benj.me>
2024-06-18 10:10:09 +00:00
Benjamin Bouvier
8988094df5 sdk: introduce RetryKind next to the HttpError to determine errors that should be retried
retry kind: make `characterize_retry_kind` a method of `HttpError`

---

retry kind: mark all network errors as transient

This should cause more backoff in general, if the client is disconnected
of the grid, or the remote server is, which is good behavior to have in
general.

---

http error: introduce another rustfmt-formated impl block for HttpError

The previous `impl` block was marked as skipping rustfmt, which led to
weird formatting behavior.

Changes are formatting only.
2024-06-17 17:15:07 +02:00
Benjamin Bouvier
f93df8cb9e send queue: improve testing with a lil macro 2024-06-17 17:15:07 +02:00
Benjamin Bouvier
ced8c4c821 send queue: add a test that simulates unreachable network/server 2024-06-17 17:15:07 +02:00