Commit Graph

2251 Commits

Author SHA1 Message Date
Jonas Platte 1e13e06e34 Make event-handling related Client fields private 2021-11-19 20:48:27 +01:00
Damir Jelić 5a4aa71f6a feat(base): Add a From login response implementation for the Session 2021-11-19 09:41:48 +01:00
Damir Jelić 6606703001 docs(base): Remove anyhow from an example since it isn't used 2021-11-19 09:12:51 +01:00
Andy Balaam 0c35d8890d Improve Session docs example 2021-11-18 17:14:34 +00:00
Andy Balaam 7d7bd97812 Document how to create a Session 2021-11-18 14:18:16 +00:00
Andy Balaam f5ba9a5eea Update BackupMachine documentaton to refer to enable_backup_v1 2021-11-18 10:28:03 +00:00
Damir Jelić 2e4d5f25cb feat(crypto): Add a method to get the algorithm of the public backup key 2021-11-17 13:02:23 +01:00
Damir Jelić 534e50da57 fix(crypto): Rename the enable_backup method so we can add a v2 one 2021-11-17 13:02:23 +01:00
Damir Jelić 1ffa06884a fix(crypto): Rename the decrypt method on the RecoveryKey struct
The new backup algorithm reuses the same key but uses a different
construct to encrypt/decrypt room keys. This reflects that our decrypt
method uses the v1 algorithm.
2021-11-17 13:02:23 +01:00
Damir Jelić 670e212d9b docs(crypto): Fill out the docs for the backup related types 2021-11-17 13:02:23 +01:00
Damir Jelić 6fc703b4a3 fix(crypto): Fix a bunch of clippy warnings 2021-11-17 13:02:23 +01:00
Damir Jelić 33b7062515 fix(crypto): Fix a bunch of typos 2021-11-17 13:01:58 +01:00
Damir Jelić a7bbeb7ef5 improvement(crypto): Add tests for the recovery key 2021-11-17 13:01:58 +01:00
Damir Jelić 34ec4ac3c9 improvement(crypto): Add tests for the backup machine 2021-11-17 13:01:58 +01:00
Damir Jelić 3f227de023 fix(crypto): Fix the backed up room key count in the memory store 2021-11-17 13:01:58 +01:00
Damir Jelić a417aa23fa fix(crypto): Load the recovery key from the sled store 2021-11-17 13:01:58 +01:00
Damir Jelić f8fdfd1613 fix(crypto): Add a proper exception when creating the Pk decryption object 2021-11-17 13:01:58 +01:00
Damir Jelić 1fdd560ff0 fix(crypto): Remove a unneeded clippy attribute 2021-11-17 13:01:58 +01:00
Damir Jelić 878969a5c4 docs(crypto): Add some docs for the backup related types 2021-11-17 13:01:58 +01:00
Damir Jelić c6d073ebd7 fix(crypto): Remove some dead code 2021-11-17 13:01:58 +01:00
Damir Jelić 2b5ae869cd feat(crypto): Gossip the backup recovery key if requested 2021-11-17 13:01:58 +01:00
Damir Jelić 2db52eed7c feat(crypto): Request the recovery key when we request secrets 2021-11-17 13:01:58 +01:00
Damir Jelić 656edce75a improvement(crypto): Make the backup logging prettier 2021-11-17 13:01:58 +01:00
Damir Jelić 4c021dea5e fix(crypto): Correctly reset the backup state of room keys 2021-11-17 13:01:58 +01:00
Damir Jelić bbd76dafa0 fix(crypto): Fix a bunch of clippy warnings 2021-11-17 13:01:58 +01:00
Damir Jelić 4f2c91d848 feat(crypto): Add a method to decrypt messages using the recovery key 2021-11-17 13:01:58 +01:00
Damir Jelić 6f5b6900d6 fix(crypto): Flush when we ugprade the DB 2021-11-17 13:01:58 +01:00
Damir Jelić eddc7bd6af feat(crypto): Add a method to check the signature of a backup version 2021-11-17 13:01:58 +01:00
Damir Jelić dfef6370b6 feat(crypto): Add a method to verify uploaded backups 2021-11-17 13:01:58 +01:00
Damir Jelić b5babdb6c4 fix(crypto): Don't load all room keys when backing up 2021-11-17 13:01:58 +01:00
Damir Jelić df53eb00ab fix(crypto): Fix a deadlock when generating the backup request 2021-11-17 13:01:58 +01:00
Damir Jelić 63915171fc feat(crypto): Add a method to check if backups are enabled 2021-11-17 13:01:58 +01:00
Damir Jelić 4873914d4d feat(crypto): Initial support for server-side backups of room keys 2021-11-17 13:01:44 +01:00
Damir Jelić f069387d58 docs(sdk): Add an example to the restore_login method 2021-11-15 16:15:05 +01:00
ftilde 8815c05108 Refactor Joined::send_attachment
Instead of manually modifying *EventContent structs, the ruma
constructors *::encrypted and *::plain are used now depending on whether
encryption should be used for the attachment or not.
2021-11-13 01:39:00 +01:00
ftilde dfc2ed7a33 Prefer MediaType::Encrypted if url and file are present
Some clients (including those using matrix-rust-sdk currently) may add
encrypted file info as well as the url to the encrypted blob to the
*EventContent. Interpreting the presence of an url as an indicator of
unencrypted message (like was done before) would result in access to the
encrypted blob in `get_media_content`.

Fixes #406.
2021-11-13 01:39:00 +01:00
Jonas Platte 38a8253aa8 Turn register_event_handler(_context)? examples into proper doctests
Previously, they didn't actually run the methods they were showing the
use of.
2021-11-12 12:39:07 +01:00
Jonas Platte 5fed5cdeed Allow adding custom event handler context 2021-11-12 12:39:07 +01:00
Jonas Platte df50d59de2 Update signature of AppService::register_event_handler
It no longer requires a mutable `AppService` and can also be chained,
like `Client::register_event_handler`.
2021-11-11 19:28:40 +01:00
Damir Jelić 1651952903 docs(sdk): Remove a bunch of unwraps from some doc examples 2021-11-11 16:58:43 +01:00
Damir Jelić 33a43af20e improvement(crypto): Use a type for the result of the room key import method 2021-11-11 16:57:31 +01:00
Damir Jelić 6a66a67454 fix(crypto): Fix the importing of exported room keys 2021-11-11 16:05:14 +01:00
Jonas Platte 83b908754e Remove unused dependencies
Found by cargo-udeps.
2021-11-10 21:43:56 +01:00
Jonas Platte 02b0ed2b42 Reduce dependencies on futures-* crates 2021-11-10 20:39:35 +01:00
Jonas Platte c124cf5b62 Remove unnecessary use of future::ready 2021-11-10 20:39:03 +01:00
Jonas Platte dfdf794199 Remove unnecessary use of TryFutureExt 2021-11-10 20:12:56 +01:00
Damir Jelić df2c0bd6e9 docs(sdk): Fix a typo in the enable_encryption method 2021-11-09 19:52:46 +01:00
Damir Jelić 2e04a3753d Merge branch 'one-time-key-generationf-fix' 2021-11-09 13:50:08 +01:00
Damir Jelić e1e864c606 fix(crypto): Save the account if we created a new key upload request 2021-11-09 12:30:48 +01:00
Damir Jelić 7f3067553b fix(crypto): Don't generate new one-time keys unless the existing ones are uploaded
This is helpful if the caller doesn't have propper request retrying.
Calling the outgoing_requests() method without actually uploading
all the requests would end up generating too many one-time keys and
removing some one-time keys that weren't used yet.

This would manifest itself down the line as undecryptable to-device
messages.
2021-11-09 11:45:20 +01:00