crypto: Fix some lint issues.

master
Damir Jelić 2020-10-22 16:40:05 +02:00
parent f60dc7ed78
commit 7de002b128
5 changed files with 19 additions and 19 deletions

View File

@ -32,7 +32,7 @@ pub use group_sessions::{
pub(crate) use group_sessions::{GroupSessionKey, OutboundGroupSession}; pub(crate) use group_sessions::{GroupSessionKey, OutboundGroupSession};
pub use olm_rs::{account::IdentityKeys, PicklingMode}; pub use olm_rs::{account::IdentityKeys, PicklingMode};
pub use session::{PickledSession, Session, SessionPickle}; pub use session::{PickledSession, Session, SessionPickle};
pub use signing::{PrivateCrossSigningIdentity, PickledCrossSigningIdentity}; pub use signing::{PickledCrossSigningIdentity, PrivateCrossSigningIdentity};
pub(crate) use utility::Utility; pub(crate) use utility::Utility;
#[cfg(test)] #[cfg(test)]

View File

@ -410,7 +410,10 @@ impl PrivateCrossSigningIdentity {
self.shared.load(Ordering::SeqCst) self.shared.load(Ordering::SeqCst)
} }
pub async fn pickle(&self, pickle_key: &[u8]) -> Result<PickledCrossSigningIdentity, JsonError> { pub async fn pickle(
&self,
pickle_key: &[u8],
) -> Result<PickledCrossSigningIdentity, JsonError> {
let master_key = if let Some(m) = self.master_key.lock().await.as_ref() { let master_key = if let Some(m) = self.master_key.lock().await.as_ref() {
Some(m.pickle(pickle_key).await) Some(m.pickle(pickle_key).await)
} else { } else {
@ -435,8 +438,6 @@ impl PrivateCrossSigningIdentity {
self_signing_key, self_signing_key,
}; };
println!("HELOOO {:#?}", pickle);
let pickle = serde_json::to_string(&pickle)?; let pickle = serde_json::to_string(&pickle)?;
Ok(PickledCrossSigningIdentity { Ok(PickledCrossSigningIdentity {
@ -455,10 +456,8 @@ impl PrivateCrossSigningIdentity {
pickle: PickledCrossSigningIdentity, pickle: PickledCrossSigningIdentity,
pickle_key: &[u8], pickle_key: &[u8],
) -> Result<Self, SigningError> { ) -> Result<Self, SigningError> {
println!("HELOOO UNPICKLED {:#?}", pickle.pickle);
let signings: PickledSignings = serde_json::from_str(&pickle.pickle)?; let signings: PickledSignings = serde_json::from_str(&pickle.pickle)?;
let master = if let Some(m) = signings.master_key { let master = if let Some(m) = signings.master_key {
Some(MasterSigning::from_pickle(m, pickle_key)?) Some(MasterSigning::from_pickle(m, pickle_key)?)
} else { } else {

View File

@ -28,8 +28,10 @@ use super::{
caches::{DeviceStore, GroupSessionStore, SessionStore}, caches::{DeviceStore, GroupSessionStore, SessionStore},
Changes, CryptoStore, InboundGroupSession, ReadOnlyAccount, Result, Session, Changes, CryptoStore, InboundGroupSession, ReadOnlyAccount, Result, Session,
}; };
use crate::identities::{ReadOnlyDevice, UserIdentities}; use crate::{
use crate::olm::PrivateCrossSigningIdentity; identities::{ReadOnlyDevice, UserIdentities},
olm::PrivateCrossSigningIdentity,
};
/// An in-memory only store that will forget all the E2EE key once it's dropped. /// An in-memory only store that will forget all the E2EE key once it's dropped.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View File

@ -79,11 +79,10 @@ use matrix_sdk_common_macros::async_trait;
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use matrix_sdk_common_macros::send_sync; use matrix_sdk_common_macros::send_sync;
use crate::olm::PrivateCrossSigningIdentity;
use crate::{ use crate::{
error::SessionUnpicklingError, error::SessionUnpicklingError,
identities::{Device, ReadOnlyDevice, UserDevices, UserIdentities}, identities::{Device, ReadOnlyDevice, UserDevices, UserIdentities},
olm::{InboundGroupSession, ReadOnlyAccount, Session}, olm::{InboundGroupSession, PrivateCrossSigningIdentity, ReadOnlyAccount, Session},
verification::VerificationMachine, verification::VerificationMachine,
}; };

View File

@ -38,14 +38,12 @@ use super::{
pickle_key::{EncryptedPickleKey, PickleKey}, pickle_key::{EncryptedPickleKey, PickleKey},
Changes, CryptoStore, CryptoStoreError, Result, Changes, CryptoStore, CryptoStoreError, Result,
}; };
use crate::olm::PickledCrossSigningIdentity;
use crate::olm::PrivateCrossSigningIdentity;
use crate::{ use crate::{
identities::{LocalTrust, OwnUserIdentity, ReadOnlyDevice, UserIdentities, UserIdentity}, identities::{LocalTrust, OwnUserIdentity, ReadOnlyDevice, UserIdentities, UserIdentity},
olm::{ olm::{
AccountPickle, IdentityKeys, InboundGroupSession, InboundGroupSessionPickle, AccountPickle, IdentityKeys, InboundGroupSession, InboundGroupSessionPickle,
PickledAccount, PickledInboundGroupSession, PickledSession, PicklingMode, ReadOnlyAccount, PickledAccount, PickledCrossSigningIdentity, PickledInboundGroupSession, PickledSession,
Session, SessionPickle, PicklingMode, PrivateCrossSigningIdentity, ReadOnlyAccount, Session, SessionPickle,
}, },
}; };
@ -1813,13 +1811,15 @@ impl std::fmt::Debug for SqliteStore {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::olm::PrivateCrossSigningIdentity;
use crate::{ use crate::{
identities::{ identities::{
device::test::get_device, device::test::get_device,
user::test::{get_other_identity, get_own_identity}, user::test::{get_other_identity, get_own_identity},
}, },
olm::{GroupSessionKey, InboundGroupSession, ReadOnlyAccount, Session}, olm::{
GroupSessionKey, InboundGroupSession, PrivateCrossSigningIdentity, ReadOnlyAccount,
Session,
},
store::{Changes, DeviceChanges, IdentityChanges}, store::{Changes, DeviceChanges, IdentityChanges},
}; };
use matrix_sdk_common::{ use matrix_sdk_common::{