Skip to content

Commit dc3bd69

Browse files
committed
crypto: rename MaybeEncryptedRoomKey::Withheld to MissingSession
This is only used to indicate missing sessions, and the `code` is no longer used, so let's rename the variant and remove the redundant field.
1 parent da14cef commit dc3bd69

File tree

2 files changed

+6
-8
lines changed
  • crates/matrix-sdk-crypto/src

2 files changed

+6
-8
lines changed

crates/matrix-sdk-crypto/src/identities/device.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::{
2121
},
2222
};
2323

24-
use matrix_sdk_common::{deserialized_responses::WithheldCode, locks::RwLock};
24+
use matrix_sdk_common::locks::RwLock;
2525
use ruma::{
2626
api::client::keys::upload_signatures::v3::Request as SignatureUploadRequest,
2727
events::{key::verification::VerificationMethod, AnyToDeviceEventContent},
@@ -64,9 +64,9 @@ pub enum MaybeEncryptedRoomKey {
6464
share_info: ShareInfo,
6565
message: Raw<AnyToDeviceEventContent>,
6666
},
67-
Withheld {
68-
code: WithheldCode,
69-
},
67+
/// We could not encrypt a message to this device because there is no active
68+
/// Olm session.
69+
MissingSession,
7070
}
7171

7272
/// A read-only version of a `Device`.
@@ -841,9 +841,7 @@ impl DeviceData {
841841
message: encrypted.cast(),
842842
}),
843843

844-
Err(OlmError::MissingSession) => {
845-
Ok(MaybeEncryptedRoomKey::Withheld { code: WithheldCode::NoOlm })
846-
}
844+
Err(OlmError::MissingSession) => Ok(MaybeEncryptedRoomKey::MissingSession),
847845
Err(e) => Err(e),
848846
}
849847
}

crates/matrix-sdk-crypto/src/session_manager/group_sessions/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl GroupSessionManager {
304304
.or_insert_with(BTreeMap::new)
305305
.insert(device_id, share_info);
306306
}
307-
MaybeEncryptedRoomKey::Withheld { .. } => {
307+
MaybeEncryptedRoomKey::MissingSession => {
308308
result_builder.on_missing_session(result.device);
309309
}
310310
}

0 commit comments

Comments
 (0)