rust-sdk: Remove a bunch of unused imports and unused variables.
parent
2e1add049d
commit
12dc5212e3
|
@ -20,8 +20,7 @@ use std::result::Result as StdResult;
|
|||
use std::sync::Arc;
|
||||
|
||||
use super::error::{OlmError, Result, SignatureError, VerificationResult};
|
||||
use super::memory_stores::SessionStore;
|
||||
use super::olm::{Account, InboundGroupSession, Session};
|
||||
use super::olm::{Account, InboundGroupSession};
|
||||
use super::store::memorystore::MemoryStore;
|
||||
#[cfg(feature = "sqlite-cryptostore")]
|
||||
use super::store::sqlite::SqliteStore;
|
||||
|
@ -364,15 +363,16 @@ impl OlmMachine {
|
|||
continue;
|
||||
}
|
||||
|
||||
let curve_key_id =
|
||||
AlgorithmAndDeviceId(KeyAlgorithm::Curve25519, device_id.to_owned());
|
||||
// let curve_key_id =
|
||||
// AlgorithmAndDeviceId(KeyAlgorithm::Curve25519, device_id.to_owned());
|
||||
let ed_key_id = AlgorithmAndDeviceId(KeyAlgorithm::Ed25519, device_id.to_owned());
|
||||
|
||||
let sender_key = if let Some(k) = device_keys.keys.get(&curve_key_id) {
|
||||
k
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
// TODO check if the curve key changed for an existing device.
|
||||
// let sender_key = if let Some(k) = device_keys.keys.get(&curve_key_id) {
|
||||
// k
|
||||
// } else {
|
||||
// continue;
|
||||
// };
|
||||
|
||||
let signing_key = if let Some(k) = device_keys.keys.get(&ed_key_id) {
|
||||
k
|
||||
|
@ -397,7 +397,7 @@ impl OlmMachine {
|
|||
.await
|
||||
.expect("Can't load device");
|
||||
|
||||
if let Some(d) = device {
|
||||
if let Some(_d) = device {
|
||||
// TODO check what and if anything changed for the device.
|
||||
} else {
|
||||
let device = Device::from(device_keys);
|
||||
|
@ -412,7 +412,7 @@ impl OlmMachine {
|
|||
|
||||
let deleted_devices = stored_devices_set.difference(¤t_devices);
|
||||
|
||||
for device_id in deleted_devices {
|
||||
for _device_id in deleted_devices {
|
||||
// TODO delete devices here.
|
||||
}
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ impl OlmMachine {
|
|||
|
||||
async fn decrypt_olm_message(
|
||||
&mut self,
|
||||
sender: &str,
|
||||
_sender: &str,
|
||||
sender_key: &str,
|
||||
message: OlmMessage,
|
||||
) -> Result<EventResult<ToDeviceEvent>> {
|
||||
|
@ -785,8 +785,8 @@ impl OlmMachine {
|
|||
|
||||
fn add_forwarded_room_key(
|
||||
&self,
|
||||
sender_key: &str,
|
||||
event: &ToDeviceForwardedRoomKey,
|
||||
_sender_key: &str,
|
||||
_event: &ToDeviceForwardedRoomKey,
|
||||
) -> Result<()> {
|
||||
Ok(())
|
||||
// TODO
|
||||
|
|
|
@ -40,7 +40,7 @@ impl SessionStore {
|
|||
Arc::new(Mutex::new(Vec::new())),
|
||||
);
|
||||
}
|
||||
let mut sessions = self.entries.get_mut(&session.sender_key).unwrap();
|
||||
let sessions = self.entries.get_mut(&session.sender_key).unwrap();
|
||||
let session = Arc::new(Mutex::new(session));
|
||||
sessions.lock().await.push(session.clone());
|
||||
|
||||
|
@ -75,13 +75,13 @@ impl GroupSessionStore {
|
|||
.insert(session.room_id.to_owned(), HashMap::new());
|
||||
}
|
||||
|
||||
let mut room_map = self.entries.get_mut(&session.room_id).unwrap();
|
||||
let room_map = self.entries.get_mut(&session.room_id).unwrap();
|
||||
|
||||
if !room_map.contains_key(&session.sender_key) {
|
||||
room_map.insert(session.sender_key.to_owned(), HashMap::new());
|
||||
}
|
||||
|
||||
let mut sender_map = room_map.get_mut(&session.sender_key).unwrap();
|
||||
let sender_map = room_map.get_mut(&session.sender_key).unwrap();
|
||||
let ret = sender_map.insert(session.session_id(), Arc::new(Mutex::new(session)));
|
||||
|
||||
ret.is_some()
|
||||
|
@ -134,7 +134,7 @@ impl DeviceStore {
|
|||
self.entries
|
||||
.insert(device.user_id().to_owned(), DashMap::new());
|
||||
}
|
||||
let mut device_map = self.entries.get_mut(device.user_id()).unwrap();
|
||||
let device_map = self.entries.get_mut(device.user_id()).unwrap();
|
||||
|
||||
device_map
|
||||
.insert(device.device_id().to_owned(), device)
|
||||
|
|
|
@ -259,7 +259,7 @@ impl InboundGroupSession {
|
|||
self.inner.first_known_index()
|
||||
}
|
||||
|
||||
pub fn decrypt(&self, mut message: String) -> Result<(String, u32), OlmGroupSessionError> {
|
||||
pub fn decrypt(&self, message: String) -> Result<(String, u32), OlmGroupSessionError> {
|
||||
self.inner.decrypt(message)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use std::sync::Arc;
|
|||
use async_trait::async_trait;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use super::{Account, CryptoStore, CryptoStoreError, InboundGroupSession, Result, Session};
|
||||
use super::{Account, CryptoStore, InboundGroupSession, Result, Session};
|
||||
use crate::crypto::device::Device;
|
||||
use crate::crypto::memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices};
|
||||
|
||||
|
@ -47,11 +47,11 @@ impl CryptoStore for MemoryStore {
|
|||
Ok(None)
|
||||
}
|
||||
|
||||
async fn save_account(&mut self, account: Arc<Mutex<Account>>) -> Result<()> {
|
||||
async fn save_account(&mut self, _: Arc<Mutex<Account>>) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn save_session(&mut self, session: Arc<Mutex<Session>>) -> Result<()> {
|
||||
async fn save_session(&mut self, _: Arc<Mutex<Session>>) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,8 @@
|
|||
// limitations under the License.
|
||||
|
||||
use core::fmt::Debug;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::HashSet;
|
||||
use std::io::Error as IoError;
|
||||
use std::result::Result as StdResult;
|
||||
use std::sync::Arc;
|
||||
use url::ParseError;
|
||||
|
||||
|
@ -28,7 +27,6 @@ use super::device::Device;
|
|||
use super::memory_stores::UserDevices;
|
||||
use super::olm::{Account, InboundGroupSession, Session};
|
||||
use olm_rs::errors::{OlmAccountError, OlmGroupSessionError, OlmSessionError};
|
||||
use olm_rs::PicklingMode;
|
||||
|
||||
pub mod memorystore;
|
||||
#[cfg(feature = "sqlite-cryptostore")]
|
||||
|
|
|
@ -410,15 +410,15 @@ impl CryptoStore for SqliteStore {
|
|||
Ok(self.tracked_users.insert(user.to_string()))
|
||||
}
|
||||
|
||||
async fn get_device(&self, user_id: &str, device_id: &str) -> Result<Option<Device>> {
|
||||
async fn get_device(&self, _user_id: &str, _device_id: &str) -> Result<Option<Device>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
async fn get_user_devices(&self, user_id: &str) -> Result<UserDevices> {
|
||||
async fn get_user_devices(&self, _user_id: &str) -> Result<UserDevices> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
async fn save_device(&self, device: Device) -> Result<()> {
|
||||
async fn save_device(&self, _device: Device) -> Result<()> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,14 +31,6 @@ use crate::identifiers::RoomAliasId;
|
|||
|
||||
use js_int::UInt;
|
||||
|
||||
#[cfg(feature = "encryption")]
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
#[cfg(feature = "encryption")]
|
||||
use crate::crypto::{OlmMachine, OneTimeKeys};
|
||||
#[cfg(feature = "encryption")]
|
||||
use ruma_client_api::r0::keys::{upload_keys::Response as KeysUploadResponse, DeviceKeys};
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
/// `RoomName` allows the calculation of a text room name.
|
||||
pub struct RoomName {
|
||||
|
|
|
@ -24,13 +24,6 @@ use crate::events::room::{
|
|||
use crate::identifiers::UserId;
|
||||
|
||||
use js_int::Int;
|
||||
#[cfg(feature = "encryption")]
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
#[cfg(feature = "encryption")]
|
||||
use crate::crypto::{OlmMachine, OneTimeKeys};
|
||||
#[cfg(feature = "encryption")]
|
||||
use ruma_client_api::r0::keys::{upload_keys::Response as KeysUploadResponse, DeviceKeys};
|
||||
|
||||
// Notes: if Alice invites Bob into a room we will get an event with the sender as Alice and the state key as Bob.
|
||||
|
||||
|
|
|
@ -18,13 +18,6 @@ use crate::events::presence::{PresenceEvent, PresenceEventContent, PresenceState
|
|||
use crate::events::room::member::MemberEvent;
|
||||
|
||||
use js_int::UInt;
|
||||
#[cfg(feature = "encryption")]
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
#[cfg(feature = "encryption")]
|
||||
use crate::crypto::{OlmMachine, OneTimeKeys};
|
||||
#[cfg(feature = "encryption")]
|
||||
use ruma_client_api::r0::keys::{upload_keys::Response as KeysUploadResponse, DeviceKeys};
|
||||
|
||||
#[derive(Debug)]
|
||||
/// A Matrix room member.
|
||||
|
|
Loading…
Reference in New Issue