diff --git a/apps/vault/libraries/persistent_store/src/store.rs b/apps/vault/libraries/persistent_store/src/store.rs index 25dbae758..8241dfc1c 100644 --- a/apps/vault/libraries/persistent_store/src/store.rs +++ b/apps/vault/libraries/persistent_store/src/store.rs @@ -278,13 +278,13 @@ impl Store { match *update { StoreUpdate::Insert { key, ref value } => { // if it exists, remove the key; if it doesn't exist, ignore the error - log::debug!("delete key: {}:{}", crate::store::OPENSK2_DICT, key.to_string()); + log::debug!("pre-delete key: {}:{}", crate::store::OPENSK2_DICT, key.to_string()); self.pddb.delete_key( crate::store::OPENSK2_DICT, &key.to_string(), None ).ok(); - log::debug!("access key: {}:{}", crate::store::OPENSK2_DICT, key.to_string()); + log::debug!("write key: {}:{}", crate::store::OPENSK2_DICT, key.to_string()); match self.pddb.get( crate::store::OPENSK2_DICT, &key.to_string(), @@ -308,11 +308,21 @@ impl Store { } } StoreUpdate::Remove { key } => { - self.pddb.delete_key( + log::debug!("remove key: {}:{}", crate::store::OPENSK2_DICT, key.to_string()); + match self.pddb.delete_key( crate::store::OPENSK2_DICT, &key.to_string(), None - ).map_err(|_|StoreError::StorageError)? + ) { + Ok(_) => {}, + Err(e) => match e.kind() { + std::io::ErrorKind::NotFound => {}, + _ => { + log::warn!("Encountered error in StorageUpdate::Remove: {:?}", e); + return Err(StoreError::StorageError) + }, + } + } } } } @@ -363,6 +373,7 @@ impl Store { /// Returns the value of an entry given its key. pub fn find(&self, key: usize) -> StoreResult>> { + log::debug!("find key: {}", key); match self.pddb.get( crate::store::OPENSK2_DICT, &key.to_string(), @@ -453,14 +464,14 @@ impl Store { let attr = record.attributes().map_err(|_| StoreError::StorageError)?; Ok(attr.len) } - _ => Err(StoreError::StorageError) + _ => Err(StoreError::InvalidArgument) // key didn't exist } } fn get_value(&self, handle: &StoreHandle) -> StoreResult> { self.find( handle.key - ).map(|val| val.ok_or(StoreError::StorageError))? + ).map(|val| val.ok_or(StoreError::InvalidArgument))? } } diff --git a/apps/vault/src/ctap/mod.rs b/apps/vault/src/ctap/mod.rs index c1cc76aea..2ed1db10c 100644 --- a/apps/vault/src/ctap/mod.rs +++ b/apps/vault/src/ctap/mod.rs @@ -1385,6 +1385,7 @@ impl CtapState { env: &mut impl Env, channel: Channel, ) -> Result { + #[cfg(not(feature="autotest"))] match self.stateful_command_permission.get_command()? { StatefulCommand::Reset => (), _ => return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED), diff --git a/apps/vault/src/env/xous/mod.rs b/apps/vault/src/env/xous/mod.rs index 40e2ccf90..97ec8e68c 100644 --- a/apps/vault/src/env/xous/mod.rs +++ b/apps/vault/src/env/xous/mod.rs @@ -433,7 +433,7 @@ impl XousEnv { } Err(_) => panic!("Error sending KEEPALIVE packet"), Ok(SendOrRecvStatus::Sent) => { - log::debug!("Sent KEEPALIVE packet"); + log::trace!("Sent KEEPALIVE packet"); } Ok(SendOrRecvStatus::Received) => { // We only parse one packet, because we only care about CANCEL. @@ -478,6 +478,7 @@ impl UserPresence for XousEnv { } /// Implements FIDO behavior (CTAP2 protocol) fn wait_with_timeout(&mut self, timeout: Duration, reason: Option::, cid: [u8; 4]) -> UserPresenceResult { + log::info!("{}VAULT.PERMISSION,{}", xous::BOOKEND_START, xous::BOOKEND_END); let reason = reason.unwrap_or(String::new()); let kbhit = Arc::new(AtomicU32::new(0)); let expiration = Instant::now().checked_add(timeout).expect("duration bug"); @@ -511,6 +512,7 @@ impl UserPresence for XousEnv { let mut request_str = String::from(&reason); let remaining = expiration.duration_since(Instant::now()).as_secs(); if last_remaining != remaining { + log::info!("countdown: {}", remaining); // only update the UX once per second request_str.push_str( &format!("\n\n⚠ {}{} ⚠\n", diff --git a/apps/vault/src/main.rs b/apps/vault/src/main.rs index 84264404a..c869ee8af 100644 --- a/apps/vault/src/main.rs +++ b/apps/vault/src/main.rs @@ -146,7 +146,7 @@ const ERR_TIMEOUT_MS: usize = 5000; fn main() -> ! { log_server::init_wait().unwrap(); - log::set_max_level(log::LevelFilter::Debug); + log::set_max_level(log::LevelFilter::Info); log::info!("my PID is {}", xous::process::id()); let xns = xous_names::XousNames::new().unwrap();