Merge branch 'translate-passphrase-on-host'
What changed, and why it matters
This commit is a localization (translation) update for the BitBox02 hardware wallet. It replaces hard-coded English text strings in the passphrase unlock feature with calls to the device's internationalization system, so the same messages can be shown in German or other supported languages. There is no security vulnerability here; it is a routine code-quality and user-interface improvement.
No security action required. Treat as a normal localization refactor; verify translations are accurate during routine QA.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The merge commit ‘translate-passphrase-on-host’ refactors the passphrase entry flow in src/rust/bitbox02-rust/src/hww/api/unlock.rs to use the crate::i18n::I18n translation macro (crate::tr!) instead of literal English strings for on-device prompts and error messages. It also adds the corresponding German and English translation keys in src/i18n/locales/de/firmware.json and src/i18n/locales/en/firmware.json. The validation logic for host-supplied passphrases is unchanged; only the error reporting is now localized via an enum (HostPassphraseError) mapping to translated strings.
Changed components
src/rust/bitbox02-rust/src/hww/api/unlock.rssrc/i18n/locales/de/firmware.jsonsrc/i18n/locales/en/firmware.jsonInspect captured patch +33 / −10
### src/i18n/locales/de/firmware.json
@@ -328,9 +328,13 @@
"passphrase": {
"confirm": "Bestätigen",
"confirmEmpty": "Leere Passphrase\nverwenden?",
+ "confirmHost": "Passphrase auf\nHost eingeben?",
"doubleCheck": "Bitte prüfe gleich\ndie angezeigte\nPassphrase erneut.",
+ "enterOnHost": "Passphrase auf\nHost eingeben",
"title": "Optionale Passphrase",
- "tryAgain": "Bitte erneut\nversuchen"
+ "tooLong": "Passphrase\nzu lang",
+ "tryAgain": "Bitte erneut\nversuchen",
+ "unsupportedCharacters": "Ungültige\nZeichen"
},
"remainingAttempts": {
"last": "LETZTER Versuch.\nBei falschem\nPasswort wird das\nGerät zurückgesetzt.",
### src/i18n/locales/en/firmware.json
@@ -328,9 +328,13 @@
"passphrase": {
"confirm": "Confirm",
"confirmEmpty": "Use empty\npassphrase?",
+ "confirmHost": "Enter passphrase\non host?",
"doubleCheck": "You will be asked to\nvisually confirm your\npassphrase now.",
+ "enterOnHost": "Enter passphrase\non host",
"title": "Optional passphrase",
- "tryAgain": "Please try again"
+ "tooLong": "Passphrase too\nlong",
+ "tryAgain": "Please try again",
+ "unsupportedCharacters": "Unsupported\ncharacters"
},
"remainingAttempts": {
"last": "This is your LAST\npassword attempt.\nDevice will reset\nif password is wrong.",
### src/rust/bitbox02-rust/src/hww/api/unlock.rs
@@ -3,6 +3,7 @@
use super::error::Error;
use crate::hal::ui::ConfirmParams;
use crate::hal::{Memory, Ui};
+use crate::i18n::I18n as _;
use crate::pb;
use crate::pb::request::Request;
use crate::pb::response::Response;
@@ -64,16 +65,21 @@ async fn device_entry(hal: &mut impl crate::hal::Hal) -> Result<Option<Zeroizing
}
}
-fn validate_host_passphrase(passphrase: &str) -> Result<(), &'static str> {
+enum HostPassphraseError {
+ TooLong,
+ UnsupportedCharacters,
+}
+
+fn validate_host_passphrase(passphrase: &str) -> Result<(), HostPassphraseError> {
// Restrict host input to values that can also be entered again on the device.
if passphrase.len() > MAX_PASSPHRASE_LEN {
- return Err("Passphrase too\nlong");
+ return Err(HostPassphraseError::TooLong);
}
if !passphrase
.bytes()
.all(|c| c.is_ascii_alphanumeric() || SPECIAL.contains(&c))
{
- return Err("Unsupported\ncharacters");
+ return Err(HostPassphraseError::UnsupportedCharacters);
}
Ok(())
}
@@ -94,11 +100,12 @@ async fn passphrase(hal: &mut impl crate::hal::Hal) -> Result<Zeroizing<String>,
None => {
// Entry was interrupted by the host button. Rejection/cancellation always starts a
// fresh device-entry screen, without preserving a partially entered passphrase.
+ let body = crate::tr!(hal, "Enter passphrase\non host?");
if hal
.ui()
.confirm(&ConfirmParams {
title: "",
- body: "Enter passphrase\non host?",
+ body: &body,
..Default::default()
})
.await
@@ -109,7 +116,8 @@ async fn passphrase(hal: &mut impl crate::hal::Hal) -> Result<Zeroizing<String>,
let request = {
let waiting = async {
- hal.ui().waiting("Enter passphrase\non host").await;
+ let message = crate::tr!(hal, "Enter passphrase\non host");
+ hal.ui().waiting(&message).await;
unreachable!()
};
// Poll the waiting screen first so it is visible before HOST_ENTRY_READY. This
@@ -126,10 +134,16 @@ async fn passphrase(hal: &mut impl crate::hal::Hal) -> Result<Zeroizing<String>,
let Some(passphrase) = request.passphrase.take().map(Zeroizing::new) else {
continue;
};
- if let Err(message) = validate_host_passphrase(&passphrase) {
+ if let Err(error) = validate_host_passphrase(&passphrase) {
// Invalid user input restarts entry just like rejection; malformed protocol
// messages still fail in next_request.
- hal.ui().status(message, false).await;
+ let message = match error {
+ HostPassphraseError::TooLong => crate::tr!(hal, "Passphrase too\nlong"),
+ HostPassphraseError::UnsupportedCharacters => {
+ crate::tr!(hal, "Unsupported\ncharacters")
+ }
+ };
+ hal.ui().status(&message, false).await;
continue;
}
(passphrase, true)
@@ -141,7 +155,8 @@ async fn passphrase(hal: &mut impl crate::hal::Hal) -> Result<Zeroizing<String>,
{
return Ok(passphrase);
}
- hal.ui().status("Please try again", false).await;
+ let status = crate::tr!(hal, "Please try again");
+ hal.ui().status(&status, false).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.