diff --git a/apps/vault/locales/i18n.json b/apps/vault/locales/i18n.json index d88e37d53..ae9952958 100644 --- a/apps/vault/locales/i18n.json +++ b/apps/vault/locales/i18n.json @@ -5,6 +5,18 @@ "zh": "秒 直到中止", "en-tts": "s until abort" }, + "vault.fido.pin_uv_auth": { + "en": "FIDO host is creating a PIN.\nPress any key to accept.", + "ja": "FIDOホストがPINを作成しています。\n任意のキーを押して受け入れます。", + "zh": "FIDO 主机正在创建 PIN。\n按任意键接受。", + "en-tts": "FIDO host is creating a PIN.\nPress any key to accept." + }, + "vault.fido.next_assertion": { + "en": "This site is requires multiple credentials.\nPress any key to allow the next credential.", + "ja": "このサイトには複数のクレデンシャルが必要です。\n次のクレデンシャルを許可するには、任意のキーを押してください。", + "zh": "此站点需要多个凭据。\n按任意键以允许下一个凭据。", + "en-tts": "This site is requires multiple credentials.\nPress any key to allow the next credential." + }, "vault.fido.make_credential": { "en": "FIDO Make Credential Request.\nPress any key to approve.", "ja": "FIDOは資格情報を要求します\n承認するには任意のキーを押してください", diff --git a/apps/vault/src/ctap/mod.rs b/apps/vault/src/ctap/mod.rs index 928e3179d..34928c1c9 100644 --- a/apps/vault/src/ctap/mod.rs +++ b/apps/vault/src/ctap/mod.rs @@ -397,7 +397,9 @@ where // This case was added in FIDO 2.1. if auth_param.is_empty() { //(self.check_user_presence)(cid)?; - if crate::ux::request_permission_blocking("pin_uv_auth_precheck".to_string(), cid).is_none() { + if crate::ux::request_permission_blocking( + t!("vault.fido.pin_uv_auth", xous::LANG).to_string(), + cid).is_none() { return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED) } if self.persistent_store.pin_hash()?.is_none() { @@ -859,7 +861,10 @@ where _now: ClockValue, ) -> Result { //self.check_command_permission(now)?; - if crate::ux::request_permission_blocking("GetAssertion".to_string(), [0xff, 0xff, 0xff, 0xff]).is_none() { + if crate::ux::request_permission_blocking( + t!("vault.fido.next_assertion", xous::LANG).to_string(), + [0xff, 0xff, 0xff, 0xff] + ).is_none() { return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED); } let (assertion_input, credential) = @@ -931,6 +936,9 @@ where ) } + pub fn unplug_reset(&mut self) { + self.pin_protocol_v1.reset(self.rng); + } fn process_reset( &mut self, cid: ChannelID, @@ -939,7 +947,7 @@ where // Resets are only possible in the first 10 seconds after booting. // TODO(kaczmarczyck) 2.1 allows Reset after Reset and 15 seconds? // self.check_command_permission(now)?; - if let Some(c) = crate::ux::request_permission_blocking(locales::t!("vault.u2f.factoryreset", xous::LANG).to_string(), cid) { + if let Some(c) = crate::ux::request_permission_blocking(t!("vault.u2f.factoryreset", xous::LANG).to_string(), cid) { if c != 'y' { return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED) } @@ -952,6 +960,7 @@ where _ => return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED), } //(self.check_user_presence)(cid)?; + // we skip the double-confirmation during autotesting, but leave it here for production #[cfg(not(feature="autotest"))] if crate::ux::request_permission_blocking(t!("vault.u2f.reset_check", xous::LANG).to_string(), cid).is_none() { return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED) diff --git a/apps/vault/src/main.rs b/apps/vault/src/main.rs index 9e58e24ae..5d2f22185 100644 --- a/apps/vault/src/main.rs +++ b/apps/vault/src/main.rs @@ -115,7 +115,15 @@ fn main() -> ! { } } Err(e) => { - log::warn!("FIDO listener got an error: {:?}", e); + match e { + xous::Error::ProcessTerminated => { // unplug happened, reset the authenticator + log::info!("CTAP unplug_reset"); + ctap_state.unplug_reset(); + }, + _ => { + log::warn!("FIDO listener got an error: {:?}", e); + } + } } } } diff --git a/apps/vault/src/ux.rs b/apps/vault/src/ux.rs index a94545e8e..a218e97a9 100644 --- a/apps/vault/src/ux.rs +++ b/apps/vault/src/ux.rs @@ -130,8 +130,8 @@ pub(crate) fn start_ux_thread() { let mut app_info: Option = None; let pddb = pddb::Pddb::new(); pddb.is_mounted_blocking(); - //#[cfg(feature="autotest")] - //modals.show_notification("WARNING: FIDO configured for autotest. Do not use for production!", None).unwrap(); + #[cfg(feature="autotest")] + modals.show_notification("WARNING: FIDO configured for autotest. Do not use for production!", None).unwrap(); let mut num_fido_auths = 0; // only counts FIDO2 flow auths, not U2F auths loop { let mut msg = xous::receive_message(sid).unwrap(); @@ -403,15 +403,7 @@ pub(crate) fn start_ux_thread() { last_timer = new_timer; } } - // check if we got a hit - //#[cfg(not(feature="autotest"))] let key_hit = kbhit.load(Ordering::SeqCst); - /*#[cfg(feature="autotest")] - let key_hit = if num_fido_auths != 82 { // 82 is the test number of "don't touch it" - 'y' as u32 - } else { - 0 - };*/ if key_hit != 0 { num_fido_auths += 1; log::info!("got user presence! count: {}", num_fido_auths);