bump ruma to 24154195a00390a33542603b968e94022487587c
parent
8dbbacfbe6
commit
b8017b1fb0
|
@ -21,7 +21,7 @@ async-trait = "0.1.42"
|
||||||
[dependencies.ruma]
|
[dependencies.ruma]
|
||||||
version = "0.0.3"
|
version = "0.0.3"
|
||||||
git = "https://github.com/ruma/ruma"
|
git = "https://github.com/ruma/ruma"
|
||||||
rev = "1e005f576e4640ee5ce6e357bcf33293819502d1"
|
rev = "24154195a00390a33542603b968e94022487587c"
|
||||||
features = ["client-api-c", "compat", "unstable-pre-spec"]
|
features = ["client-api-c", "compat", "unstable-pre-spec"]
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
|
|
@ -32,7 +32,8 @@ use matrix_sdk_common::{
|
||||||
assign,
|
assign,
|
||||||
deserialized_responses::{AlgorithmInfo, EncryptionInfo, SyncRoomEvent, VerificationState},
|
deserialized_responses::{AlgorithmInfo, EncryptionInfo, SyncRoomEvent, VerificationState},
|
||||||
events::{
|
events::{
|
||||||
room::encrypted::EncryptedEventContent, room_key::RoomKeyEventContent,
|
room::encrypted::{EncryptedEventContent, EncryptedEventScheme},
|
||||||
|
room_key::RoomKeyEventContent,
|
||||||
AnyMessageEventContent, AnyToDeviceEvent, SyncMessageEvent, ToDeviceEvent,
|
AnyMessageEventContent, AnyToDeviceEvent, SyncMessageEvent, ToDeviceEvent,
|
||||||
},
|
},
|
||||||
identifiers::{
|
identifiers::{
|
||||||
|
@ -939,8 +940,8 @@ impl OlmMachine {
|
||||||
event: &SyncMessageEvent<EncryptedEventContent>,
|
event: &SyncMessageEvent<EncryptedEventContent>,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
) -> MegolmResult<(Option<OutgoingRequest>, OutgoingRequest)> {
|
) -> MegolmResult<(Option<OutgoingRequest>, OutgoingRequest)> {
|
||||||
let content = match &event.content {
|
let content = match &event.content.scheme {
|
||||||
EncryptedEventContent::MegolmV1AesSha2(c) => c,
|
EncryptedEventScheme::MegolmV1AesSha2(c) => c,
|
||||||
_ => return Err(EventError::UnsupportedAlgorithm.into()),
|
_ => return Err(EventError::UnsupportedAlgorithm.into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1000,8 +1001,8 @@ impl OlmMachine {
|
||||||
event: &SyncMessageEvent<EncryptedEventContent>,
|
event: &SyncMessageEvent<EncryptedEventContent>,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
) -> MegolmResult<SyncRoomEvent> {
|
) -> MegolmResult<SyncRoomEvent> {
|
||||||
let content = match &event.content {
|
let content = match &event.content.scheme {
|
||||||
EncryptedEventContent::MegolmV1AesSha2(c) => c,
|
EncryptedEventScheme::MegolmV1AesSha2(c) => c,
|
||||||
_ => return Err(EventError::UnsupportedAlgorithm.into()),
|
_ => return Err(EventError::UnsupportedAlgorithm.into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,10 @@ use matrix_sdk_common::{
|
||||||
upload_keys, upload_signatures::Request as SignatureUploadRequest, OneTimeKey, SignedKey,
|
upload_keys, upload_signatures::Request as SignatureUploadRequest, OneTimeKey, SignedKey,
|
||||||
},
|
},
|
||||||
encryption::DeviceKeys,
|
encryption::DeviceKeys,
|
||||||
events::{room::encrypted::EncryptedEventContent, AnyToDeviceEvent},
|
events::{
|
||||||
|
room::encrypted::{EncryptedEventContent, EncryptedEventScheme},
|
||||||
|
AnyToDeviceEvent,
|
||||||
|
},
|
||||||
identifiers::{
|
identifiers::{
|
||||||
DeviceId, DeviceIdBox, DeviceKeyAlgorithm, DeviceKeyId, EventEncryptionAlgorithm, RoomId,
|
DeviceId, DeviceIdBox, DeviceKeyAlgorithm, DeviceKeyId, EventEncryptionAlgorithm, RoomId,
|
||||||
UserId,
|
UserId,
|
||||||
|
@ -124,7 +127,8 @@ impl Account {
|
||||||
) -> OlmResult<OlmDecryptionInfo> {
|
) -> OlmResult<OlmDecryptionInfo> {
|
||||||
debug!("Decrypting to-device event");
|
debug!("Decrypting to-device event");
|
||||||
|
|
||||||
let content = if let EncryptedEventContent::OlmV1Curve25519AesSha2(c) = &event.content {
|
let content = if let EncryptedEventScheme::OlmV1Curve25519AesSha2(c) = &event.content.scheme
|
||||||
|
{
|
||||||
c
|
c
|
||||||
} else {
|
} else {
|
||||||
warn!("Error, unsupported encryption algorithm");
|
warn!("Error, unsupported encryption algorithm");
|
||||||
|
@ -1046,7 +1050,7 @@ impl ReadOnlyAccount {
|
||||||
.encrypt(&device, EventType::Dummy, json!({}))
|
.encrypt(&device, EventType::Dummy, json!({}))
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let content = if let EncryptedEventContent::OlmV1Curve25519AesSha2(c) = message {
|
let content = if let EncryptedEventScheme::OlmV1Curve25519AesSha2(c) = message.scheme {
|
||||||
c
|
c
|
||||||
} else {
|
} else {
|
||||||
panic!("Invalid encrypted event algorithm");
|
panic!("Invalid encrypted event algorithm");
|
||||||
|
|
|
@ -35,7 +35,10 @@ pub use olm_rs::{
|
||||||
use matrix_sdk_common::{
|
use matrix_sdk_common::{
|
||||||
events::{
|
events::{
|
||||||
forwarded_room_key::ForwardedRoomKeyToDeviceEventContent,
|
forwarded_room_key::ForwardedRoomKeyToDeviceEventContent,
|
||||||
room::{encrypted::EncryptedEventContent, history_visibility::HistoryVisibility},
|
room::{
|
||||||
|
encrypted::{EncryptedEventContent, EncryptedEventScheme},
|
||||||
|
history_visibility::HistoryVisibility,
|
||||||
|
},
|
||||||
AnySyncRoomEvent, SyncMessageEvent,
|
AnySyncRoomEvent, SyncMessageEvent,
|
||||||
},
|
},
|
||||||
identifiers::{DeviceKeyAlgorithm, EventEncryptionAlgorithm, RoomId},
|
identifiers::{DeviceKeyAlgorithm, EventEncryptionAlgorithm, RoomId},
|
||||||
|
@ -305,8 +308,8 @@ impl InboundGroupSession {
|
||||||
&self,
|
&self,
|
||||||
event: &SyncMessageEvent<EncryptedEventContent>,
|
event: &SyncMessageEvent<EncryptedEventContent>,
|
||||||
) -> MegolmResult<(Raw<AnySyncRoomEvent>, u32)> {
|
) -> MegolmResult<(Raw<AnySyncRoomEvent>, u32)> {
|
||||||
let content = match &event.content {
|
let content = match &event.content.scheme {
|
||||||
EncryptedEventContent::MegolmV1AesSha2(c) => c,
|
EncryptedEventScheme::MegolmV1AesSha2(c) => c,
|
||||||
_ => return Err(EventError::UnsupportedAlgorithm.into()),
|
_ => return Err(EventError::UnsupportedAlgorithm.into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -340,7 +343,7 @@ impl InboundGroupSession {
|
||||||
.flatten()
|
.flatten()
|
||||||
{
|
{
|
||||||
if !decrypted_content.contains_key("m.relates_to") {
|
if !decrypted_content.contains_key("m.relates_to") {
|
||||||
if let Some(relation) = &content.relates_to {
|
if let Some(relation) = &event.content.relates_to {
|
||||||
decrypted_content.insert(
|
decrypted_content.insert(
|
||||||
"m.relates_to".to_owned(),
|
"m.relates_to".to_owned(),
|
||||||
serde_json::to_value(relation).unwrap_or_default(),
|
serde_json::to_value(relation).unwrap_or_default(),
|
||||||
|
|
|
@ -16,8 +16,7 @@ use dashmap::DashMap;
|
||||||
use matrix_sdk_common::{
|
use matrix_sdk_common::{
|
||||||
api::r0::to_device::DeviceIdOrAllDevices,
|
api::r0::to_device::DeviceIdOrAllDevices,
|
||||||
events::room::{
|
events::room::{
|
||||||
encrypted::{MegolmV1AesSha2Content, MegolmV1AesSha2ContentInit},
|
encrypted::MegolmV1AesSha2ContentInit, history_visibility::HistoryVisibility,
|
||||||
history_visibility::HistoryVisibility,
|
|
||||||
message::Relation,
|
message::Relation,
|
||||||
},
|
},
|
||||||
uuid::Uuid,
|
uuid::Uuid,
|
||||||
|
@ -36,7 +35,10 @@ use tracing::{debug, error, trace};
|
||||||
|
|
||||||
use matrix_sdk_common::{
|
use matrix_sdk_common::{
|
||||||
events::{
|
events::{
|
||||||
room::{encrypted::EncryptedEventContent, encryption::EncryptionEventContent},
|
room::{
|
||||||
|
encrypted::{EncryptedEventContent, EncryptedEventScheme},
|
||||||
|
encryption::EncryptionEventContent,
|
||||||
|
},
|
||||||
AnyMessageEventContent, EventContent,
|
AnyMessageEventContent, EventContent,
|
||||||
},
|
},
|
||||||
identifiers::{DeviceId, DeviceIdBox, EventEncryptionAlgorithm, RoomId, UserId},
|
identifiers::{DeviceId, DeviceIdBox, EventEncryptionAlgorithm, RoomId, UserId},
|
||||||
|
@ -306,7 +308,7 @@ impl OutboundGroupSession {
|
||||||
|
|
||||||
let ciphertext = self.encrypt_helper(plaintext).await;
|
let ciphertext = self.encrypt_helper(plaintext).await;
|
||||||
|
|
||||||
let mut encrypted_content: MegolmV1AesSha2Content = MegolmV1AesSha2ContentInit {
|
let encrypted_content = MegolmV1AesSha2ContentInit {
|
||||||
ciphertext,
|
ciphertext,
|
||||||
sender_key: self.account_identity_keys.curve25519().to_owned(),
|
sender_key: self.account_identity_keys.curve25519().to_owned(),
|
||||||
session_id: self.session_id().to_owned(),
|
session_id: self.session_id().to_owned(),
|
||||||
|
@ -314,9 +316,10 @@ impl OutboundGroupSession {
|
||||||
}
|
}
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
encrypted_content.relates_to = relates_to;
|
EncryptedEventContent::new(
|
||||||
|
EncryptedEventScheme::MegolmV1AesSha2(encrypted_content),
|
||||||
EncryptedEventContent::MegolmV1AesSha2(encrypted_content)
|
relates_to,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the session has expired and if it should be rotated.
|
/// Check if the session has expired and if it should be rotated.
|
||||||
|
|
|
@ -16,7 +16,10 @@ use std::{collections::BTreeMap, fmt, sync::Arc};
|
||||||
|
|
||||||
use matrix_sdk_common::{
|
use matrix_sdk_common::{
|
||||||
events::{
|
events::{
|
||||||
room::encrypted::{CiphertextInfo, EncryptedEventContent, OlmV1Curve25519AesSha2Content},
|
room::encrypted::{
|
||||||
|
CiphertextInfo, EncryptedEventContent, EncryptedEventScheme,
|
||||||
|
OlmV1Curve25519AesSha2Content,
|
||||||
|
},
|
||||||
EventType,
|
EventType,
|
||||||
},
|
},
|
||||||
identifiers::{DeviceId, DeviceKeyAlgorithm, UserId},
|
identifiers::{DeviceId, DeviceKeyAlgorithm, UserId},
|
||||||
|
@ -118,6 +121,11 @@ impl Session {
|
||||||
.get_key(DeviceKeyAlgorithm::Ed25519)
|
.get_key(DeviceKeyAlgorithm::Ed25519)
|
||||||
.ok_or(EventError::MissingSigningKey)?;
|
.ok_or(EventError::MissingSigningKey)?;
|
||||||
|
|
||||||
|
let relates_to = content
|
||||||
|
.get("m.relates_to")
|
||||||
|
.cloned()
|
||||||
|
.and_then(|v| serde_json::from_value(v).ok());
|
||||||
|
|
||||||
let payload = json!({
|
let payload = json!({
|
||||||
"sender": self.user_id.as_str(),
|
"sender": self.user_id.as_str(),
|
||||||
"sender_device": self.device_id.as_ref(),
|
"sender_device": self.device_id.as_ref(),
|
||||||
|
@ -141,11 +149,12 @@ impl Session {
|
||||||
let mut content = BTreeMap::new();
|
let mut content = BTreeMap::new();
|
||||||
content.insert((&*self.sender_key).to_owned(), ciphertext);
|
content.insert((&*self.sender_key).to_owned(), ciphertext);
|
||||||
|
|
||||||
Ok(EncryptedEventContent::OlmV1Curve25519AesSha2(
|
Ok(EncryptedEventContent::new(
|
||||||
OlmV1Curve25519AesSha2Content::new(
|
EncryptedEventScheme::OlmV1Curve25519AesSha2(OlmV1Curve25519AesSha2Content::new(
|
||||||
content,
|
content,
|
||||||
self.our_identity_keys.curve25519().to_string(),
|
self.our_identity_keys.curve25519().to_string(),
|
||||||
),
|
)),
|
||||||
|
relates_to,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue