chore(sdk): Move all the crypto related module under an encryption module
This commit is contained in:
parent
041ef66c01
commit
e8c5b0766e
11 changed files with 30 additions and 15 deletions
|
@ -9,13 +9,13 @@ use std::{
|
||||||
|
|
||||||
use matrix_sdk::{
|
use matrix_sdk::{
|
||||||
self,
|
self,
|
||||||
|
encryption::verification::{SasVerification, Verification},
|
||||||
ruma::{
|
ruma::{
|
||||||
events::{
|
events::{
|
||||||
room::message::MessageType, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent,
|
room::message::MessageType, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent,
|
||||||
},
|
},
|
||||||
UserId,
|
UserId,
|
||||||
},
|
},
|
||||||
verification::{SasVerification, Verification},
|
|
||||||
Client, LoopCtrl, SyncSettings,
|
Client, LoopCtrl, SyncSettings,
|
||||||
};
|
};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -139,12 +139,14 @@ use ruma::{
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(all(feature = "qrcode", feature = "encryption"))]
|
#[cfg(all(feature = "qrcode", feature = "encryption"))]
|
||||||
use crate::verification::QrVerification;
|
use crate::encryption::verification::QrVerification;
|
||||||
#[cfg(feature = "encryption")]
|
#[cfg(feature = "encryption")]
|
||||||
use crate::{
|
use crate::{
|
||||||
|
encryption::{
|
||||||
|
identities::{Device, UserDevices},
|
||||||
|
verification::{SasVerification, Verification, VerificationRequest},
|
||||||
|
},
|
||||||
error::RoomKeyImportError,
|
error::RoomKeyImportError,
|
||||||
identities::{Device, UserDevices},
|
|
||||||
verification::{SasVerification, Verification, VerificationRequest},
|
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
error::{HttpError, HttpResult},
|
error::{HttpError, HttpResult},
|
||||||
|
@ -2685,8 +2687,8 @@ impl Client {
|
||||||
pub async fn get_user_identity(
|
pub async fn get_user_identity(
|
||||||
&self,
|
&self,
|
||||||
user_id: &UserId,
|
user_id: &UserId,
|
||||||
) -> StdResult<Option<crate::identities::UserIdentity>, CryptoStoreError> {
|
) -> StdResult<Option<crate::encryption::identities::UserIdentity>, CryptoStoreError> {
|
||||||
use crate::identities::UserIdentity;
|
use crate::encryption::identities::UserIdentity;
|
||||||
|
|
||||||
if let Some(olm) = self.base_client.olm_machine().await {
|
if let Some(olm) = self.base_client.olm_machine().await {
|
||||||
let identity = olm.get_identity(user_id).await?;
|
let identity = olm.get_identity(user_id).await?;
|
||||||
|
|
|
@ -22,8 +22,8 @@ use ruma::{events::key::verification::VerificationMethod, DeviceId, DeviceIdBox}
|
||||||
|
|
||||||
use super::ManualVerifyError;
|
use super::ManualVerifyError;
|
||||||
use crate::{
|
use crate::{
|
||||||
|
encryption::verification::{SasVerification, VerificationRequest},
|
||||||
error::Result,
|
error::Result,
|
||||||
verification::{SasVerification, VerificationRequest},
|
|
||||||
Client,
|
Client,
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@ use ruma::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{ManualVerifyError, RequestVerificationError};
|
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.
|
/// A struct representing a E2EE capable identity of a user.
|
||||||
///
|
///
|
19
crates/matrix_sdk/src/encryption/mod.rs
Normal file
19
crates/matrix_sdk/src/encryption/mod.rs
Normal 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};
|
|
@ -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");
|
compile_error!("'sso_login' cannot be enabled on 'wasm32' arch");
|
||||||
|
|
||||||
pub use bytes;
|
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::{
|
pub use matrix_sdk_base::{
|
||||||
media, Room as BaseRoom, RoomInfo, RoomMember as BaseRoomMember, RoomType, Session,
|
media, Room as BaseRoom, RoomInfo, RoomMember as BaseRoomMember, RoomType, Session,
|
||||||
StateChanges, StoreError,
|
StateChanges, StoreError,
|
||||||
|
@ -60,10 +57,7 @@ mod room_member;
|
||||||
|
|
||||||
#[cfg(feature = "encryption")]
|
#[cfg(feature = "encryption")]
|
||||||
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
|
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
|
||||||
pub mod identities;
|
pub mod encryption;
|
||||||
#[cfg(feature = "encryption")]
|
|
||||||
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
|
|
||||||
pub mod verification;
|
|
||||||
|
|
||||||
pub use client::{Client, ClientConfig, LoopCtrl, RequestConfig, SyncSettings};
|
pub use client::{Client, ClientConfig, LoopCtrl, RequestConfig, SyncSettings};
|
||||||
pub use error::{Error, HttpError, HttpResult, Result};
|
pub use error::{Error, HttpError, HttpResult, Result};
|
||||||
|
|
Loading…
Reference in a new issue