mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add a menu item to show a test QR code
this is useful for testing inter-device QR code scanning.
This commit is contained in:
parent
3b0edbb442
commit
b84ff3d351
4 changed files with 23 additions and 0 deletions
|
|
@ -1444,6 +1444,10 @@ impl ActionManager {
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
let mut qr_str = String::from(t!("vault.error.qr", locales::LANG));
|
||||||
|
qr_str.push_str(&format!(": {}", &qr_uri));
|
||||||
|
self.modals.show_notification(&qr_str, None).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -536,6 +536,16 @@ fn main() -> ! {
|
||||||
)
|
)
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
|
Some(VaultOp::ShowQr) => {
|
||||||
|
let previous = allow_totp_rendering.load(Ordering::SeqCst);
|
||||||
|
allow_totp_rendering.store(false, Ordering::SeqCst);
|
||||||
|
let mut test_data = [0u8; 40];
|
||||||
|
let mut trng = bao1x_hal_service::trng::Trng::new(&xns).unwrap();
|
||||||
|
trng.fill_bytes_via_next(&mut test_data);
|
||||||
|
let encoded = base45::encode(&test_data);
|
||||||
|
modals.show_notification("", Some(&encoded)).ok();
|
||||||
|
allow_totp_rendering.store(previous, Ordering::SeqCst);
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log::error!("Got unknown message: {:?}", msg);
|
log::error!("Got unknown message: {:?}", msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,13 @@ pub fn create_submenu(vault_conn: xous::CID, actions_conn: xous::CID, menu_mgr:
|
||||||
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
||||||
close_on_select: true,
|
close_on_select: true,
|
||||||
});
|
});
|
||||||
|
menu_items.push(MenuItem {
|
||||||
|
name: String::from("Test QR code"),
|
||||||
|
action_conn: Some(vault_conn),
|
||||||
|
action_opcode: VaultOp::ShowQr.to_u32().unwrap(),
|
||||||
|
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
||||||
|
close_on_select: true,
|
||||||
|
});
|
||||||
menu_items.push(MenuItem {
|
menu_items.push(MenuItem {
|
||||||
name: String::from(t!("vault.menu_close", locales::LANG)),
|
name: String::from(t!("vault.menu_close", locales::LANG)),
|
||||||
action_conn: Some(actions_conn),
|
action_conn: Some(actions_conn),
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ pub(crate) enum VaultOp {
|
||||||
MenuPwMode,
|
MenuPwMode,
|
||||||
|
|
||||||
BasisChange,
|
BasisChange,
|
||||||
|
|
||||||
|
ShowQr,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn atime_to_str(req_atime: u64) -> String {
|
pub fn atime_to_str(req_atime: u64) -> String {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue