bitbox02_rust: drop sdcard::UserAbort for hal::ui::UserAbort
What changed, and why it matters
This commit is a small internal cleanup in the BitBox02 firmware's Rust code. It removes a duplicate definition of a 'user cancelled' error type used when the user aborts an SD card insertion prompt, and makes all code use a single shared 'UserAbort' type instead. There is no change to user-facing behavior or security.
No action required. Treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit deletes src/rust/bitbox02-rust/src/workflow/sdcard.rs, which only contained pub struct UserAbort, and updates call sites and trait definitions to use the existing crate::hal::ui::UserAbort. It also removes the now-redundant From<crate::workflow::sdcard::UserAbort> conversion to Error. This is a pure refactoring with no functional change.
Changed components
src/rust/bitbox02-rust/src/hal/bitbox02/ui.rssrc/rust/bitbox02-rust/src/hal/testing/ui.rssrc/rust/bitbox02-rust/src/hal/ui.rssrc/rust/bitbox02-rust/src/hww/api/error.rssrc/rust/bitbox02-rust/src/workflow.rssrc/rust/bitbox02-rust/src/workflow/sdcard.rsInspect captured patch +7 / −17
diff --git a/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs b/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
index fad06ac..30379cd 100644
--- a/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/bitbox02/ui.rs
@@ -4,7 +4,7 @@ use alloc::string::String;
use crate::hal::Ui;
use crate::hal::ui::UserAbort;
-use crate::workflow::{confirm, sdcard, trinary_input_string};
+use crate::workflow::{confirm, trinary_input_string};
pub struct BitBox02Ui;
@@ -60,10 +60,10 @@ impl Ui for BitBox02Ui {
}
#[inline(always)]
- async fn insert_sdcard(&mut self) -> Result<(), sdcard::UserAbort> {
+ async fn insert_sdcard(&mut self) -> Result<(), UserAbort> {
match bitbox02::ui::sdcard().await {
bitbox02::ui::SdcardResponse::Inserted => Ok(()),
- bitbox02::ui::SdcardResponse::Cancelled => Err(sdcard::UserAbort),
+ bitbox02::ui::SdcardResponse::Cancelled => Err(UserAbort),
}
}
diff --git a/src/rust/bitbox02-rust/src/hal/testing/ui.rs b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
index 37870ac..7e1461c 100644
--- a/src/rust/bitbox02-rust/src/hal/testing/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
@@ -2,7 +2,7 @@
use crate::hal::Ui;
use crate::hal::ui::UserAbort;
-use crate::workflow::{confirm, sdcard, trinary_input_string};
+use crate::workflow::{confirm, trinary_input_string};
use alloc::boxed::Box;
use alloc::string::String;
@@ -123,7 +123,7 @@ impl Ui for TestingUi<'_> {
self._enter_string.as_mut().unwrap()(params).map(zeroize::Zeroizing::new)
}
- async fn insert_sdcard(&mut self) -> Result<(), sdcard::UserAbort> {
+ async fn insert_sdcard(&mut self) -> Result<(), UserAbort> {
Ok(())
}
diff --git a/src/rust/bitbox02-rust/src/hal/ui.rs b/src/rust/bitbox02-rust/src/hal/ui.rs
index 5ce01f3..53dbe3c 100644
--- a/src/rust/bitbox02-rust/src/hal/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/ui.rs
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
-use crate::workflow::{confirm, mnemonic, sdcard, trinary_input_string};
+use crate::workflow::{confirm, mnemonic, trinary_input_string};
use alloc::string::String;
@@ -32,7 +32,7 @@ pub trait Ui {
preset: &str,
) -> Result<zeroize::Zeroizing<String>, UserAbort>;
- async fn insert_sdcard(&mut self) -> Result<(), sdcard::UserAbort>;
+ async fn insert_sdcard(&mut self) -> Result<(), UserAbort>;
/// Returns the index of the word chosen by the user.
async fn menu(&mut self, words: &[&str], title: Option<&str>) -> Result<u8, UserAbort>;
diff --git a/src/rust/bitbox02-rust/src/hww/api/error.rs b/src/rust/bitbox02-rust/src/hww/api/error.rs
index ac456c6..e08692b 100644
--- a/src/rust/bitbox02-rust/src/hww/api/error.rs
+++ b/src/rust/bitbox02-rust/src/hww/api/error.rs
@@ -62,12 +62,6 @@ impl core::convert::From<crate::hal::ui::UserAbort> for Error {
}
}
-impl core::convert::From<crate::workflow::sdcard::UserAbort> for Error {
- fn from(_error: crate::workflow::sdcard::UserAbort) -> Self {
- Error::UserAbort
- }
-}
-
impl core::convert::From<crate::workflow::verify_message::Error> for Error {
fn from(error: crate::workflow::verify_message::Error) -> Self {
match error {
diff --git a/src/rust/bitbox02-rust/src/workflow.rs b/src/rust/bitbox02-rust/src/workflow.rs
index 3939396..dbc08df 100644
--- a/src/rust/bitbox02-rust/src/workflow.rs
+++ b/src/rust/bitbox02-rust/src/workflow.rs
@@ -9,7 +9,6 @@ pub mod mnemonic;
pub mod orientation_screen;
pub mod pairing;
pub mod password;
-pub mod sdcard;
pub mod transaction;
pub mod trinary_input_string;
pub mod unlock;
diff --git a/src/rust/bitbox02-rust/src/workflow/sdcard.rs b/src/rust/bitbox02-rust/src/workflow/sdcard.rs
deleted file mode 100644
index fa64f80..0000000
--- a/src/rust/bitbox02-rust/src/workflow/sdcard.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-
-pub struct UserAbort;
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.