Skip to content

Commit c1274ce

Browse files
authored
Add support for pushing secrets and receiving secret pushes (matrix-org#6164)
see MSC4385 Pushing secrets allow devices to send secrets to other devices without waiting for a secret request.
1 parent 12cd1ef commit c1274ce

25 files changed

Lines changed: 1086 additions & 79 deletions

File tree

crates/matrix-sdk-crypto/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
88

99
### Features
1010

11+
- Add support for MSC4385.
12+
([#6164](https://github.com/matrix-org/matrix-rust-sdk/pull/6164))
13+
- Add new method `OlmMachine::push_secret_to_verified_devices`.
14+
- Pushed secrets that we receive from verified devices are added to the
15+
secrets inbox.
16+
1117
- Add `Store::{store,clear}_room_pending_key_bundle`,
1218
`CryptoStore::get_pending_key_bundle_details_for_room` and
1319
`CryptoStore::get_all_rooms_pending_key_bundle`, which can be used by
@@ -34,18 +40,28 @@ All notable changes to this project will be documented in this file.
3440

3541
### Refactor
3642

43+
- [**breaking**] `CryptoStore::get_secrets_from_inbox` now returns a `Vec` of
44+
the secrets as strings, rather than a `Vec` of `GossippedSecret` structs.
45+
([#6164](https://github.com/matrix-org/matrix-rust-sdk/pull/6164))
46+
47+
- [**breaking**] `store::types::Changes::sessions` now stores a `Vec` of
48+
`SecretsInboxItem`.
49+
([#6164](https://github.com/matrix-org/matrix-rust-sdk/pull/6164))
50+
3751
- **breaking** The `BackupDecryptionKey::new` and `DehydratedDeviceKey::new`
3852
methods became infallible, they don't return a `Result` anymore.
3953
([#5502](https://github.com/matrix-org/matrix-rust-sdk/pull/5502))
4054
- [**breaking**] Remove cross-process lock generation logic from `OlmMachine`, which is now
4155
implemented more generally in `matrix_sdk_common::cross_process_lock::CrossProcessLock`.
4256
([#6326](https://github.com/matrix-org/matrix-rust-sdk/pull/6326))
57+
4358
- [**breaking**] The `MediaEncryptionInfo` fields changed to match the new fields of `EncryptedFile`
4459
from Ruma. The serialized JSON format did not change and still matches the format of
4560
`EncryptedFile` defined in the spec, without the `url` field. The `DecryptorError::KeyNonceLength`
4661
variant was removed because the length of the key and nonce are now enforced in
4762
`MediaEncryptionInfo`.
4863
([#6346](https://github.com/matrix-org/matrix-rust-sdk/pull/6346))
64+
4965
- [**breaking**] Removed `WithLocking` from `EncryptionSyncService` and replaced it with `CrossProcessLockConfig`.
5066
([#6160](https://github.com/matrix-org/matrix-rust-sdk/pull/6160))
5167
- [**breaking**] The QrcodeData struct has been reworked in preparation to

crates/matrix-sdk-crypto/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ test-send-sync = []
4040
# Testing helpers for implementations based upon this
4141
testing = ["matrix-sdk-test"]
4242

43+
# Enable experimental support for pushing secrets; see
44+
# https://github.com/matrix-org/matrix-spec-proposals/pull/4385
45+
experimental-push-secrets = []
46+
4347
[dependencies]
4448
aes = { version = "0.8.4", default-features = false }
4549
aquamarine.workspace = true

crates/matrix-sdk-crypto/src/error.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,3 +444,15 @@ pub enum SessionRecipientCollectionError {
444444
#[error("Encryption failed because your device is not verified")]
445445
SendingFromUnverifiedDevice,
446446
}
447+
448+
/// Error representing a problem when pushing a secret
449+
#[derive(Error, Debug)]
450+
#[cfg(feature = "experimental-push-secrets")]
451+
pub enum SecretPushError {
452+
#[error("The requested secret is not available")]
453+
MissingSecret,
454+
455+
/// The storage layer returned an error.
456+
#[error(transparent)]
457+
StoreError(#[from] CryptoStoreError),
458+
}

0 commit comments

Comments
 (0)