mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
add some missing translations, and add a listener to the unplug state
This commit is contained in:
parent
a4d0cdba80
commit
3fc038cca9
4 changed files with 35 additions and 14 deletions
|
|
@ -5,6 +5,18 @@
|
||||||
"zh": "秒 直到中止",
|
"zh": "秒 直到中止",
|
||||||
"en-tts": "s until abort"
|
"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": {
|
"vault.fido.make_credential": {
|
||||||
"en": "FIDO Make Credential Request.\nPress any key to approve.",
|
"en": "FIDO Make Credential Request.\nPress any key to approve.",
|
||||||
"ja": "FIDOは資格情報を要求します\n承認するには任意のキーを押してください",
|
"ja": "FIDOは資格情報を要求します\n承認するには任意のキーを押してください",
|
||||||
|
|
|
||||||
|
|
@ -397,7 +397,9 @@ where
|
||||||
// This case was added in FIDO 2.1.
|
// This case was added in FIDO 2.1.
|
||||||
if auth_param.is_empty() {
|
if auth_param.is_empty() {
|
||||||
//(self.check_user_presence)(cid)?;
|
//(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)
|
return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED)
|
||||||
}
|
}
|
||||||
if self.persistent_store.pin_hash()?.is_none() {
|
if self.persistent_store.pin_hash()?.is_none() {
|
||||||
|
|
@ -859,7 +861,10 @@ where
|
||||||
_now: ClockValue,
|
_now: ClockValue,
|
||||||
) -> Result<ResponseData, Ctap2StatusCode> {
|
) -> Result<ResponseData, Ctap2StatusCode> {
|
||||||
//self.check_command_permission(now)?;
|
//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);
|
return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED);
|
||||||
}
|
}
|
||||||
let (assertion_input, credential) =
|
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(
|
fn process_reset(
|
||||||
&mut self,
|
&mut self,
|
||||||
cid: ChannelID,
|
cid: ChannelID,
|
||||||
|
|
@ -939,7 +947,7 @@ where
|
||||||
// Resets are only possible in the first 10 seconds after booting.
|
// Resets are only possible in the first 10 seconds after booting.
|
||||||
// TODO(kaczmarczyck) 2.1 allows Reset after Reset and 15 seconds?
|
// TODO(kaczmarczyck) 2.1 allows Reset after Reset and 15 seconds?
|
||||||
// self.check_command_permission(now)?;
|
// 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' {
|
if c != 'y' {
|
||||||
return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED)
|
return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED)
|
||||||
}
|
}
|
||||||
|
|
@ -952,6 +960,7 @@ where
|
||||||
_ => return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED),
|
_ => return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED),
|
||||||
}
|
}
|
||||||
//(self.check_user_presence)(cid)?;
|
//(self.check_user_presence)(cid)?;
|
||||||
|
// we skip the double-confirmation during autotesting, but leave it here for production
|
||||||
#[cfg(not(feature="autotest"))]
|
#[cfg(not(feature="autotest"))]
|
||||||
if crate::ux::request_permission_blocking(t!("vault.u2f.reset_check", xous::LANG).to_string(), cid).is_none() {
|
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)
|
return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED)
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,15 @@ fn main() -> ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,8 @@ pub(crate) fn start_ux_thread() {
|
||||||
let mut app_info: Option<AppInfo> = None;
|
let mut app_info: Option<AppInfo> = None;
|
||||||
let pddb = pddb::Pddb::new();
|
let pddb = pddb::Pddb::new();
|
||||||
pddb.is_mounted_blocking();
|
pddb.is_mounted_blocking();
|
||||||
//#[cfg(feature="autotest")]
|
#[cfg(feature="autotest")]
|
||||||
//modals.show_notification("WARNING: FIDO configured for autotest. Do not use for production!", None).unwrap();
|
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
|
let mut num_fido_auths = 0; // only counts FIDO2 flow auths, not U2F auths
|
||||||
loop {
|
loop {
|
||||||
let mut msg = xous::receive_message(sid).unwrap();
|
let mut msg = xous::receive_message(sid).unwrap();
|
||||||
|
|
@ -403,15 +403,7 @@ pub(crate) fn start_ux_thread() {
|
||||||
last_timer = new_timer;
|
last_timer = new_timer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check if we got a hit
|
|
||||||
//#[cfg(not(feature="autotest"))]
|
|
||||||
let key_hit = kbhit.load(Ordering::SeqCst);
|
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 {
|
if key_hit != 0 {
|
||||||
num_fido_auths += 1;
|
num_fido_auths += 1;
|
||||||
log::info!("got user presence! count: {}", num_fido_auths);
|
log::info!("got user presence! count: {}", num_fido_auths);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue