crypto: Depend on ruma directly

… instead of using matrix_sdk_common's re-exports
master
Jonas Platte 2021-06-07 14:47:59 +02:00
parent 3bac536daf
commit 74d0ac7c77
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
35 changed files with 222 additions and 256 deletions

View File

@ -21,6 +21,7 @@ docs = ["sled_cryptostore"]
[dependencies] [dependencies]
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" } matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
ruma = { version = "0.1.2", features = ["client-api-c", "unstable-pre-spec"] }
olm-rs = { version = "1.0.0", features = ["serde"] } olm-rs = { version = "1.0.0", features = ["serde"] }
getrandom = "0.2.2" getrandom = "0.2.2"

View File

@ -4,17 +4,19 @@ mod perf;
use std::sync::Arc; use std::sync::Arc;
use criterion::*; use criterion::*;
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
api::r0::{
keys::{claim_keys, get_keys},
to_device::send_event_to_device::Response as ToDeviceResponse,
},
identifiers::{room_id, user_id, DeviceIdBox, UserId},
uuid::Uuid,
IncomingResponse,
};
use matrix_sdk_crypto::{EncryptionSettings, OlmMachine}; use matrix_sdk_crypto::{EncryptionSettings, OlmMachine};
use matrix_sdk_test::response_from_file; use matrix_sdk_test::response_from_file;
use ruma::{
api::{
client::r0::{
keys::{claim_keys, get_keys},
to_device::send_event_to_device::Response as ToDeviceResponse,
},
IncomingResponse,
},
room_id, user_id, DeviceIdBox, UserId,
};
use serde_json::Value; use serde_json::Value;
use tokio::runtime::Builder; use tokio::runtime::Builder;

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use matrix_sdk_common::identifiers::{DeviceId, Error as IdentifierError, UserId};
use olm_rs::errors::{OlmGroupSessionError, OlmSessionError}; use olm_rs::errors::{OlmGroupSessionError, OlmSessionError};
use ruma::{identifiers::Error as IdentifierError, DeviceId, UserId};
use serde_json::Error as SerdeError; use serde_json::Error as SerdeError;
use thiserror::Error; use thiserror::Error;

View File

@ -23,7 +23,7 @@ use aes_ctr::{
}; };
use base64::DecodeError; use base64::DecodeError;
use getrandom::getrandom; use getrandom::getrandom;
use matrix_sdk_common::events::room::{EncryptedFile, JsonWebKey, JsonWebKeyInit}; use ruma::events::room::{EncryptedFile, JsonWebKey, JsonWebKeyInit};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
use thiserror::Error; use thiserror::Error;

View File

@ -76,7 +76,7 @@ pub enum KeyExportError {
/// ```no_run /// ```no_run
/// # use std::io::Cursor; /// # use std::io::Cursor;
/// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export}; /// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export};
/// # use matrix_sdk_common::identifiers::user_id; /// # use ruma::user_id;
/// # use futures::executor::block_on; /// # use futures::executor::block_on;
/// # let alice = user_id!("@alice:example.org"); /// # let alice = user_id!("@alice:example.org");
/// # let machine = OlmMachine::new(&alice, "DEVICEID".into()); /// # let machine = OlmMachine::new(&alice, "DEVICEID".into());
@ -127,7 +127,7 @@ pub fn decrypt_key_export(
/// # Examples /// # Examples
/// ```no_run /// ```no_run
/// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export}; /// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export};
/// # use matrix_sdk_common::identifiers::{user_id, room_id}; /// # use ruma::{user_id, room_id};
/// # use futures::executor::block_on; /// # use futures::executor::block_on;
/// # let alice = user_id!("@alice:example.org"); /// # let alice = user_id!("@alice:example.org");
/// # let machine = OlmMachine::new(&alice, "DEVICEID".into()); /// # let machine = OlmMachine::new(&alice, "DEVICEID".into());
@ -229,9 +229,9 @@ mod test {
use std::io::Cursor; use std::io::Cursor;
use indoc::indoc; use indoc::indoc;
use matrix_sdk_common::identifiers::room_id;
use matrix_sdk_test::async_test; use matrix_sdk_test::async_test;
use proptest::prelude::*; use proptest::prelude::*;
use ruma::room_id;
use super::{decode, decrypt_helper, decrypt_key_export, encrypt_helper, encrypt_key_export}; use super::{decode, decrypt_helper, decrypt_key_export, encrypt_helper, encrypt_key_export};
use crate::machine::test::get_prepared_machine; use crate::machine::test::get_prepared_machine;

View File

@ -23,8 +23,9 @@ use std::{
}; };
use atomic::Atomic; use atomic::Atomic;
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
api::r0::keys::SignedKey, use ruma::{
api::client::r0::keys::SignedKey,
encryption::DeviceKeys, encryption::DeviceKeys,
events::{ events::{
forwarded_room_key::ForwardedRoomKeyToDeviceEventContent, forwarded_room_key::ForwardedRoomKeyToDeviceEventContent,
@ -33,7 +34,6 @@ use matrix_sdk_common::{
identifiers::{ identifiers::{
DeviceId, DeviceIdBox, DeviceKeyAlgorithm, DeviceKeyId, EventEncryptionAlgorithm, UserId, DeviceId, DeviceIdBox, DeviceKeyAlgorithm, DeviceKeyId, EventEncryptionAlgorithm, UserId,
}, },
locks::Mutex,
}; };
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json::{json, Value}; use serde_json::{json, Value};
@ -570,10 +570,7 @@ impl PartialEq for ReadOnlyDevice {
pub(crate) mod test { pub(crate) mod test {
use std::convert::TryFrom; use std::convert::TryFrom;
use matrix_sdk_common::{ use ruma::{encryption::DeviceKeys, user_id, DeviceKeyAlgorithm};
encryption::DeviceKeys,
identifiers::{user_id, DeviceKeyAlgorithm},
};
use serde_json::json; use serde_json::json;
use crate::identities::{LocalTrust, ReadOnlyDevice}; use crate::identities::{LocalTrust, ReadOnlyDevice};

View File

@ -19,10 +19,10 @@ use std::{
}; };
use futures::future::join_all; use futures::future::join_all;
use matrix_sdk_common::{ use matrix_sdk_common::executor::spawn;
api::r0::keys::get_keys::Response as KeysQueryResponse, use ruma::{
api::client::r0::keys::get_keys::Response as KeysQueryResponse,
encryption::DeviceKeys, encryption::DeviceKeys,
executor::spawn,
identifiers::{DeviceId, DeviceIdBox, UserId}, identifiers::{DeviceId, DeviceIdBox, UserId},
}; };
use tracing::{trace, warn}; use tracing::{trace, warn};
@ -390,13 +390,12 @@ impl IdentityManager {
pub(crate) mod test { pub(crate) mod test {
use std::sync::Arc; use std::sync::Arc;
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
api::r0::keys::get_keys::Response as KeyQueryResponse,
identifiers::{user_id, DeviceIdBox, UserId},
locks::Mutex,
IncomingResponse,
};
use matrix_sdk_test::async_test; use matrix_sdk_test::async_test;
use ruma::{
api::{client::r0::keys::get_keys::Response as KeyQueryResponse, IncomingResponse},
user_id, DeviceIdBox, UserId,
};
use serde_json::json; use serde_json::json;
use crate::{ use crate::{

View File

@ -21,9 +21,9 @@ use std::{
}, },
}; };
use matrix_sdk_common::{ use ruma::{
api::r0::keys::{CrossSigningKey, KeyUsage}, api::client::r0::keys::{CrossSigningKey, KeyUsage},
identifiers::{DeviceKeyId, UserId}, DeviceKeyId, UserId,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::to_value; use serde_json::to_value;
@ -680,10 +680,9 @@ impl OwnUserIdentity {
pub(crate) mod test { pub(crate) mod test {
use std::{convert::TryFrom, sync::Arc}; use std::{convert::TryFrom, sync::Arc};
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
api::r0::keys::get_keys::Response as KeyQueryResponse, identifiers::user_id, locks::Mutex,
};
use matrix_sdk_test::async_test; use matrix_sdk_test::async_test;
use ruma::{api::client::r0::keys::get_keys::Response as KeyQueryResponse, user_id};
use super::{OwnUserIdentity, UserIdentities, UserIdentity}; use super::{OwnUserIdentity, UserIdentities, UserIdentity};
use crate::{ use crate::{

View File

@ -23,15 +23,15 @@
use std::{collections::BTreeMap, sync::Arc}; use std::{collections::BTreeMap, sync::Arc};
use dashmap::{mapref::entry::Entry, DashMap, DashSet}; use dashmap::{mapref::entry::Entry, DashMap, DashSet};
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
api::r0::to_device::DeviceIdOrAllDevices, use ruma::{
api::client::r0::to_device::DeviceIdOrAllDevices,
events::{ events::{
forwarded_room_key::ForwardedRoomKeyToDeviceEventContent, forwarded_room_key::ForwardedRoomKeyToDeviceEventContent,
room_key_request::{Action, RequestedKeyInfo, RoomKeyRequestToDeviceEventContent}, room_key_request::{Action, RequestedKeyInfo, RoomKeyRequestToDeviceEventContent},
AnyToDeviceEvent, EventType, ToDeviceEvent, AnyToDeviceEvent, EventType, ToDeviceEvent,
}, },
identifiers::{DeviceId, DeviceIdBox, EventEncryptionAlgorithm, RoomId, UserId}, identifiers::{DeviceId, DeviceIdBox, EventEncryptionAlgorithm, RoomId, UserId},
uuid::Uuid,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::value::to_raw_value; use serde_json::value::to_raw_value;
@ -786,17 +786,17 @@ mod test {
use std::{convert::TryInto, sync::Arc}; use std::{convert::TryInto, sync::Arc};
use dashmap::DashMap; use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
api::r0::to_device::DeviceIdOrAllDevices, use matrix_sdk_test::async_test;
use ruma::{
api::client::r0::to_device::DeviceIdOrAllDevices,
events::{ events::{
forwarded_room_key::ForwardedRoomKeyToDeviceEventContent, forwarded_room_key::ForwardedRoomKeyToDeviceEventContent,
room::encrypted::EncryptedEventContent, room::encrypted::EncryptedEventContent,
room_key_request::RoomKeyRequestToDeviceEventContent, AnyToDeviceEvent, ToDeviceEvent, room_key_request::RoomKeyRequestToDeviceEventContent, AnyToDeviceEvent, ToDeviceEvent,
}, },
identifiers::{room_id, user_id, DeviceIdBox, RoomId, UserId}, room_id, user_id, DeviceIdBox, RoomId, UserId,
locks::Mutex,
}; };
use matrix_sdk_test::async_test;
use super::{KeyRequestMachine, KeyshareDecision}; use super::{KeyRequestMachine, KeyshareDecision};
use crate::{ use crate::{

View File

@ -18,7 +18,12 @@ use std::{collections::BTreeMap, mem, sync::Arc};
use dashmap::DashMap; use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::{ deserialized_responses::{AlgorithmInfo, EncryptionInfo, SyncRoomEvent, VerificationState},
locks::Mutex,
uuid::Uuid,
};
use ruma::{
api::client::r0::{
keys::{ keys::{
claim_keys::{Request as KeysClaimRequest, Response as KeysClaimResponse}, claim_keys::{Request as KeysClaimRequest, Response as KeysClaimResponse},
get_keys::Response as KeysQueryResponse, get_keys::Response as KeysQueryResponse,
@ -28,18 +33,12 @@ use matrix_sdk_common::{
sync::sync_events::{DeviceLists, ToDevice}, sync::sync_events::{DeviceLists, ToDevice},
}, },
assign, assign,
deserialized_responses::{AlgorithmInfo, EncryptionInfo, SyncRoomEvent, VerificationState},
events::{ events::{
room::encrypted::{EncryptedEventContent, EncryptedEventScheme}, room::encrypted::{EncryptedEventContent, EncryptedEventScheme},
room_key::RoomKeyToDeviceEventContent, room_key::RoomKeyToDeviceEventContent,
AnyMessageEventContent, AnyRoomEvent, AnyToDeviceEvent, SyncMessageEvent, ToDeviceEvent, AnyMessageEventContent, AnyRoomEvent, AnyToDeviceEvent, SyncMessageEvent, ToDeviceEvent,
}, },
identifiers::{ DeviceId, DeviceIdBox, DeviceKeyAlgorithm, EventEncryptionAlgorithm, RoomId, UInt, UserId,
DeviceId, DeviceIdBox, DeviceKeyAlgorithm, EventEncryptionAlgorithm, RoomId, UserId,
},
locks::Mutex,
uuid::Uuid,
UInt,
}; };
use tracing::{debug, error, info, trace, warn}; use tracing::{debug, error, info, trace, warn};
@ -412,7 +411,7 @@ impl OlmMachine {
/// ``` /// ```
/// # use std::convert::TryFrom; /// # use std::convert::TryFrom;
/// # use matrix_sdk_crypto::OlmMachine; /// # use matrix_sdk_crypto::OlmMachine;
/// # use matrix_sdk_common::identifiers::UserId; /// # use ruma::UserId;
/// # use futures::executor::block_on; /// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap(); /// # let alice = UserId::try_from("@alice:example.org").unwrap();
/// # let machine = OlmMachine::new(&alice, "DEVICEID".into()); /// # let machine = OlmMachine::new(&alice, "DEVICEID".into());
@ -1031,7 +1030,7 @@ impl OlmMachine {
/// ``` /// ```
/// # use std::convert::TryFrom; /// # use std::convert::TryFrom;
/// # use matrix_sdk_crypto::OlmMachine; /// # use matrix_sdk_crypto::OlmMachine;
/// # use matrix_sdk_common::identifiers::UserId; /// # use ruma::UserId;
/// # use futures::executor::block_on; /// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap(); /// # let alice = UserId::try_from("@alice:example.org").unwrap();
/// # let machine = OlmMachine::new(&alice, "DEVICEID".into()); /// # let machine = OlmMachine::new(&alice, "DEVICEID".into());
@ -1060,7 +1059,7 @@ impl OlmMachine {
/// ``` /// ```
/// # use std::convert::TryFrom; /// # use std::convert::TryFrom;
/// # use matrix_sdk_crypto::OlmMachine; /// # use matrix_sdk_crypto::OlmMachine;
/// # use matrix_sdk_common::identifiers::UserId; /// # use ruma::UserId;
/// # use futures::executor::block_on; /// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap(); /// # let alice = UserId::try_from("@alice:example.org").unwrap();
/// # let machine = OlmMachine::new(&alice, "DEVICEID".into()); /// # let machine = OlmMachine::new(&alice, "DEVICEID".into());
@ -1092,7 +1091,7 @@ impl OlmMachine {
/// ```no_run /// ```no_run
/// # use std::io::Cursor; /// # use std::io::Cursor;
/// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export}; /// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export};
/// # use matrix_sdk_common::identifiers::user_id; /// # use ruma::user_id;
/// # use futures::executor::block_on; /// # use futures::executor::block_on;
/// # let alice = user_id!("@alice:example.org"); /// # let alice = user_id!("@alice:example.org");
/// # let machine = OlmMachine::new(&alice, "DEVICEID".into()); /// # let machine = OlmMachine::new(&alice, "DEVICEID".into());
@ -1179,7 +1178,7 @@ impl OlmMachine {
/// ///
/// ```no_run /// ```no_run
/// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export}; /// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export};
/// # use matrix_sdk_common::identifiers::{user_id, room_id}; /// # use ruma::{user_id, room_id};
/// # use futures::executor::block_on; /// # use futures::executor::block_on;
/// # let alice = user_id!("@alice:example.org"); /// # let alice = user_id!("@alice:example.org");
/// # let machine = OlmMachine::new(&alice, "DEVICEID".into()); /// # let machine = OlmMachine::new(&alice, "DEVICEID".into());
@ -1223,8 +1222,12 @@ pub(crate) mod test {
}; };
use http::Response; use http::Response;
use matrix_sdk_common::{ use matrix_sdk_test::test_json;
api::r0::keys::{claim_keys, get_keys, upload_keys, OneTimeKey}, use ruma::{
api::{
client::r0::keys::{claim_keys, get_keys, upload_keys, OneTimeKey},
IncomingResponse,
},
events::{ events::{
room::{ room::{
encrypted::EncryptedEventContent, encrypted::EncryptedEventContent,
@ -1236,9 +1239,9 @@ pub(crate) mod test {
identifiers::{ identifiers::{
event_id, room_id, user_id, DeviceId, DeviceKeyAlgorithm, DeviceKeyId, UserId, event_id, room_id, user_id, DeviceId, DeviceKeyAlgorithm, DeviceKeyId, UserId,
}, },
IncomingResponse, MilliSecondsSinceUnixEpoch, Raw, serde::Raw,
uint, MilliSecondsSinceUnixEpoch,
}; };
use matrix_sdk_test::test_json;
use serde_json::json; use serde_json::json;
use crate::{ use crate::{
@ -1251,8 +1254,6 @@ pub(crate) mod test {
/// These keys need to be periodically uploaded to the server. /// These keys need to be periodically uploaded to the server.
type OneTimeKeys = BTreeMap<DeviceKeyId, OneTimeKey>; type OneTimeKeys = BTreeMap<DeviceKeyId, OneTimeKey>;
use matrix_sdk_common::uint;
fn alice_id() -> UserId { fn alice_id() -> UserId {
user_id!("@alice:example.org") user_id!("@alice:example.org")
} }

View File

@ -23,10 +23,17 @@ use std::{
}, },
}; };
use matrix_sdk_common::{instant::Instant, locks::Mutex};
use olm_rs::{
account::{IdentityKeys, OlmAccount, OneTimeKeys},
errors::{OlmAccountError, OlmSessionError},
session::{OlmMessage, PreKeyMessage},
PicklingMode,
};
#[cfg(test)] #[cfg(test)]
use matrix_sdk_common::events::EventType; use ruma::events::EventType;
use matrix_sdk_common::{ use ruma::{
api::r0::keys::{ api::client::r0::keys::{
upload_keys, upload_signatures::Request as SignatureUploadRequest, OneTimeKey, SignedKey, upload_keys, upload_signatures::Request as SignatureUploadRequest, OneTimeKey, SignedKey,
}, },
encryption::DeviceKeys, encryption::DeviceKeys,
@ -38,15 +45,8 @@ use matrix_sdk_common::{
DeviceId, DeviceIdBox, DeviceKeyAlgorithm, DeviceKeyId, EventEncryptionAlgorithm, RoomId, DeviceId, DeviceIdBox, DeviceKeyAlgorithm, DeviceKeyId, EventEncryptionAlgorithm, RoomId,
UserId, UserId,
}, },
instant::Instant, serde::{CanonicalJsonValue, Raw},
locks::Mutex, UInt,
CanonicalJsonValue, Raw, UInt,
};
use olm_rs::{
account::{IdentityKeys, OlmAccount, OneTimeKeys},
errors::{OlmAccountError, OlmSessionError},
session::{OlmMessage, PreKeyMessage},
PicklingMode,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::{json, Value}; use serde_json::{json, Value};

View File

@ -14,7 +14,16 @@
use std::{collections::BTreeMap, convert::TryFrom, fmt, mem, sync::Arc}; use std::{collections::BTreeMap, convert::TryFrom, fmt, mem, sync::Arc};
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
pub use olm_rs::{
account::IdentityKeys,
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
};
use olm_rs::{
errors::OlmGroupSessionError, inbound_group_session::OlmInboundGroupSession, PicklingMode,
};
use ruma::{
events::{ events::{
forwarded_room_key::ForwardedRoomKeyToDeviceEventContent, forwarded_room_key::ForwardedRoomKeyToDeviceEventContent,
room::{ room::{
@ -24,16 +33,7 @@ use matrix_sdk_common::{
AnySyncRoomEvent, SyncMessageEvent, AnySyncRoomEvent, SyncMessageEvent,
}, },
identifiers::{DeviceKeyAlgorithm, EventEncryptionAlgorithm, RoomId}, identifiers::{DeviceKeyAlgorithm, EventEncryptionAlgorithm, RoomId},
locks::Mutex, serde::Raw,
Raw,
};
pub use olm_rs::{
account::IdentityKeys,
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
};
use olm_rs::{
errors::OlmGroupSessionError, inbound_group_session::OlmInboundGroupSession, PicklingMode,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value; use serde_json::Value;

View File

@ -14,11 +14,11 @@
use std::{collections::BTreeMap, convert::TryInto}; use std::{collections::BTreeMap, convert::TryInto};
use matrix_sdk_common::{ use ruma::{
events::forwarded_room_key::{ events::forwarded_room_key::{
ForwardedRoomKeyToDeviceEventContent, ForwardedRoomKeyToDeviceEventContentInit, ForwardedRoomKeyToDeviceEventContent, ForwardedRoomKeyToDeviceEventContentInit,
}, },
identifiers::{DeviceKeyAlgorithm, EventEncryptionAlgorithm, RoomId}, DeviceKeyAlgorithm, EventEncryptionAlgorithm, RoomId,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use zeroize::Zeroize; use zeroize::Zeroize;
@ -130,9 +130,9 @@ mod test {
time::{Duration, Instant}, time::{Duration, Instant},
}; };
use matrix_sdk_common::{ use ruma::{
events::{room::message::MessageEventContent, AnyMessageEventContent}, events::{room::message::MessageEventContent, AnyMessageEventContent},
identifiers::{room_id, user_id}, room_id, user_id,
}; };
use super::EncryptionSettings; use super::EncryptionSettings;

View File

@ -24,8 +24,17 @@ use std::{
}; };
use dashmap::DashMap; use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::{instant::Instant, locks::Mutex, uuid::Uuid};
api::r0::to_device::DeviceIdOrAllDevices, pub use olm_rs::{
account::IdentityKeys,
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
};
use olm_rs::{
errors::OlmGroupSessionError, outbound_group_session::OlmOutboundGroupSession, PicklingMode,
};
use ruma::{
api::client::r0::to_device::DeviceIdOrAllDevices,
events::{ events::{
room::{ room::{
encrypted::{EncryptedEventContent, EncryptedEventScheme, MegolmV1AesSha2ContentInit}, encrypted::{EncryptedEventContent, EncryptedEventScheme, MegolmV1AesSha2ContentInit},
@ -35,18 +44,7 @@ use matrix_sdk_common::{
}, },
AnyMessageEventContent, EventContent, AnyMessageEventContent, EventContent,
}, },
identifiers::{DeviceId, DeviceIdBox, EventEncryptionAlgorithm, RoomId, UserId}, DeviceId, DeviceIdBox, EventEncryptionAlgorithm, RoomId, UserId,
instant::Instant,
locks::Mutex,
uuid::Uuid,
};
pub use olm_rs::{
account::IdentityKeys,
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
};
use olm_rs::{
errors::OlmGroupSessionError, outbound_group_session::OlmOutboundGroupSession, PicklingMode,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::{json, Value}; use serde_json::{json, Value};
@ -572,10 +570,9 @@ pub struct PickledOutboundGroupSession {
mod test { mod test {
use std::time::Duration; use std::time::Duration;
use matrix_sdk_common::{ use ruma::{
events::room::{encryption::EncryptionEventContent, history_visibility::HistoryVisibility}, events::room::{encryption::EncryptionEventContent, history_visibility::HistoryVisibility},
identifiers::EventEncryptionAlgorithm, uint, EventEncryptionAlgorithm,
uint,
}; };
use super::{EncryptionSettings, ROTATION_MESSAGES, ROTATION_PERIOD}; use super::{EncryptionSettings, ROTATION_MESSAGES, ROTATION_PERIOD};

View File

@ -61,12 +61,12 @@ where
pub(crate) mod test { pub(crate) mod test {
use std::{collections::BTreeMap, convert::TryInto}; use std::{collections::BTreeMap, convert::TryInto};
use matrix_sdk_common::{
api::r0::keys::SignedKey,
events::forwarded_room_key::ForwardedRoomKeyToDeviceEventContent,
identifiers::{room_id, user_id, DeviceId, UserId},
};
use olm_rs::session::OlmMessage; use olm_rs::session::OlmMessage;
use ruma::{
api::client::r0::keys::SignedKey,
events::forwarded_room_key::ForwardedRoomKeyToDeviceEventContent, room_id, user_id,
DeviceId, UserId,
};
use crate::olm::{InboundGroupSession, ReadOnlyAccount, Session}; use crate::olm::{InboundGroupSession, ReadOnlyAccount, Session};

View File

@ -14,7 +14,13 @@
use std::{collections::BTreeMap, fmt, sync::Arc}; use std::{collections::BTreeMap, fmt, sync::Arc};
use matrix_sdk_common::{ use matrix_sdk_common::{instant::Instant, locks::Mutex};
use olm_rs::{errors::OlmSessionError, session::OlmSession, PicklingMode};
pub use olm_rs::{
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
};
use ruma::{
events::{ events::{
room::encrypted::{ room::encrypted::{
CiphertextInfo, EncryptedEventContent, EncryptedEventScheme, CiphertextInfo, EncryptedEventContent, EncryptedEventScheme,
@ -23,13 +29,6 @@ use matrix_sdk_common::{
EventType, EventType,
}, },
identifiers::{DeviceId, DeviceKeyAlgorithm, UserId}, identifiers::{DeviceId, DeviceKeyAlgorithm, UserId},
instant::Instant,
locks::Mutex,
};
use olm_rs::{errors::OlmSessionError, session::OlmSession, PicklingMode};
pub use olm_rs::{
session::{OlmMessage, PreKeyMessage},
utility::OlmUtility,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::{json, Value}; use serde_json::{json, Value};

View File

@ -22,13 +22,13 @@ use std::{
}, },
}; };
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
api::r0::keys::{upload_signatures::Request as SignatureUploadRequest, KeyUsage},
encryption::DeviceKeys,
identifiers::{DeviceKeyAlgorithm, DeviceKeyId, UserId},
locks::Mutex,
};
use pk_signing::{MasterSigning, PickledSignings, SelfSigning, Signing, SigningError, UserSigning}; use pk_signing::{MasterSigning, PickledSignings, SelfSigning, Signing, SigningError, UserSigning};
use ruma::{
api::client::r0::keys::{upload_signatures::Request as SignatureUploadRequest, KeyUsage},
encryption::DeviceKeys,
DeviceKeyAlgorithm, DeviceKeyId, UserId,
};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Error as JsonError; use serde_json::Error as JsonError;
@ -387,11 +387,8 @@ impl PrivateCrossSigningIdentity {
mod test { mod test {
use std::{collections::BTreeMap, sync::Arc}; use std::{collections::BTreeMap, sync::Arc};
use matrix_sdk_common::{
api::r0::keys::CrossSigningKey,
identifiers::{user_id, UserId},
};
use matrix_sdk_test::async_test; use matrix_sdk_test::async_test;
use ruma::{api::client::r0::keys::CrossSigningKey, user_id, UserId};
use super::{PrivateCrossSigningIdentity, Signing}; use super::{PrivateCrossSigningIdentity, Signing};
use crate::{ use crate::{

View File

@ -19,16 +19,16 @@ use aes_gcm::{
Aes256Gcm, Aes256Gcm,
}; };
use getrandom::getrandom; use getrandom::getrandom;
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
api::r0::keys::{CrossSigningKey, KeyUsage},
encryption::DeviceKeys,
identifiers::{DeviceKeyAlgorithm, DeviceKeyId, UserId},
locks::Mutex,
CanonicalJsonValue,
};
use olm_rs::pk::OlmPkSigning; use olm_rs::pk::OlmPkSigning;
#[cfg(test)] #[cfg(test)]
use olm_rs::{errors::OlmUtilityError, utility::OlmUtility}; use olm_rs::{errors::OlmUtilityError, utility::OlmUtility};
use ruma::{
api::client::r0::keys::{CrossSigningKey, KeyUsage},
encryption::DeviceKeys,
serde::CanonicalJsonValue,
DeviceKeyAlgorithm, DeviceKeyId, UserId,
};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::{json, Error as JsonError, Value}; use serde_json::{json, Error as JsonError, Value};
use thiserror::Error; use thiserror::Error;

View File

@ -14,11 +14,8 @@
use std::convert::TryInto; use std::convert::TryInto;
use matrix_sdk_common::{
identifiers::{DeviceKeyAlgorithm, DeviceKeyId, UserId},
CanonicalJsonValue,
};
use olm_rs::utility::OlmUtility; use olm_rs::utility::OlmUtility;
use ruma::{serde::CanonicalJsonValue, DeviceKeyAlgorithm, DeviceKeyId, UserId};
use serde_json::Value; use serde_json::Value;
use crate::error::SignatureError; use crate::error::SignatureError;
@ -97,7 +94,7 @@ impl Utility {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use matrix_sdk_common::identifiers::{user_id, DeviceKeyAlgorithm, DeviceKeyId}; use ruma::{user_id, DeviceKeyAlgorithm, DeviceKeyId};
use serde_json::json; use serde_json::json;
use super::Utility; use super::Utility;

View File

@ -16,8 +16,9 @@
use std::{collections::BTreeMap, sync::Arc, time::Duration}; use std::{collections::BTreeMap, sync::Arc, time::Duration};
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
api::r0::{ use ruma::{
api::client::r0::{
keys::{ keys::{
claim_keys::Response as KeysClaimResponse, claim_keys::Response as KeysClaimResponse,
get_keys::Response as KeysQueryResponse, get_keys::Response as KeysQueryResponse,
@ -32,15 +33,14 @@ use matrix_sdk_common::{
to_device::{send_event_to_device::Response as ToDeviceResponse, DeviceIdOrAllDevices}, to_device::{send_event_to_device::Response as ToDeviceResponse, DeviceIdOrAllDevices},
}, },
events::{AnyMessageEventContent, EventType}, events::{AnyMessageEventContent, EventType},
identifiers::{DeviceIdBox, RoomId, UserId}, DeviceIdBox, RoomId, UserId,
uuid::Uuid,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::value::RawValue as RawJsonValue; use serde_json::value::RawValue as RawJsonValue;
/// Customized version of /// Customized version of
/// `ruma_client_api::r0::to_device::send_event_to_device::Request`, using a /// `ruma_client_api::r0::to_device::send_event_to_device::Request`,
/// UUID for the transaction ID. /// using a UUID for the transaction ID.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ToDeviceRequest { pub struct ToDeviceRequest {
/// Type of event being sent to each device. /// Type of event being sent to each device.
@ -91,8 +91,9 @@ pub struct UploadSigningKeysRequest {
pub user_signing_key: Option<CrossSigningKey>, pub user_signing_key: Option<CrossSigningKey>,
} }
/// Customized version of `ruma_client_api::r0::keys::get_keys::Request`, /// Customized version of
/// without any references. /// `ruma_client_api::r0::keys::get_keys::Request`, without any
/// references.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct KeysQueryRequest { pub struct KeysQueryRequest {
/// The time (in milliseconds) to wait when downloading keys from remote /// The time (in milliseconds) to wait when downloading keys from remote

View File

@ -19,15 +19,14 @@ use std::{
use dashmap::DashMap; use dashmap::DashMap;
use futures::future::join_all; use futures::future::join_all;
use matrix_sdk_common::{ use matrix_sdk_common::{executor::spawn, uuid::Uuid};
api::r0::to_device::DeviceIdOrAllDevices, use ruma::{
api::client::r0::to_device::DeviceIdOrAllDevices,
events::{ events::{
room::{encrypted::EncryptedEventContent, history_visibility::HistoryVisibility}, room::{encrypted::EncryptedEventContent, history_visibility::HistoryVisibility},
AnyMessageEventContent, EventType, AnyMessageEventContent, EventType,
}, },
executor::spawn, DeviceId, DeviceIdBox, RoomId, UserId,
identifiers::{DeviceId, DeviceIdBox, RoomId, UserId},
uuid::Uuid,
}; };
use serde_json::Value; use serde_json::Value;
use tracing::{debug, info, trace}; use tracing::{debug, info, trace};
@ -544,13 +543,15 @@ impl GroupSessionManager {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
api::r0::keys::{claim_keys, get_keys},
identifiers::{room_id, user_id, DeviceIdBox, UserId},
uuid::Uuid,
IncomingResponse,
};
use matrix_sdk_test::response_from_file; use matrix_sdk_test::response_from_file;
use ruma::{
api::{
client::r0::keys::{claim_keys, get_keys},
IncomingResponse,
},
room_id, user_id, DeviceIdBox, UserId,
};
use serde_json::Value; use serde_json::Value;
use crate::{EncryptionSettings, OlmMachine}; use crate::{EncryptionSettings, OlmMachine};

View File

@ -15,15 +15,15 @@
use std::{collections::BTreeMap, sync::Arc, time::Duration}; use std::{collections::BTreeMap, sync::Arc, time::Duration};
use dashmap::{DashMap, DashSet}; use dashmap::{DashMap, DashSet};
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
api::r0::{ use ruma::{
api::client::r0::{
keys::claim_keys::{Request as KeysClaimRequest, Response as KeysClaimResponse}, keys::claim_keys::{Request as KeysClaimRequest, Response as KeysClaimResponse},
to_device::DeviceIdOrAllDevices, to_device::DeviceIdOrAllDevices,
}, },
assign, assign,
events::EventType, events::EventType,
identifiers::{DeviceId, DeviceIdBox, DeviceKeyAlgorithm, UserId}, DeviceId, DeviceIdBox, DeviceKeyAlgorithm, UserId,
uuid::Uuid,
}; };
use serde_json::{json, value::to_raw_value}; use serde_json::{json, value::to_raw_value};
use tracing::{error, info, warn}; use tracing::{error, info, warn};
@ -297,12 +297,12 @@ mod test {
use std::{collections::BTreeMap, sync::Arc}; use std::{collections::BTreeMap, sync::Arc};
use dashmap::DashMap; use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
api::r0::keys::claim_keys::Response as KeyClaimResponse,
identifiers::{user_id, DeviceIdBox, UserId},
locks::Mutex,
};
use matrix_sdk_test::async_test; use matrix_sdk_test::async_test;
use ruma::{
api::client::r0::keys::claim_keys::Response as KeyClaimResponse, user_id, DeviceIdBox,
UserId,
};
use super::SessionManager; use super::SessionManager;
use crate::{ use crate::{
@ -401,10 +401,8 @@ mod test {
#[async_test] #[async_test]
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
async fn session_unwedging() { async fn session_unwedging() {
use matrix_sdk_common::{ use matrix_sdk_common::instant::{Duration, Instant};
identifiers::DeviceKeyAlgorithm, use ruma::DeviceKeyAlgorithm;
instant::{Duration, Instant},
};
let manager = session_manager().await; let manager = session_manager().await;
let bob = bob_account(); let bob = bob_account();

View File

@ -20,10 +20,8 @@
use std::{collections::HashMap, sync::Arc}; use std::{collections::HashMap, sync::Arc};
use dashmap::DashMap; use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
identifiers::{DeviceId, DeviceIdBox, RoomId, UserId}, use ruma::{DeviceId, DeviceIdBox, RoomId, UserId};
locks::Mutex,
};
use crate::{ use crate::{
identities::ReadOnlyDevice, identities::ReadOnlyDevice,
@ -184,7 +182,7 @@ impl DeviceStore {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use matrix_sdk_common::identifiers::room_id; use ruma::room_id;
use crate::{ use crate::{
identities::device::test::get_device, identities::device::test::get_device,

View File

@ -18,13 +18,8 @@ use std::{
}; };
use dashmap::{DashMap, DashSet}; use dashmap::{DashMap, DashSet};
use matrix_sdk_common::{ use matrix_sdk_common::{async_trait, locks::Mutex, uuid::Uuid};
async_trait, use ruma::{events::room_key_request::RequestedKeyInfo, DeviceId, DeviceIdBox, RoomId, UserId};
events::room_key_request::RequestedKeyInfo,
identifiers::{DeviceId, DeviceIdBox, RoomId, UserId},
locks::Mutex,
uuid::Uuid,
};
use super::{ use super::{
caches::{DeviceStore, GroupSessionStore, SessionStore}, caches::{DeviceStore, GroupSessionStore, SessionStore},
@ -273,7 +268,7 @@ impl CryptoStore for MemoryStore {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use matrix_sdk_common::identifiers::room_id; use ruma::room_id;
use crate::{ use crate::{
identities::device::test::get_device, identities::device::test::get_device,

View File

@ -26,7 +26,7 @@
//! # OlmMachine, //! # OlmMachine,
//! # store::MemoryStore, //! # store::MemoryStore,
//! # }; //! # };
//! # use matrix_sdk_common::identifiers::{user_id, DeviceIdBox}; //! # use ruma::{user_id, DeviceIdBox};
//! # let user_id = user_id!("@example:localhost"); //! # let user_id = user_id!("@example:localhost");
//! # let device_id: DeviceIdBox = "TEST".into(); //! # let device_id: DeviceIdBox = "TEST".into();
//! let store = Box::new(MemoryStore::new()); //! let store = Box::new(MemoryStore::new());
@ -51,20 +51,17 @@ use std::{
sync::Arc, sync::Arc,
}; };
use matrix_sdk_common::{ use matrix_sdk_common::{async_trait, locks::Mutex, uuid::Uuid, AsyncTraitDeps};
async_trait, pub use memorystore::MemoryStore;
use olm_rs::errors::{OlmAccountError, OlmGroupSessionError, OlmSessionError};
pub use pickle_key::{EncryptedPickleKey, PickleKey};
use ruma::{
events::room_key_request::RequestedKeyInfo, events::room_key_request::RequestedKeyInfo,
identifiers::{ identifiers::{
DeviceId, DeviceIdBox, DeviceKeyAlgorithm, Error as IdentifierValidationError, RoomId, DeviceId, DeviceIdBox, DeviceKeyAlgorithm, Error as IdentifierValidationError, RoomId,
UserId, UserId,
}, },
locks::Mutex,
uuid::Uuid,
AsyncTraitDeps,
}; };
pub use memorystore::MemoryStore;
use olm_rs::errors::{OlmAccountError, OlmGroupSessionError, OlmSessionError};
pub use pickle_key::{EncryptedPickleKey, PickleKey};
use serde_json::Error as SerdeError; use serde_json::Error as SerdeError;
use thiserror::Error; use thiserror::Error;

View File

@ -20,14 +20,9 @@ use std::{
}; };
use dashmap::DashSet; use dashmap::DashSet;
use matrix_sdk_common::{ use matrix_sdk_common::{async_trait, locks::Mutex, uuid};
async_trait,
events::room_key_request::RequestedKeyInfo,
identifiers::{DeviceId, DeviceIdBox, RoomId, UserId},
locks::Mutex,
uuid,
};
use olm_rs::{account::IdentityKeys, PicklingMode}; use olm_rs::{account::IdentityKeys, PicklingMode};
use ruma::{events::room_key_request::RequestedKeyInfo, DeviceId, DeviceIdBox, RoomId, UserId};
pub use sled::Error; pub use sled::Error;
use sled::{ use sled::{
transaction::{ConflictableTransactionError, TransactionError}, transaction::{ConflictableTransactionError, TransactionError},
@ -758,14 +753,14 @@ impl CryptoStore for SledStore {
mod test { mod test {
use std::collections::BTreeMap; use std::collections::BTreeMap;
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
api::r0::keys::SignedKey,
events::room_key_request::RequestedKeyInfo,
identifiers::{room_id, user_id, DeviceId, EventEncryptionAlgorithm, UserId},
uuid::Uuid,
};
use matrix_sdk_test::async_test; use matrix_sdk_test::async_test;
use olm_rs::outbound_group_session::OlmOutboundGroupSession; use olm_rs::outbound_group_session::OlmOutboundGroupSession;
use ruma::{
api::client::r0::keys::SignedKey,
events::room_key_request::RequestedKeyInfo,
identifiers::{room_id, user_id, DeviceId, EventEncryptionAlgorithm, UserId},
};
use tempfile::tempdir; use tempfile::tempdir;
use super::{CryptoStore, OutgoingKeyRequest, SledStore}; use super::{CryptoStore, OutgoingKeyRequest, SledStore};

View File

@ -15,10 +15,8 @@
use std::sync::Arc; use std::sync::Arc;
use dashmap::DashMap; use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
identifiers::{DeviceId, UserId}, use ruma::{DeviceId, UserId};
uuid::Uuid,
};
use super::{event_enums::OutgoingContent, sas::content_to_request, Sas, Verification}; use super::{event_enums::OutgoingContent, sas::content_to_request, Sas, Verification};
use crate::{OutgoingRequest, RoomMessageRequest}; use crate::{OutgoingRequest, RoomMessageRequest};

View File

@ -17,7 +17,7 @@ use std::{
convert::{TryFrom, TryInto}, convert::{TryFrom, TryInto},
}; };
use matrix_sdk_common::{ use ruma::{
events::{ events::{
key::verification::{ key::verification::{
accept::{AcceptEventContent, AcceptMethod, AcceptToDeviceEventContent}, accept::{AcceptEventContent, AcceptMethod, AcceptToDeviceEventContent},
@ -34,7 +34,7 @@ use matrix_sdk_common::{
AnyMessageEvent, AnyMessageEventContent, AnyToDeviceEvent, AnyToDeviceEventContent, AnyMessageEvent, AnyMessageEventContent, AnyToDeviceEvent, AnyToDeviceEventContent,
}, },
identifiers::{DeviceId, RoomId, UserId}, identifiers::{DeviceId, RoomId, UserId},
CanonicalJsonValue, serde::CanonicalJsonValue,
}; };
use super::FlowId; use super::FlowId;
@ -676,7 +676,7 @@ impl TryFrom<ToDeviceRequest> for OutgoingContent {
type Error = (); type Error = ();
fn try_from(value: ToDeviceRequest) -> Result<Self, Self::Error> { fn try_from(value: ToDeviceRequest) -> Result<Self, Self::Error> {
use matrix_sdk_common::events::EventType; use ruma::events::EventType;
use serde_json::Value; use serde_json::Value;
let json: Value = serde_json::from_str( let json: Value = serde_json::from_str(

View File

@ -15,11 +15,8 @@
use std::{convert::TryFrom, sync::Arc}; use std::{convert::TryFrom, sync::Arc};
use dashmap::DashMap; use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::{locks::Mutex, uuid::Uuid};
identifiers::{DeviceId, UserId}, use ruma::{DeviceId, UserId};
locks::Mutex,
uuid::Uuid,
};
use tracing::{info, warn}; use tracing::{info, warn};
use super::{ use super::{
@ -314,10 +311,8 @@ mod test {
time::{Duration, Instant}, time::{Duration, Instant},
}; };
use matrix_sdk_common::{ use matrix_sdk_common::locks::Mutex;
identifiers::{DeviceId, UserId}, use ruma::{DeviceId, UserId};
locks::Mutex,
};
use super::{Sas, VerificationMachine}; use super::{Sas, VerificationMachine};
use crate::{ use crate::{

View File

@ -22,8 +22,9 @@ use std::sync::Arc;
use event_enums::OutgoingContent; use event_enums::OutgoingContent;
pub use machine::VerificationMachine; pub use machine::VerificationMachine;
use matrix_sdk_common::{ pub use requests::VerificationRequest;
api::r0::keys::upload_signatures::Request as SignatureUploadRequest, use ruma::{
api::client::r0::keys::upload_signatures::Request as SignatureUploadRequest,
events::{ events::{
key::verification::{ key::verification::{
cancel::{CancelCode, CancelEventContent, CancelToDeviceEventContent}, cancel::{CancelCode, CancelEventContent, CancelToDeviceEventContent},
@ -32,9 +33,8 @@ use matrix_sdk_common::{
}, },
AnyMessageEventContent, AnyToDeviceEventContent, AnyMessageEventContent, AnyToDeviceEventContent,
}, },
identifiers::{DeviceId, EventId, RoomId, UserId}, DeviceId, EventId, RoomId, UserId,
}; };
pub use requests::VerificationRequest;
pub use sas::{AcceptSettings, Sas}; pub use sas::{AcceptSettings, Sas};
use tracing::{error, info, trace, warn}; use tracing::{error, info, trace, warn};
@ -445,9 +445,9 @@ impl IdentitiesBeingVerified {
#[cfg(test)] #[cfg(test)]
pub(crate) mod test { pub(crate) mod test {
use matrix_sdk_common::{ use ruma::{
events::{AnyToDeviceEvent, AnyToDeviceEventContent, EventType, ToDeviceEvent}, events::{AnyToDeviceEvent, AnyToDeviceEventContent, EventType, ToDeviceEvent},
identifiers::UserId, UserId,
}; };
use serde_json::Value; use serde_json::Value;

View File

@ -16,8 +16,9 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
api::r0::to_device::DeviceIdOrAllDevices, use ruma::{
api::client::r0::to_device::DeviceIdOrAllDevices,
events::{ events::{
key::verification::{ key::verification::{
cancel::CancelCode, cancel::CancelCode,
@ -29,9 +30,7 @@ use matrix_sdk_common::{
room::message::KeyVerificationRequestEventContent, room::message::KeyVerificationRequestEventContent,
AnyMessageEventContent, AnyToDeviceEventContent, AnyMessageEventContent, AnyToDeviceEventContent,
}, },
identifiers::{DeviceId, DeviceIdBox, EventId, RoomId, UserId}, DeviceId, DeviceIdBox, EventId, MilliSecondsSinceUnixEpoch, RoomId, UserId,
uuid::Uuid,
MilliSecondsSinceUnixEpoch,
}; };
use tracing::{info, warn}; use tracing::{info, warn};
@ -677,8 +676,8 @@ struct Done {}
mod test { mod test {
use std::convert::TryFrom; use std::convert::TryFrom;
use matrix_sdk_common::identifiers::{event_id, room_id, DeviceIdBox, UserId};
use matrix_sdk_test::async_test; use matrix_sdk_test::async_test;
use ruma::{event_id, room_id, DeviceIdBox, UserId};
use super::VerificationRequest; use super::VerificationRequest;
use crate::{ use crate::{

View File

@ -14,8 +14,10 @@
use std::{collections::BTreeMap, convert::TryInto}; use std::{collections::BTreeMap, convert::TryInto};
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
api::r0::to_device::DeviceIdOrAllDevices, use olm_rs::sas::OlmSas;
use ruma::{
api::client::r0::to_device::DeviceIdOrAllDevices,
events::{ events::{
key::verification::{ key::verification::{
cancel::CancelCode, cancel::CancelCode,
@ -24,10 +26,8 @@ use matrix_sdk_common::{
}, },
AnyMessageEventContent, AnyToDeviceEventContent, EventType, AnyMessageEventContent, AnyToDeviceEventContent, EventType,
}, },
identifiers::{DeviceKeyAlgorithm, DeviceKeyId, UserId}, DeviceKeyAlgorithm, DeviceKeyId, UserId,
uuid::Uuid,
}; };
use olm_rs::sas::OlmSas;
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
use tracing::{trace, warn}; use tracing::{trace, warn};
@ -557,8 +557,8 @@ pub fn content_to_request(
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use matrix_sdk_common::events::key::verification::start::StartToDeviceEventContent;
use proptest::prelude::*; use proptest::prelude::*;
use ruma::events::key::verification::start::StartToDeviceEventContent;
use serde_json::json; use serde_json::json;
use super::{ use super::{

View File

@ -16,9 +16,9 @@ use std::sync::Arc;
#[cfg(test)] #[cfg(test)]
use std::time::Instant; use std::time::Instant;
use matrix_sdk_common::{ use ruma::{
events::key::verification::{cancel::CancelCode, ShortAuthenticationString}, events::key::verification::{cancel::CancelCode, ShortAuthenticationString},
identifiers::{EventId, RoomId, UserId}, EventId, RoomId, UserId,
}; };
use super::{ use super::{

View File

@ -22,8 +22,9 @@ use std::time::Instant;
pub use helpers::content_to_request; pub use helpers::content_to_request;
use inner_sas::InnerSas; use inner_sas::InnerSas;
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
api::r0::keys::upload_signatures::Request as SignatureUploadRequest, use ruma::{
api::client::r0::keys::upload_signatures::Request as SignatureUploadRequest,
events::{ events::{
key::verification::{ key::verification::{
accept::{AcceptEventContent, AcceptMethod, AcceptToDeviceEventContent}, accept::{AcceptEventContent, AcceptMethod, AcceptToDeviceEventContent},
@ -32,8 +33,7 @@ use matrix_sdk_common::{
}, },
AnyMessageEventContent, AnyToDeviceEventContent, AnyMessageEventContent, AnyToDeviceEventContent,
}, },
identifiers::{DeviceId, EventId, RoomId, UserId}, DeviceId, EventId, RoomId, UserId,
uuid::Uuid,
}; };
use tracing::trace; use tracing::trace;
@ -486,7 +486,7 @@ impl AcceptSettings {
mod test { mod test {
use std::{convert::TryFrom, sync::Arc}; use std::{convert::TryFrom, sync::Arc};
use matrix_sdk_common::identifiers::{DeviceId, UserId}; use ruma::{DeviceId, UserId};
use super::Sas; use super::Sas;
use crate::{ use crate::{

View File

@ -19,7 +19,9 @@ use std::{
time::{Duration, Instant}, time::{Duration, Instant},
}; };
use matrix_sdk_common::{ use matrix_sdk_common::uuid::Uuid;
use olm_rs::sas::OlmSas;
use ruma::{
events::{ events::{
key::verification::{ key::verification::{
accept::{ accept::{
@ -38,10 +40,8 @@ use matrix_sdk_common::{
}, },
AnyMessageEventContent, AnyToDeviceEventContent, AnyMessageEventContent, AnyToDeviceEventContent,
}, },
identifiers::{DeviceId, EventId, RoomId, UserId}, DeviceId, EventId, RoomId, UserId,
uuid::Uuid,
}; };
use olm_rs::sas::OlmSas;
use tracing::info; use tracing::info;
use super::{ use super::{
@ -1088,12 +1088,12 @@ impl SasState<Cancelled> {
mod test { mod test {
use std::convert::TryFrom; use std::convert::TryFrom;
use matrix_sdk_common::{ use ruma::{
events::key::verification::{ events::key::verification::{
accept::{AcceptMethod, CustomContent}, accept::{AcceptMethod, CustomContent},
start::{CustomContent as CustomStartContent, StartMethod}, start::{CustomContent as CustomStartContent, StartMethod},
}, },
identifiers::{DeviceId, UserId}, DeviceId, UserId,
}; };
use super::{Accepted, Created, SasState, Started}; use super::{Accepted, Created, SasState, Started};