bitbox02_rust/ui: inline show_mnemonic
What changed, and why it matters
This commit is a simple code cleanup: it moves the logic for displaying a recovery phrase (mnemonic) from a shared helper function directly into the device's user-interface layer, and removes the now-unused helper. There is no change in behavior, no bug fix, and no security-relevant change.
No action required; treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch inlines mnemonic::show_mnemonic into BitBox02Ui::show_mnemonic and deletes the wrapper function plus its C-unit-test stub. The call to bitbox02::ui::menu, its parameters, and the response handling are identical before and after. This is a pure refactor with no functional or security impact.
Changed components
src/rust/bitbox02-rust/src/hal/bitbox02/ui.rssrc/rust/bitbox02-rust/src/workflow/mnemonic.rssrc/rust/bitbox02-rust/src/workflow/mnemonic_c_unit_tests.rsInspect captured patch +13 / −22
diff --git a/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs b/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
index aebf319..4875ee9 100644
--- a/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
@@ -99,7 +99,19 @@ impl Ui for BitBox02Ui {
}
async fn show_mnemonic(&mut self, words: &[&str]) -> Result<(), cancel::Error> {
- mnemonic::show_mnemonic(words).await
+ match bitbox02::ui::menu(bitbox02::ui::MenuParams {
+ words,
+ title: None,
+ select_word: false,
+ continue_on_last: true,
+ cancel_confirm_title: Some("Recovery\nwords"),
+ })
+ .await
+ {
+ bitbox02::ui::MenuResponse::ContinueOnLast => Ok(()),
+ bitbox02::ui::MenuResponse::SelectWord(_) => panic!("unexpected select-word"),
+ bitbox02::ui::MenuResponse::Cancel => Err(cancel::Error::Cancelled),
+ }
}
async fn quiz_mnemonic_word(
diff --git a/src/rust/bitbox02-rust/src/workflow/mnemonic.rs b/src/rust/bitbox02-rust/src/workflow/mnemonic.rs
index a36a5a2..ca1e04d 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 all mnemonic words in a scroll-through screen.
-pub async fn show_mnemonic(words: &[&str]) -> Result<(), CancelError> {
- match bitbox02::ui::menu(bitbox02::ui::MenuParams {
- words,
- title: None,
- select_word: false,
- continue_on_last: true,
- cancel_confirm_title: Some("Recovery\nwords"),
- })
- .await
- {
- bitbox02::ui::MenuResponse::ContinueOnLast => Ok(()),
- bitbox02::ui::MenuResponse::SelectWord(_) => panic!("unexpected select-word"),
- bitbox02::ui::MenuResponse::Cancel => Err(CancelError::Cancelled),
- }
-}
-
/// 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 {
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 fc1bb4d..da8da73 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 show_mnemonic(_words: &[&str]) -> Result<(), CancelError> {
- panic!("unused")
-}
-
pub async fn confirm_word(_choices: &[&str], _title: &str) -> Result<u8, CancelError> {
panic!("unused")
}
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.