mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
chore(vault): address warnings
This commit is contained in:
parent
51b04fe14e
commit
473e1cf77b
3 changed files with 13 additions and 10 deletions
|
|
@ -122,7 +122,10 @@ pub(crate) fn start_actions_thread(
|
||||||
struct ActionManager {
|
struct ActionManager {
|
||||||
modals: modals::Modals,
|
modals: modals::Modals,
|
||||||
storage: RefCell<storage::Manager>,
|
storage: RefCell<storage::Manager>,
|
||||||
|
|
||||||
|
#[cfg(feature="testing")]
|
||||||
trng: RefCell::<trng::Trng>,
|
trng: RefCell::<trng::Trng>,
|
||||||
|
|
||||||
mode: Arc::<Mutex::<VaultMode>>,
|
mode: Arc::<Mutex::<VaultMode>>,
|
||||||
item_list: Arc::<Mutex::<Vec::<ListItem>>>,
|
item_list: Arc::<Mutex::<Vec::<ListItem>>>,
|
||||||
pddb: RefCell::<pddb::Pddb>,
|
pddb: RefCell::<pddb::Pddb>,
|
||||||
|
|
@ -145,7 +148,10 @@ impl ActionManager {
|
||||||
ActionManager {
|
ActionManager {
|
||||||
modals: modals::Modals::new(&xns).unwrap(),
|
modals: modals::Modals::new(&xns).unwrap(),
|
||||||
storage: RefCell::new(storage_manager),
|
storage: RefCell::new(storage_manager),
|
||||||
|
|
||||||
|
#[cfg(feature="testing")]
|
||||||
trng: RefCell::new(trng::Trng::new(&xns).unwrap()),
|
trng: RefCell::new(trng::Trng::new(&xns).unwrap()),
|
||||||
|
|
||||||
mode_cache: mc,
|
mode_cache: mc,
|
||||||
mode,
|
mode,
|
||||||
item_list,
|
item_list,
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ impl Manager {
|
||||||
record: &mut dyn StorageContent,
|
record: &mut dyn StorageContent,
|
||||||
basis: Option<String>,
|
basis: Option<String>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let mut record = record;
|
let record = record;
|
||||||
let settings = record.settings();
|
let settings = record.settings();
|
||||||
record.set_ctime(utc_now().timestamp() as u64);
|
record.set_ctime(utc_now().timestamp() as u64);
|
||||||
let serialized_record: Vec<u8> = record.to_vec();
|
let serialized_record: Vec<u8> = record.to_vec();
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ impl VendorSession {
|
||||||
fn reset(&mut self) {
|
fn reset(&mut self) {
|
||||||
*self = VendorSession::default()
|
*self = VendorSession::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_from_wire(
|
fn read_from_wire(
|
||||||
&mut self,
|
&mut self,
|
||||||
w: backup::Wire,
|
w: backup::Wire,
|
||||||
command: u8,
|
command: u8,
|
||||||
channel_id: ChannelID,
|
|
||||||
) -> Result<(), SessionError> {
|
) -> Result<(), SessionError> {
|
||||||
self.data.append(&mut w.data.clone());
|
self.data.append(&mut w.data.clone());
|
||||||
self.finished = !w.more_data;
|
self.finished = !w.more_data;
|
||||||
|
|
@ -76,7 +76,7 @@ impl VendorSession {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut b = self.backup_chunks.as_mut().unwrap();
|
let b = self.backup_chunks.as_mut().unwrap();
|
||||||
|
|
||||||
b.pop()
|
b.pop()
|
||||||
}
|
}
|
||||||
|
|
@ -102,6 +102,7 @@ pub fn handle_vendor_data(
|
||||||
) -> Result<Option<HidPacketIterator>, SessionError> {
|
) -> Result<Option<HidPacketIterator>, SessionError> {
|
||||||
if cmd == COMMAND_RESET_SESSION {
|
if cmd == COMMAND_RESET_SESSION {
|
||||||
log::debug!("resetting session");
|
log::debug!("resetting session");
|
||||||
|
current_state.reset();
|
||||||
return Ok(Some(
|
return Ok(Some(
|
||||||
HidPacketIterator::new(Message {
|
HidPacketIterator::new(Message {
|
||||||
cid: channel_id,
|
cid: channel_id,
|
||||||
|
|
@ -151,7 +152,7 @@ pub fn handle_vendor_data(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
current_state.read_from_wire(wire_data, cmd, channel_id)?;
|
current_state.read_from_wire(wire_data, cmd)?;
|
||||||
|
|
||||||
log::debug!("state.finished(): {:?}", current_state.finished());
|
log::debug!("state.finished(): {:?}", current_state.finished());
|
||||||
match current_state.finished() {
|
match current_state.finished() {
|
||||||
|
|
@ -215,10 +216,6 @@ pub fn handle_vendor_command(session: &mut VendorSession) -> HidPacketIterator {
|
||||||
HidPacketIterator::new(payload).unwrap()
|
HidPacketIterator::new(payload).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_benchmark() -> Vec<u8> {
|
|
||||||
vec![0xDE, 0xAD, 0xBE, 0xEF]
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum BackupError {
|
enum BackupError {
|
||||||
CborError(DecoderError),
|
CborError(DecoderError),
|
||||||
|
|
@ -264,7 +261,7 @@ fn handle_restore(data: Vec<u8>, xns: &xous_names::XousNames) -> Result<Vec<u8>,
|
||||||
log::debug!("restoring totp");
|
log::debug!("restoring totp");
|
||||||
for (idx, elem) in totp_entries.0.into_iter().enumerate() {
|
for (idx, elem) in totp_entries.0.into_iter().enumerate() {
|
||||||
log::debug!("restoring element {}", idx);
|
log::debug!("restoring element {}", idx);
|
||||||
let mut totp = TotpRecord {
|
let totp = TotpRecord {
|
||||||
version: 1,
|
version: 1,
|
||||||
name: elem.name,
|
name: elem.name,
|
||||||
secret: elem.shared_secret,
|
secret: elem.shared_secret,
|
||||||
|
|
@ -285,7 +282,7 @@ fn handle_restore(data: Vec<u8>, xns: &xous_names::XousNames) -> Result<Vec<u8>,
|
||||||
log::debug!("restoring password");
|
log::debug!("restoring password");
|
||||||
for (idx, elem) in password_entries.0.into_iter().enumerate() {
|
for (idx, elem) in password_entries.0.into_iter().enumerate() {
|
||||||
log::debug!("restoring element {}", idx);
|
log::debug!("restoring element {}", idx);
|
||||||
let mut password = PasswordRecord {
|
let password = PasswordRecord {
|
||||||
version: 1,
|
version: 1,
|
||||||
description: elem.description,
|
description: elem.description,
|
||||||
username: elem.username,
|
username: elem.username,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue