Commit Graph

8894 Commits

Author SHA1 Message Date
Valere
e99b67c281 chore(crypto): Fixup version and changelog from patch release 2024-05-24 16:03:03 +02:00
Richard van der Hoff
1dc370942b Merge pull request #3456 from matrix-org/rav/fix_fix_backup_import
crypto: Wire up `save_inbound_group_sessions` to `room_keys_received` stream
2024-05-24 10:32:49 +01:00
Benjamin Bouvier
e0d7f4d9c6 timeline: make live_back_pagination_status available only on live timelines
It doesn't make sense to expose it for a focused timeline.

Note there's no way for timeline to change focus, at the moment; this
would require special handling here, because one could subscribe to the
back pagination status on a live timeline first, then switch the
timeline to the focus mode. The stream wrapper could then observe other
states that aren't expected by the converter method.
2024-05-24 11:21:34 +02:00
Benjamin Bouvier
aebfaf58a3 timeline: reintroduce a custom pagination status that indicates if we've hit the timeline start
This is actually required for one use case: if the event cache triggers
back-pagination in the background *before* a timeline is opened, it's
possible the timeline observes pagination is running at the beginning,
and doesn't know if more back-pagination is required or not.

This wraps the `Paginator::status` stream by reading the
hit_timeline_start() from the room pagination and adding it to the
`Idle` state.
2024-05-24 11:21:34 +02:00
Benjamin Bouvier
0d4c5c7f49 paginator: add a method to retrieve the current pagination status
i.e. did we hit the timeline start/end, after paginating sufficiently?
2024-05-24 11:21:34 +02:00
Damir Jelić
2de2bc658c feat(sdk): Return the Curve25519Public key type instead of a string (#3450) 2024-05-24 11:17:56 +02:00
Damir Jelić
15c4ba2fb9 feat(crypto): Allow the explicit upload of the device keys (#3457) 2024-05-24 11:15:33 +02:00
Damir Jelić
bb05b904cf feat(crypto): Allow the creation of an OlmMachine using a custom Account (#3451) 2024-05-24 10:54:21 +02:00
Damir Jelić
110d67cc62 feat(crypto): If available, sign the new device keys using the cross-signing keys (#3453) 2024-05-24 10:38:43 +02:00
Stefan Ceriu
03069f7acf fix: fix what permissions get_element_call_required_permissions returns and have them match what Element Call actually expects 2024-05-24 10:25:04 +02:00
Johannes Marbach
f7aee0ee36 Update JS bindings link
Signed-off-by: Johannes Marbach <johannesm@element.io>
2024-05-23 19:54:47 +02:00
Ivan Enderlin
e9dc02ae17 Merge pull request #3392 from Hywan/feat-sdk-linked-chunk-subscribe-as-vector 2024-05-23 19:02:45 +02:00
Benjamin Bouvier
11d66979d6 crypto(nit): remove unnecessary path qualifier in a test
The compiler has been pestering me with this, so here's a fix.
2024-05-23 18:52:14 +02:00
Richard van der Hoff
7e44fbca79 crypto: Wire up save_inbound_group_sessions to room_keys_received stream
https://github.com/matrix-org/matrix-rust-sdk/pull/3448 added a new method
`save_inbound_group_sessions` to `CrytoStore`, but forgot to wire it up to the
`room_keys_received` stream.
2024-05-23 17:08:58 +01:00
Richard van der Hoff
dcc32da55a Merge pull request #3448 from matrix-org/rav/fix_backup_import
Crypto: fix backed-up keys being re-backed-up
2024-05-23 16:20:32 +01:00
Ivan Enderlin
52c0614199 doc(sdk): Fix tiny typos. 2024-05-23 16:54:23 +02:00
Richard van der Hoff
0777aa6ece crypto: Remove Olm::import_room_keys altogether 2024-05-23 15:53:21 +01:00
Richard van der Hoff
3945071446 crypto: Update changelog 2024-05-23 15:53:16 +01:00
Richard van der Hoff
05e4d7a502 ffi: Deprecate import_decrypted_room_keys
... and expose a new method `import_room_keys_from_backup` which does the right
thing.
2024-05-23 15:52:22 +01:00
Richard van der Hoff
ba38d0c1de sdk: avoid deprecated BackupMachine::import_backed_up_room_keys
... and use its replacement, `Store::import_room_keys`
2024-05-23 15:52:22 +01:00
Richard van der Hoff
f7cc17e1e0 crypto: Deprecate BackupMachine::import_backed_up_room_keys
This whole method is a bit broken. It assumes that, when we did an import from
backup, the backup that they came from is the same as the "current" version.

We *could* add another argument, but to be honest I find the whole method a bit
pointless. It's not particularly tied to the `BackupMachine` abstraction. Let's
instead expose `Store::import_room_keys` and
`ExportedRooomKey::from_backed_up_room_key` publicly, and tell callers to use
that directly.
2024-05-23 15:52:22 +01:00
Richard van der Hoff
f77d2cd83f crypto: Use new CryptoStore::save_inbound_group_sessions method
When we are importing a batch of room keys, use the newly-added
`CryptoStore::save_inbound_group_sessions` method instead of
`CryptoStore::save_changes`.

To do this, we need to pass the backup version into `Store::import_room_keys`
instead of just `from_backup` flag.
2024-05-23 15:52:22 +01:00
Richard van der Hoff
4cd619ccdd crypto: New method CryptoStore::save_inbound_group_sessions
When we add a batch of inbound group sessions to the store, if they came from a
backup, we need to record which backup version they came from.
`CryptoStore::save_changes` doesn't give us an easy way to set the backup
version (we could add it to the `Changes` struct, but ugh).

So, we add a new method `save_inbound_group_sessions` which takes the backup
version as a separate param. This works fine, because whenever we import
sessions there are no other changes to store.

The new method isn't used outside of tests yet -- that comes in a follow-up
commit.
2024-05-23 15:52:22 +01:00
Richard van der Hoff
66aae2a0b5 crypto: Add a failing test demonstrating our problem 2024-05-23 15:52:22 +01:00
Damir Jelić
7fb57ea271 chore: Move the cross-process lock enabling into a separate method 2024-05-23 15:31:25 +02:00
Damir Jelić
4d9e41871e chore: The e2ee initialization tasks method doesn't need to return an error 2024-05-23 15:31:25 +02:00
Stefan Ceriu
f672f17fcf feat(calls): add support for sending Matrix RTC call notifications 2024-05-23 15:07:13 +02:00
Ivan Enderlin
39a6a2eb8c chore(sdk): Rename Update::PushItems::position_hint to …::at. 2024-05-23 13:40:08 +02:00
Benjamin Bouvier
13ceb3e745 sdk: make use of the WeakClient in the encryption/ directory too 2024-05-23 12:20:17 +02:00
Benjamin Bouvier
6250677493 sdk: move the WeakRoom into room/mod.rs
This moves code around, and tweaks the behavior:

- `WeakRoom::get()` returns an `Option`, that will be None if the client
is missing or the room is missing.
- `PaginableRoom` for `WeakRoom` will now return a default response if
the room could not be reconstructed from the weak room. It's fine to do
so because we're in a shutdown context.
2024-05-23 12:20:17 +02:00
Benjamin Bouvier
f1dcfd6332 event cache: keep a weak link to the room when paginating 2024-05-23 12:20:17 +02:00
Benjamin Bouvier
c40b3e768e sdk: add failing test for the strong Client <-> EventCache cycle 2024-05-23 12:20:17 +02:00
Benjamin Bouvier
3eaac27789 sdk: introduce a WeakClient data structure 2024-05-23 12:20:17 +02:00
Benjamin Bouvier
affb5d195e day dividers: remove all the trailing day dividers if needs be
multipletrailing
2024-05-23 12:19:07 +02:00
Benjamin Bouvier
7995c046b4 day dividers: tweak invariant
It's possible the timeline starts with a read marker, in which case the
first item won't be a day divider; in that case, check for the next
item, if present.

test_start_with_read_marker
2024-05-23 12:19:07 +02:00
Benjamin Bouvier
612ed3b603 day dividers: don't remove the final entry if it was already scheduled for removal 2024-05-23 12:19:07 +02:00
Ivan Enderlin
ba1c797db4 chore(sdk): Rename Updates to ObservableUpdates. 2024-05-23 11:45:34 +02:00
Ivan Enderlin
e3fdf19843 doc(sdk): Improve the documentation of AsVector. 2024-05-23 10:43:13 +02:00
Ivan Enderlin
c1061150a9 chore(sdk): derive(Clone) is implemented if all parameters are Clone. 2024-05-23 10:06:18 +02:00
Ivan Enderlin
c5f4168dd6 Merge pull request #3442 from matrix-org/rav/no_device_update_on_unchanged
crypto: emit no `identities_stream` items on no-op changes
2024-05-23 09:31:15 +02:00
Ivan Enderlin
7ea804bd2a Merge pull request #3443 from matrix-org/valere/apple_binding_update_podspec
Apple Bindings | Update SDKCrypto podspec files
2024-05-23 09:23:55 +02:00
Valere
748c3d514a Apple Bindings | Update SDKCrypto podspec files 2024-05-22 19:50:37 +02:00
Richard van der Hoff
818778cdf3 Add a test for invalid responses
This was untested before, and it seems the coverage gate is now sad.
2024-05-22 17:23:11 +01:00
Richard van der Hoff
2a605deaa5 changelog 2024-05-22 13:42:57 +01:00
Richard van der Hoff
a154cd4640 crypto: emit no stream update for unchanged devices
There is no need to emit a notification from `identities_stream` when all
devices are unchanged since last time.
2024-05-22 13:42:57 +01:00
Richard van der Hoff
eee0dc4e87 crypto: indicate when a device was updated
update `ReadOnlyDevice::update_device` to return a bool indicating whether
anything is changing.
2024-05-22 13:42:57 +01:00
Ivan Enderlin
28a8ce1732 chore(sdk): Make explicit a hidden lifetime. 2024-05-22 13:59:39 +02:00
Ivan Enderlin
3d3639a923 chore(sdk): Replace into_iter by iter. 2024-05-22 13:55:03 +02:00
Ivan Enderlin
57d454c557 chore(sdk): pin-project-lite is no longer required. 2024-05-22 13:54:00 +02:00
Ivan Enderlin
94fe6a9876 test(sdk): More tests for AsVector.
This patch adds another check to ensure `AsVector` generates
`VectorDiff`s that, once combined, produce an expected `Vector`. It
avoids errors when unit testing `VectorDiff` alone.
2024-05-22 13:28:29 +02:00