chore(sdk): Move all the crypto related module under an encryption module

master
Damir Jelić 2021-09-14 12:31:40 +02:00
parent 041ef66c01
commit e8c5b0766e
11 changed files with 30 additions and 15 deletions

View File

@ -9,13 +9,13 @@ use std::{
use matrix_sdk::{
self,
encryption::verification::{SasVerification, Verification},
ruma::{
events::{
room::message::MessageType, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent,
},
UserId,
},
verification::{SasVerification, Verification},
Client, LoopCtrl, SyncSettings,
};
use url::Url;

View File

@ -139,12 +139,14 @@ use ruma::{
};
#[cfg(all(feature = "qrcode", feature = "encryption"))]
use crate::verification::QrVerification;
use crate::encryption::verification::QrVerification;
#[cfg(feature = "encryption")]
use crate::{
encryption::{
identities::{Device, UserDevices},
verification::{SasVerification, Verification, VerificationRequest},
},
error::RoomKeyImportError,
identities::{Device, UserDevices},
verification::{SasVerification, Verification, VerificationRequest},
};
use crate::{
error::{HttpError, HttpResult},
@ -2685,8 +2687,8 @@ impl Client {
pub async fn get_user_identity(
&self,
user_id: &UserId,
) -> StdResult<Option<crate::identities::UserIdentity>, CryptoStoreError> {
use crate::identities::UserIdentity;
) -> StdResult<Option<crate::encryption::identities::UserIdentity>, CryptoStoreError> {
use crate::encryption::identities::UserIdentity;
if let Some(olm) = self.base_client.olm_machine().await {
let identity = olm.get_identity(user_id).await?;

View File

@ -22,8 +22,8 @@ use ruma::{events::key::verification::VerificationMethod, DeviceId, DeviceIdBox}
use super::ManualVerifyError;
use crate::{
encryption::verification::{SasVerification, VerificationRequest},
error::Result,
verification::{SasVerification, VerificationRequest},
Client,
};

View File

@ -30,7 +30,7 @@ use ruma::{
};
use super::{ManualVerifyError, RequestVerificationError};
use crate::{room::Joined, verification::VerificationRequest, Client};
use crate::{encryption::verification::VerificationRequest, room::Joined, Client};
/// A struct representing a E2EE capable identity of a user.
///

View File

@ -0,0 +1,19 @@
// Copyright 2021 The Matrix.org Foundation C.I.C.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! End to end encryption related types
pub mod identities;
pub mod verification;
pub use matrix_sdk_base::crypto::{EncryptionInfo, LocalTrust};

View File

@ -37,9 +37,6 @@ compile_error!("only one of 'native-tls' or 'rustls-tls' features can be enabled
compile_error!("'sso_login' cannot be enabled on 'wasm32' arch");
pub use bytes;
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub use matrix_sdk_base::crypto::{EncryptionInfo, LocalTrust};
pub use matrix_sdk_base::{
media, Room as BaseRoom, RoomInfo, RoomMember as BaseRoomMember, RoomType, Session,
StateChanges, StoreError,
@ -60,10 +57,7 @@ mod room_member;
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub mod identities;
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub mod verification;
pub mod encryption;
pub use client::{Client, ClientConfig, LoopCtrl, RequestConfig, SyncSettings};
pub use error::{Error, HttpError, HttpResult, Result};