crypto: Remove some unused imports.

master
Damir Jelić 2020-12-17 16:28:12 +01:00
parent 4ad4ad1e94
commit 48f43a4af1
7 changed files with 19 additions and 50 deletions

View File

@ -42,7 +42,7 @@ use tracing::warn;
use crate::{ use crate::{
olm::{InboundGroupSession, PrivateCrossSigningIdentity, Session}, olm::{InboundGroupSession, PrivateCrossSigningIdentity, Session},
store::{Changes, DeviceChanges}, store::{Changes, DeviceChanges},
OutgoingRequest, OutgoingRequests, OutgoingVerificationRequest, OutgoingVerificationRequest,
}; };
#[cfg(test)] #[cfg(test)]
use crate::{OlmMachine, ReadOnlyAccount}; use crate::{OlmMachine, ReadOnlyAccount};

View File

@ -21,7 +21,7 @@ use tracing::{info, trace, warn};
use matrix_sdk_common::{ use matrix_sdk_common::{
events::{ events::{
room::message::MessageEventContent, AnyMessageEvent, AnySyncMessageEvent, AnySyncRoomEvent, room::message::MessageEventContent, AnyMessageEvent, AnySyncMessageEvent, AnySyncRoomEvent,
AnyToDeviceEvent, AnyToDeviceEventContent, AnyToDeviceEvent,
}, },
identifiers::{DeviceId, EventId, RoomId, UserId}, identifiers::{DeviceId, EventId, RoomId, UserId},
locks::Mutex, locks::Mutex,
@ -35,10 +35,9 @@ use super::{
use crate::{ use crate::{
olm::PrivateCrossSigningIdentity, olm::PrivateCrossSigningIdentity,
requests::{OutgoingRequest, ToDeviceRequest}, requests::OutgoingRequest,
store::{CryptoStore, CryptoStoreError}, store::{CryptoStore, CryptoStoreError},
OutgoingRequests, OutgoingVerificationRequest, ReadOnlyAccount, ReadOnlyDevice, OutgoingVerificationRequest, ReadOnlyAccount, ReadOnlyDevice, RoomMessageRequest,
RoomMessageRequest,
}; };
#[derive(Clone, Debug)] #[derive(Clone, Debug)]

View File

@ -31,10 +31,10 @@ use matrix_sdk_common::{
use crate::{ use crate::{
olm::{PrivateCrossSigningIdentity, ReadOnlyAccount}, olm::{PrivateCrossSigningIdentity, ReadOnlyAccount},
store::CryptoStore, store::CryptoStore,
ReadOnlyDevice, Sas, UserIdentities, UserIdentity, ReadOnlyDevice, Sas, UserIdentities,
}; };
use super::sas::{OutgoingContent, StartContent}; use super::sas::OutgoingContent;
const SUPPORTED_METHODS: &[VerificationMethod] = &[VerificationMethod::MSasV1]; const SUPPORTED_METHODS: &[VerificationMethod] = &[VerificationMethod::MSasV1];
@ -321,11 +321,11 @@ impl RequestState<Ready> {
fn start_sas( fn start_sas(
self, self,
store: Arc<Box<dyn CryptoStore>>, _store: Arc<Box<dyn CryptoStore>>,
account: ReadOnlyAccount, _account: ReadOnlyAccount,
private_identity: PrivateCrossSigningIdentity, _private_identity: PrivateCrossSigningIdentity,
other_device: ReadOnlyDevice, _other_device: ReadOnlyDevice,
other_identity: Option<UserIdentities>, _other_identity: Option<UserIdentities>,
) -> (Sas, OutgoingContent) { ) -> (Sas, OutgoingContent) {
todo!() todo!()
// Sas::start_in_room( // Sas::start_in_room(

View File

@ -25,14 +25,12 @@ use matrix_sdk_common::{
key::verification::{ key::verification::{
cancel::CancelCode, cancel::CancelCode,
mac::{MacEventContent, MacToDeviceEventContent}, mac::{MacEventContent, MacToDeviceEventContent},
start::StartToDeviceEventContent,
Relation, Relation,
}, },
AnyToDeviceEventContent, EventType, ToDeviceEvent, AnyToDeviceEventContent, EventType,
}, },
identifiers::{DeviceId, DeviceKeyAlgorithm, DeviceKeyId, UserId}, identifiers::{DeviceId, DeviceKeyAlgorithm, DeviceKeyId, UserId},
uuid::Uuid, uuid::Uuid,
CanonicalJsonValue,
}; };
use crate::{ use crate::{

View File

@ -18,19 +18,9 @@ use std::time::Instant;
use std::sync::Arc; use std::sync::Arc;
use matrix_sdk_common::{ use matrix_sdk_common::{
events::{ events::{key::verification::cancel::CancelCode, AnyMessageEvent, AnyToDeviceEvent},
key::verification::{
accept::AcceptToDeviceEventContent,
cancel::CancelCode,
mac::MacToDeviceEventContent,
start::{StartEventContent, StartToDeviceEventContent},
},
AnyMessageEvent, AnyMessageEventContent, AnySyncMessageEvent, AnyToDeviceEvent,
AnyToDeviceEventContent, MessageEvent, ToDeviceEvent,
},
identifiers::{EventId, RoomId, UserId}, identifiers::{EventId, RoomId, UserId},
}; };
use tracing::trace;
use crate::{ use crate::{
identities::{ReadOnlyDevice, UserIdentities}, identities::{ReadOnlyDevice, UserIdentities},
@ -96,13 +86,8 @@ impl InnerSas {
content: impl Into<StartContent>, content: impl Into<StartContent>,
other_identity: Option<UserIdentities>, other_identity: Option<UserIdentities>,
) -> Result<InnerSas, CancelContent> { ) -> Result<InnerSas, CancelContent> {
match SasState::<Started>::from_start_event( match SasState::<Started>::from_start_event(account, other_device, other_identity, content)
account, {
other_device,
other_identity,
&sender,
content,
) {
Ok(s) => Ok(InnerSas::Started(s)), Ok(s) => Ok(InnerSas::Started(s)),
Err(s) => Err(s.as_content()), Err(s) => Err(s.as_content()),
} }

View File

@ -27,12 +27,8 @@ use tracing::{error, info, trace, warn};
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::keys::upload_signatures::Request as SignatureUploadRequest, api::r0::keys::upload_signatures::Request as SignatureUploadRequest,
events::{ events::{
key::verification::{ key::verification::cancel::CancelCode, AnyMessageEvent, AnyMessageEventContent,
cancel::CancelCode, AnyToDeviceEvent, AnyToDeviceEventContent,
start::{StartEventContent, StartToDeviceEventContent},
},
AnyMessageEvent, AnyMessageEventContent, AnySyncMessageEvent, AnyToDeviceEvent,
AnyToDeviceEventContent, MessageEvent, ToDeviceEvent,
}, },
identifiers::{DeviceId, EventId, RoomId, UserId}, identifiers::{DeviceId, EventId, RoomId, UserId},
uuid::Uuid, uuid::Uuid,

View File

@ -31,7 +31,6 @@ use matrix_sdk_common::{
cancel::{CancelCode, CancelEventContent, CancelToDeviceEventContent}, cancel::{CancelCode, CancelEventContent, CancelToDeviceEventContent},
done::DoneEventContent, done::DoneEventContent,
key::{KeyEventContent, KeyToDeviceEventContent}, key::{KeyEventContent, KeyToDeviceEventContent},
mac::MacToDeviceEventContent,
start::{ start::{
MSasV1Content, MSasV1ContentInit, StartEventContent, StartMethod, MSasV1Content, MSasV1ContentInit, StartEventContent, StartMethod,
StartToDeviceEventContent, StartToDeviceEventContent,
@ -39,7 +38,7 @@ use matrix_sdk_common::{
HashAlgorithm, KeyAgreementProtocol, MessageAuthenticationCode, Relation, HashAlgorithm, KeyAgreementProtocol, MessageAuthenticationCode, Relation,
ShortAuthenticationString, VerificationMethod, ShortAuthenticationString, VerificationMethod,
}, },
AnyMessageEventContent, AnyToDeviceEventContent, MessageEvent, ToDeviceEvent, ToDeviceEvent,
}, },
identifiers::{DeviceId, EventId, RoomId, UserId}, identifiers::{DeviceId, EventId, RoomId, UserId},
uuid::Uuid, uuid::Uuid,
@ -495,23 +494,15 @@ impl SasState<Started> {
account: ReadOnlyAccount, account: ReadOnlyAccount,
other_device: ReadOnlyDevice, other_device: ReadOnlyDevice,
other_identity: Option<UserIdentities>, other_identity: Option<UserIdentities>,
sender: &UserId,
content: impl Into<StartContent>, content: impl Into<StartContent>,
) -> Result<SasState<Started>, SasState<Canceled>> { ) -> Result<SasState<Started>, SasState<Canceled>> {
Self::from_start_helper( Self::from_start_helper(account, other_device, other_identity, &content.into())
account,
other_device,
other_identity,
sender,
&content.into(),
)
} }
fn from_start_helper( fn from_start_helper(
account: ReadOnlyAccount, account: ReadOnlyAccount,
other_device: ReadOnlyDevice, other_device: ReadOnlyDevice,
other_identity: Option<UserIdentities>, other_identity: Option<UserIdentities>,
sender: &UserId,
content: &StartContent, content: &StartContent,
) -> Result<SasState<Started>, SasState<Canceled>> { ) -> Result<SasState<Started>, SasState<Canceled>> {
if let StartMethod::MSasV1(method_content) = content.method() { if let StartMethod::MSasV1(method_content) = content.method() {