fix(crypto): Fix some clippy warnings
This commit is contained in:
parent
a6916dd9dd
commit
b8001b78b4
6 changed files with 7 additions and 20 deletions
|
@ -42,7 +42,7 @@ use super::{atomic_bool_deserializer, atomic_bool_serializer};
|
||||||
use crate::{
|
use crate::{
|
||||||
error::{EventError, OlmError, OlmResult, SignatureError},
|
error::{EventError, OlmError, OlmResult, SignatureError},
|
||||||
identities::{ReadOnlyOwnUserIdentity, ReadOnlyUserIdentities},
|
identities::{ReadOnlyOwnUserIdentity, ReadOnlyUserIdentities},
|
||||||
olm::{InboundGroupSession, PrivateCrossSigningIdentity, Session, Utility},
|
olm::{InboundGroupSession, Session, Utility},
|
||||||
store::{Changes, CryptoStore, DeviceChanges, Result as StoreResult},
|
store::{Changes, CryptoStore, DeviceChanges, Result as StoreResult},
|
||||||
verification::VerificationMachine,
|
verification::VerificationMachine,
|
||||||
OutgoingVerificationRequest, Sas, ToDeviceRequest, VerificationRequest,
|
OutgoingVerificationRequest, Sas, ToDeviceRequest, VerificationRequest,
|
||||||
|
@ -296,7 +296,6 @@ impl Device {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct UserDevices {
|
pub struct UserDevices {
|
||||||
pub(crate) inner: HashMap<DeviceIdBox, ReadOnlyDevice>,
|
pub(crate) inner: HashMap<DeviceIdBox, ReadOnlyDevice>,
|
||||||
pub(crate) private_identity: Arc<Mutex<PrivateCrossSigningIdentity>>,
|
|
||||||
pub(crate) verification_machine: VerificationMachine,
|
pub(crate) verification_machine: VerificationMachine,
|
||||||
pub(crate) own_identity: Option<ReadOnlyOwnUserIdentity>,
|
pub(crate) own_identity: Option<ReadOnlyOwnUserIdentity>,
|
||||||
pub(crate) device_owner_identity: Option<ReadOnlyUserIdentities>,
|
pub(crate) device_owner_identity: Option<ReadOnlyUserIdentities>,
|
||||||
|
|
|
@ -309,7 +309,6 @@ impl Store {
|
||||||
|
|
||||||
Ok(UserDevices {
|
Ok(UserDevices {
|
||||||
inner: devices,
|
inner: devices,
|
||||||
private_identity: self.identity.clone(),
|
|
||||||
verification_machine: self.verification_machine.clone(),
|
verification_machine: self.verification_machine.clone(),
|
||||||
own_identity,
|
own_identity,
|
||||||
device_owner_identity,
|
device_owner_identity,
|
||||||
|
|
|
@ -164,7 +164,6 @@ pub struct SledStore {
|
||||||
identities: Tree,
|
identities: Tree,
|
||||||
|
|
||||||
tracked_users: Tree,
|
tracked_users: Tree,
|
||||||
users_for_key_query: Tree,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for SledStore {
|
impl std::fmt::Debug for SledStore {
|
||||||
|
@ -246,7 +245,6 @@ impl SledStore {
|
||||||
let outbound_group_sessions = db.open_tree("outbound_group_sessions")?;
|
let outbound_group_sessions = db.open_tree("outbound_group_sessions")?;
|
||||||
|
|
||||||
let tracked_users = db.open_tree("tracked_users")?;
|
let tracked_users = db.open_tree("tracked_users")?;
|
||||||
let users_for_key_query = db.open_tree("users_for_key_query")?;
|
|
||||||
let olm_hashes = db.open_tree("olm_hashes")?;
|
let olm_hashes = db.open_tree("olm_hashes")?;
|
||||||
|
|
||||||
let devices = db.open_tree("devices")?;
|
let devices = db.open_tree("devices")?;
|
||||||
|
@ -283,7 +281,6 @@ impl SledStore {
|
||||||
secret_requests_by_info,
|
secret_requests_by_info,
|
||||||
devices,
|
devices,
|
||||||
tracked_users,
|
tracked_users,
|
||||||
users_for_key_query,
|
|
||||||
olm_hashes,
|
olm_hashes,
|
||||||
identities,
|
identities,
|
||||||
})
|
})
|
||||||
|
|
|
@ -80,7 +80,6 @@ pub enum ScanError {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct QrVerification {
|
pub struct QrVerification {
|
||||||
flow_id: FlowId,
|
flow_id: FlowId,
|
||||||
store: VerificationStore,
|
|
||||||
inner: Arc<QrVerificationData>,
|
inner: Arc<QrVerificationData>,
|
||||||
state: Arc<Mutex<InnerState>>,
|
state: Arc<Mutex<InnerState>>,
|
||||||
identities: IdentitiesBeingVerified,
|
identities: IdentitiesBeingVerified,
|
||||||
|
@ -429,7 +428,6 @@ impl QrVerification {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn new_self(
|
pub(crate) fn new_self(
|
||||||
store: VerificationStore,
|
|
||||||
flow_id: FlowId,
|
flow_id: FlowId,
|
||||||
own_master_key: String,
|
own_master_key: String,
|
||||||
other_device_key: String,
|
other_device_key: String,
|
||||||
|
@ -447,7 +445,7 @@ impl QrVerification {
|
||||||
)
|
)
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
Self::new_helper(store, flow_id, inner, identities, we_started, request_handle)
|
Self::new_helper(flow_id, inner, identities, we_started, request_handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn new_self_no_master(
|
pub(crate) fn new_self_no_master(
|
||||||
|
@ -468,11 +466,10 @@ impl QrVerification {
|
||||||
)
|
)
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
Self::new_helper(store, flow_id, inner, identities, we_started, request_handle)
|
Self::new_helper(flow_id, inner, identities, we_started, request_handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn new_cross(
|
pub(crate) fn new_cross(
|
||||||
store: VerificationStore,
|
|
||||||
flow_id: FlowId,
|
flow_id: FlowId,
|
||||||
own_master_key: String,
|
own_master_key: String,
|
||||||
other_master_key: String,
|
other_master_key: String,
|
||||||
|
@ -491,7 +488,7 @@ impl QrVerification {
|
||||||
let inner: QrVerificationData =
|
let inner: QrVerificationData =
|
||||||
VerificationData::new(event_id, own_master_key, other_master_key, secret).into();
|
VerificationData::new(event_id, own_master_key, other_master_key, secret).into();
|
||||||
|
|
||||||
Self::new_helper(store, flow_id, inner, identities, we_started, request_handle)
|
Self::new_helper(flow_id, inner, identities, we_started, request_handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
@ -585,7 +582,6 @@ impl QrVerification {
|
||||||
let own_device_id = store.account.device_id().to_owned();
|
let own_device_id = store.account.device_id().to_owned();
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
store,
|
|
||||||
flow_id,
|
flow_id,
|
||||||
inner: qr_code.into(),
|
inner: qr_code.into(),
|
||||||
state: Mutex::new(InnerState::Reciprocated(QrState {
|
state: Mutex::new(InnerState::Reciprocated(QrState {
|
||||||
|
@ -599,7 +595,6 @@ impl QrVerification {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_helper(
|
fn new_helper(
|
||||||
store: VerificationStore,
|
|
||||||
flow_id: FlowId,
|
flow_id: FlowId,
|
||||||
inner: QrVerificationData,
|
inner: QrVerificationData,
|
||||||
identities: IdentitiesBeingVerified,
|
identities: IdentitiesBeingVerified,
|
||||||
|
@ -609,7 +604,6 @@ impl QrVerification {
|
||||||
let secret = inner.secret().to_owned();
|
let secret = inner.secret().to_owned();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
store,
|
|
||||||
flow_id,
|
flow_id,
|
||||||
inner: inner.into(),
|
inner: inner.into(),
|
||||||
state: Mutex::new(InnerState::Created(QrState { state: Created { secret } })).into(),
|
state: Mutex::new(InnerState::Created(QrState { state: Created { secret } })).into(),
|
||||||
|
@ -851,7 +845,6 @@ mod test {
|
||||||
assert_eq!(verification.inner.second_key(), &master_key);
|
assert_eq!(verification.inner.second_key(), &master_key);
|
||||||
|
|
||||||
let verification = QrVerification::new_self(
|
let verification = QrVerification::new_self(
|
||||||
store.clone(),
|
|
||||||
flow_id,
|
flow_id,
|
||||||
master_key.clone(),
|
master_key.clone(),
|
||||||
device_key.clone(),
|
device_key.clone(),
|
||||||
|
@ -870,7 +863,6 @@ mod test {
|
||||||
let flow_id = FlowId::InRoom(room_id!("!test:example"), event_id!("$EVENTID"));
|
let flow_id = FlowId::InRoom(room_id!("!test:example"), event_id!("$EVENTID"));
|
||||||
|
|
||||||
let verification = QrVerification::new_cross(
|
let verification = QrVerification::new_cross(
|
||||||
store.clone(),
|
|
||||||
flow_id,
|
flow_id,
|
||||||
master_key.clone(),
|
master_key.clone(),
|
||||||
bob_master_key.clone(),
|
bob_master_key.clone(),
|
||||||
|
@ -972,6 +964,7 @@ mod test {
|
||||||
assert!(bob_verification.is_done());
|
assert!(bob_verification.is_done());
|
||||||
|
|
||||||
let identity = alice_verification
|
let identity = alice_verification
|
||||||
|
.identities
|
||||||
.store
|
.store
|
||||||
.get_user_identity(alice_account.user_id())
|
.get_user_identity(alice_account.user_id())
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -999,7 +999,6 @@ impl RequestState<Ready> {
|
||||||
identites.other_device().get_key(DeviceKeyAlgorithm::Ed25519)
|
identites.other_device().get_key(DeviceKeyAlgorithm::Ed25519)
|
||||||
{
|
{
|
||||||
Some(QrVerification::new_self(
|
Some(QrVerification::new_self(
|
||||||
self.store.clone(),
|
|
||||||
self.flow_id.as_ref().to_owned(),
|
self.flow_id.as_ref().to_owned(),
|
||||||
master_key.to_owned(),
|
master_key.to_owned(),
|
||||||
device_key.to_owned(),
|
device_key.to_owned(),
|
||||||
|
@ -1048,7 +1047,6 @@ impl RequestState<Ready> {
|
||||||
.and_then(|m| m.get_first_key().map(|m| m.to_owned()))
|
.and_then(|m| m.get_first_key().map(|m| m.to_owned()))
|
||||||
{
|
{
|
||||||
Some(QrVerification::new_cross(
|
Some(QrVerification::new_cross(
|
||||||
self.store.clone(),
|
|
||||||
self.flow_id.as_ref().to_owned(),
|
self.flow_id.as_ref().to_owned(),
|
||||||
own_master,
|
own_master,
|
||||||
other_master.to_owned(),
|
other_master.to_owned(),
|
||||||
|
@ -1251,6 +1249,7 @@ impl RequestState<Ready> {
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct Passive {
|
struct Passive {
|
||||||
/// The device id of the device that responded to the verification request.
|
/// The device id of the device that responded to the verification request.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub other_device_id: DeviceIdBox,
|
pub other_device_id: DeviceIdBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -665,7 +665,7 @@ impl SasState<WeAccepted> {
|
||||||
last_event_time: Instant::now().into(),
|
last_event_time: Instant::now().into(),
|
||||||
started_from_request: self.started_from_request,
|
started_from_request: self.started_from_request,
|
||||||
state: Arc::new(KeyReceived {
|
state: Arc::new(KeyReceived {
|
||||||
we_started: false,
|
we_started: self.state.we_started,
|
||||||
their_pubkey,
|
their_pubkey,
|
||||||
accepted_protocols: self.state.accepted_protocols.clone(),
|
accepted_protocols: self.state.accepted_protocols.clone(),
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue