bitbox02_rust/ui: inline quiz_mnemonic
What changed, and why it matters
This is a small internal code cleanup: a helper function that displayed a list of recovery words for the user to pick from was moved from one Rust module into another and the old copy was deleted. The actual on-device behavior is unchanged, and there is no indication of a security bug being fixed.
No security action required; treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit inlines mnemonic::confirm_word into the BitBox02Ui::menu implementation in the HAL UI layer and removes the now-redundant confirm_word wrapper from workflow/mnemonic.rs and its C unit-test stub. The same bitbox02::ui::menu call with identical parameters (select_word: true, continue_on_last: false, cancel_confirm_title: Some("Recovery\nwords")) is preserved. A formatting-only change is made to the testing UI’s menu signature. No functional or security-relevant change is visible in the diff.
Changed components
src/rust/bitbox02-rust/src/hal/bitbox02/ui.rssrc/rust/bitbox02-rust/src/hal/testing/ui.rssrc/rust/bitbox02-rust/src/workflow/mnemonic.rssrc/rust/bitbox02-rust/src/workflow/mnemonic_c_unit_tests.rsInspect captured patch +15 / −28
diff --git a/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs b/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
index 4875ee9..770af00 100644
--- a/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
@@ -3,7 +3,7 @@
use alloc::string::String;
use crate::hal::Ui;
-use crate::workflow::{cancel, confirm, mnemonic, sdcard, transaction, trinary_input_string};
+use crate::workflow::{cancel, confirm, sdcard, transaction, trinary_input_string};
pub(crate) struct BitBox02Ui;
@@ -119,6 +119,18 @@ impl Ui for BitBox02Ui {
choices: &[&str],
title: &str,
) -> Result<u8, cancel::Error> {
- mnemonic::confirm_word(choices, title).await
+ match bitbox02::ui::menu(bitbox02::ui::MenuParams {
+ words: choices,
+ title: Some(title),
+ select_word: true,
+ continue_on_last: false,
+ cancel_confirm_title: Some("Recovery\nwords"),
+ })
+ .await
+ {
+ bitbox02::ui::MenuResponse::SelectWord(choice_idx) => Ok(choice_idx),
+ bitbox02::ui::MenuResponse::ContinueOnLast => panic!("unexpected continue-on-last"),
+ bitbox02::ui::MenuResponse::Cancel => Err(cancel::Error::Cancelled),
+ }
}
}
diff --git a/src/rust/bitbox02-rust/src/hal/testing/ui.rs b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
index 4525d8d..7854571 100644
--- a/src/rust/bitbox02-rust/src/hal/testing/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
@@ -130,11 +130,7 @@ impl Ui for TestingUi<'_> {
Ok(())
}
- async fn menu(
- &mut self,
- _words: &[&str],
- _title: Option<&str>,
- ) -> Result<u8, cancel::Error> {
+ async fn menu(&mut self, _words: &[&str], _title: Option<&str>) -> Result<u8, cancel::Error> {
todo!("not used in unit tests yet");
}
diff --git a/src/rust/bitbox02-rust/src/workflow/mnemonic.rs b/src/rust/bitbox02-rust/src/workflow/mnemonic.rs
index ca1e04d..23f6912 100644
--- a/src/rust/bitbox02-rust/src/workflow/mnemonic.rs
+++ b/src/rust/bitbox02-rust/src/workflow/mnemonic.rs
@@ -59,23 +59,6 @@ fn create_random_unique_words(word: &str, length: u8) -> (u8, Vec<zeroize::Zeroi
(index_word, result)
}
-/// Displays the `choices` to the user, returning the index of the selected choice.
-pub async fn confirm_word(choices: &[&str], title: &str) -> Result<u8, CancelError> {
- match bitbox02::ui::menu(bitbox02::ui::MenuParams {
- words: choices,
- title: Some(title),
- select_word: true,
- continue_on_last: false,
- cancel_confirm_title: Some("Recovery\nwords"),
- })
- .await
- {
- bitbox02::ui::MenuResponse::SelectWord(choice_idx) => Ok(choice_idx),
- bitbox02::ui::MenuResponse::ContinueOnLast => panic!("unexpected continue-on-last"),
- bitbox02::ui::MenuResponse::Cancel => Err(CancelError::Cancelled),
- }
-}
-
pub async fn show_and_confirm_mnemonic(
hal_ui: &mut impl crate::hal::Ui,
words: &[&str],
diff --git a/src/rust/bitbox02-rust/src/workflow/mnemonic_c_unit_tests.rs b/src/rust/bitbox02-rust/src/workflow/mnemonic_c_unit_tests.rs
index da8da73..c9de21d 100644
--- a/src/rust/bitbox02-rust/src/workflow/mnemonic_c_unit_tests.rs
+++ b/src/rust/bitbox02-rust/src/workflow/mnemonic_c_unit_tests.rs
@@ -5,10 +5,6 @@ pub use super::cancel::Error as CancelError;
use alloc::string::String;
use alloc::string::ToString;
-pub async fn confirm_word(_choices: &[&str], _title: &str) -> Result<u8, CancelError> {
- panic!("unused")
-}
-
pub async fn show_and_confirm_mnemonic(
_ui: &mut impl crate::hal::Ui,
words: &[&str],
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.