add bip39 password entry prompt

This commit is contained in:
bunnie 2023-05-17 04:12:25 +08:00
parent fa05e8b033
commit d6a87666ab
3 changed files with 15 additions and 7 deletions

View file

@ -380,7 +380,7 @@ perform the Xous firmware upgrade. This requires running manual update commands,
## New in 0.9.14
- `gdb-stub` on hardware is now quite reliable, thanks to some performance improvements by @xobs. Just remember that single stepping does not work on XIP images (and by default now, apps are compiled as `xip`)
- "Notes" fields in `vault` app that start with the keyword 'bip39' will trigger a BIP39 password entry box (if the password field is blank), or BIP39 rendering of the hex data.
- "Notes" fields in `vault` app that start with the keyword 'bip39' will trigger a BIP39 password entry box (if the password field is blank), or BIP39 rendering of the hex data. Password generation prompt also uses the password 'bip39' to trigger the BIP39 generation sequence. It does mean that you can't use just 'bip39' as a regular password but...
## Roadmap
- Lots of testing and bug fixes

View file

@ -364,11 +364,11 @@
"zh": "数字"
},
"vault.newitem.password": {
"en": "Hit enter to accept the suggestion, or start typing to create your own.\n\nLeave blank to customize the generator.\n",
"en-tts": "Hit enter to accept the suggestion, or start typing to create your own.\n\nLeave blank to customize the generator.\n",
"fr": "Appuyez sur Entrée pour accepter la suggestion, ou commencez à taper pour créer le votre.\n\nLaissez vide pour personnaliser le générateur.\n",
"ja": "Enterキーを押して提案を受け入れるか、入力を開始して独自の提案を作成します。\n\n空白のままにしてジェネレータをカスタマイズします。\n",
"zh": "按 Enter 接受建议,或开始输入以创建您自己的建议。\n\n留空以自定义生成器。\n"
"en": "Hit enter to accept the suggestion, or start typing to create your own.\n\nLeave blank to customize the generator, or type 'bip39'.\n",
"en-tts": "Hit enter to accept the suggestion, or start typing to create your own.\n\nLeave blank to customize the generator, or type 'bip39'.\n",
"fr": "Appuyez sur Entrée pour accepter la suggestion, ou commencez à taper pour créer le votre.\n\nLaissez vide pour personnaliser le générateur, ou tapez 'bip39'.\n",
"ja": "Enterキーを押して提案を受け入れるか、入力を開始して独自の提案を作成します。\n\n空白のままにしてジェネレータをカスタマイズします, または「bip39」と入力します\n",
"zh": "按 Enter 接受建议,或开始输入以创建您自己的建议。\n\n留空以自定义生成器, 或输入“bip39”。\n"
},
"vault.newitem.symbols": {
"en": "Symbols",

View file

@ -260,6 +260,7 @@ impl<'a> ActionManager<'a> {
#[cfg(feature="ux-swap-delay")]
self.tt.sleep_ms(SWAP_DELAY_MS).unwrap();
let mut approved = false;
let mut bip39 = false;
// Security note about PasswordGenerator. This is a 3rd party crate. It relies on `rand`'s implementation
// of ThreadRng to generate passwords. As of the version committed to the lockfile, I have evidenced the
// ThreadRng to request 8 bytes of entropy from our TRNG to seed its state. If the docs are to be trusted,
@ -363,6 +364,13 @@ impl<'a> ActionManager<'a> {
};
approved = false;
pg2.generate_one().unwrap()
} else if maybe_password == "bip39" {
bip39 = true;
approved = true;
match self.modals.input_bip39(Some(t!("vault.bip39.input", xous::LANG))) {
Ok(data) => hex::encode(data),
_ => "".to_string(),
}
} else {
approved = true;
maybe_password
@ -373,7 +381,7 @@ impl<'a> ActionManager<'a> {
description,
username,
password,
notes: t!("vault.notes", xous::LANG).to_string(),
notes: if bip39 { "bip39".to_string() } else {t!("vault.notes", xous::LANG).to_string()},
ctime: 0,
atime: 0,
count: 0,