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 use olm_rs::{account::IdentityKeys, PicklingMode};
pub use session::{PickledSession, Session, SessionPickle};
pub use signing::{PrivateCrossSigningIdentity, PickledCrossSigningIdentity};
pub use signing::{PickledCrossSigningIdentity, PrivateCrossSigningIdentity};
pub(crate) use utility::Utility;
#[cfg(test)]

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![allow(dead_code,missing_docs)]
#![allow(dead_code, missing_docs)]
use aes_gcm::{
aead::{generic_array::GenericArray, Aead, NewAead},
@ -410,7 +410,10 @@ impl PrivateCrossSigningIdentity {
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() {
Some(m.pickle(pickle_key).await)
} else {
@ -435,10 +438,8 @@ impl PrivateCrossSigningIdentity {
self_signing_key,
};
println!("HELOOO {:#?}", pickle);
let pickle = serde_json::to_string(&pickle)?;
Ok(PickledCrossSigningIdentity {
user_id: self.user_id.as_ref().to_owned(),
shared: self.shared(),
@ -455,10 +456,8 @@ impl PrivateCrossSigningIdentity {
pickle: PickledCrossSigningIdentity,
pickle_key: &[u8],
) -> Result<Self, SigningError> {
println!("HELOOO UNPICKLED {:#?}", pickle.pickle);
let signings: PickledSignings = serde_json::from_str(&pickle.pickle)?;
let master = if let Some(m) = signings.master_key {
Some(MasterSigning::from_pickle(m, pickle_key)?)
} else {

View File

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

View File

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

View File

@ -38,14 +38,12 @@ use super::{
pickle_key::{EncryptedPickleKey, PickleKey},
Changes, CryptoStore, CryptoStoreError, Result,
};
use crate::olm::PickledCrossSigningIdentity;
use crate::olm::PrivateCrossSigningIdentity;
use crate::{
identities::{LocalTrust, OwnUserIdentity, ReadOnlyDevice, UserIdentities, UserIdentity},
olm::{
AccountPickle, IdentityKeys, InboundGroupSession, InboundGroupSessionPickle,
PickledAccount, PickledInboundGroupSession, PickledSession, PicklingMode, ReadOnlyAccount,
Session, SessionPickle,
PickledAccount, PickledCrossSigningIdentity, PickledInboundGroupSession, PickledSession,
PicklingMode, PrivateCrossSigningIdentity, ReadOnlyAccount, Session, SessionPickle,
},
};
@ -1615,7 +1613,7 @@ impl CryptoStore for SqliteStore {
query(
"INSERT INTO private_identities (
account_id, user_id, pickle, shared
account_id, user_id, pickle, shared
) VALUES (?1, ?2, ?3, ?4)
ON CONFLICT(account_id, user_id) DO UPDATE SET
pickle = excluded.pickle,
@ -1813,13 +1811,15 @@ impl std::fmt::Debug for SqliteStore {
#[cfg(test)]
mod test {
use crate::olm::PrivateCrossSigningIdentity;
use crate::{
identities::{
device::test::get_device,
user::test::{get_other_identity, get_own_identity},
},
olm::{GroupSessionKey, InboundGroupSession, ReadOnlyAccount, Session},
olm::{
GroupSessionKey, InboundGroupSession, PrivateCrossSigningIdentity, ReadOnlyAccount,
Session,
},
store::{Changes, DeviceChanges, IdentityChanges},
};
use matrix_sdk_common::{