What changed, and why it matters
This commit is a small internal code cleanup. It moves the unlock animation from a separate workflow module into the general user-interface (UI) trait, and updates the unlock process to use the new location. There is no change to security behavior or user-visible functionality.
No security action required. This is a benign refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors unlock_animation from a standalone workflow module (workflow::unlock_animation::animate()) into a method on the Ui trait (ui.unlock_animation()). Both production (BitBox02Ui) and testing (TestingUi) implementations are added, and the old module is removed. The unlock_bip39 workflow now calls ui.unlock_animation() in the same future::zip construct as before, preserving the existing concurrent execution with keystore unlocking.
Changed components
src/rust/bitbox-hal/src/ui.rssrc/rust/bitbox02-rust/src/hal/testing/ui.rssrc/rust/bitbox02-rust/src/workflow.rssrc/rust/bitbox02-rust/src/workflow/unlock.rssrc/rust/bitbox02-rust/src/workflow/unlock_animation.rssrc/rust/bitbox02/src/hal/ui.rsInspect captured patch +11 / −9
diff --git a/src/rust/bitbox-hal/src/ui.rs b/src/rust/bitbox-hal/src/ui.rs
index c41baa8..c45a3fd 100644
--- a/src/rust/bitbox-hal/src/ui.rs
+++ b/src/rust/bitbox-hal/src/ui.rs
@@ -74,6 +74,8 @@ pub trait Ui {
longtouch: bool,
) -> Result<(), UserAbort>;
+ async fn unlock_animation(&mut self);
+
async fn status(&mut self, title: &str, status_success: bool);
/// If `can_cancel` is `Yes`, the workflow can be cancelled.
diff --git a/src/rust/bitbox02-rust/src/hal/testing/ui.rs b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
index 276d2fc..0405203 100644
--- a/src/rust/bitbox02-rust/src/hal/testing/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
@@ -108,6 +108,8 @@ impl Ui for TestingUi<'_> {
Ok(())
}
+ async fn unlock_animation(&mut self) {}
+
async fn status(&mut self, title: &str, status_success: bool) {
self.screens.push(Screen::Status {
title: title.into(),
diff --git a/src/rust/bitbox02-rust/src/workflow.rs b/src/rust/bitbox02-rust/src/workflow.rs
index 5fd920f..527c479 100644
--- a/src/rust/bitbox02-rust/src/workflow.rs
+++ b/src/rust/bitbox02-rust/src/workflow.rs
@@ -10,5 +10,4 @@ pub mod pairing;
pub mod password;
pub mod transaction;
pub mod unlock;
-pub mod unlock_animation;
pub mod verify_message;
diff --git a/src/rust/bitbox02-rust/src/workflow/unlock.rs b/src/rust/bitbox02-rust/src/workflow/unlock.rs
index 4fc7410..e019ea3 100644
--- a/src/rust/bitbox02-rust/src/workflow/unlock.rs
+++ b/src/rust/bitbox02-rust/src/workflow/unlock.rs
@@ -157,6 +157,7 @@ pub async fn unlock_bip39(hal: &mut impl crate::hal::Hal, seed: &[u8]) {
}
let crate::hal::HalSubsystems {
+ ui,
random,
securechip,
memory,
@@ -165,7 +166,7 @@ pub async fn unlock_bip39(hal: &mut impl crate::hal::Hal, seed: &[u8]) {
let mut keystore_hal = crate::keystore::KeystoreHalImpl::new(memory, random, securechip);
let ((), result) = futures_lite::future::zip(
- super::unlock_animation::animate(),
+ ui.unlock_animation(),
crate::keystore::unlock_bip39(
&mut keystore_hal,
seed,
diff --git a/src/rust/bitbox02-rust/src/workflow/unlock_animation.rs b/src/rust/bitbox02-rust/src/workflow/unlock_animation.rs
deleted file mode 100644
index 912aafa..0000000
--- a/src/rust/bitbox02-rust/src/workflow/unlock_animation.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-
-/// Performs the unlock animation. Its duration is determined by the component render rate, see
-/// unlock_animation.c
-pub async fn animate() {
- bitbox02::ui::unlock_animation().await;
-}
diff --git a/src/rust/bitbox02/src/hal/ui.rs b/src/rust/bitbox02/src/hal/ui.rs
index 80392bd..6fa2daf 100644
--- a/src/rust/bitbox02/src/hal/ui.rs
+++ b/src/rust/bitbox02/src/hal/ui.rs
@@ -83,6 +83,11 @@ impl Ui for BitBox02Ui {
}
}
+ #[inline(always)]
+ async fn unlock_animation(&mut self) {
+ crate::ui::unlock_animation().await
+ }
+
#[inline(always)]
async fn status(&mut self, title: &str, status_success: bool) {
crate::ui::status(title, status_success).await
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.