feat(core): slide the passphrase eye hint in
What changed, and why it matters
This commit adds a small visual animation to the Trezor hardware wallet's passphrase entry screen. When the user types the first hidden character, an eye icon now slides in from the left to hint that the passphrase can be revealed by holding a button. It is purely a user-interface polish change and does not alter security logic, cryptography, or how passphrases are handled.
No security action required. Treat as a normal UI/UX feature review.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change introduces a new EyeHintAnimation component in core/embed/rust/src/ui/component/eye_hint.rs and wires it into the Delizia and Eckhart layout passphrase keyboards. It uses a Stopwatch and animation-frame timer events to slide an eye icon into view after a 200 ms delay, while shifting the hidden-character dots/dashes right to make room. The animation is gated by animation_disabled() and resets when the input is cleared. No cryptographic, input-validation, or security-critical code is modified.
Changed components
core/embed/rust/src/ui/component/eye_hint.rscore/embed/rust/src/ui/component/mod.rscore/embed/rust/src/ui/layout_delizia/component/keyboard/passphrase.rscore/embed/rust/src/ui/layout_eckhart/firmware/keyboard/passphrase.rsInspect captured patch +176 / −15
### core/embed/rust/src/ui/component/eye_hint.rs
@@ -0,0 +1,96 @@
+use sys::time::Duration;
+
+use crate::time::Stopwatch;
+use crate::ui::component::{Event, EventCtx};
+use crate::ui::util::animation_disabled;
+
+/// Slide-in of the eye icon hinting that the hidden passphrase can be
+/// revealed.
+///
+/// Once the first hidden character appears, the icon slides in from the left
+/// while the hidden characters move right to make room for it.
+#[derive(Default)]
+pub struct EyeHintAnimation {
+ timer: Stopwatch,
+ visible: bool,
+}
+
+impl EyeHintAnimation {
+ /// Pause between the first character being hidden and the slide-in.
+ const START_DELAY: Duration = Duration::from_millis(200);
+ /// Duration of the eye icon slide-in.
+ const DURATION: Duration = Duration::from_millis(205);
+ /// Delay before the hidden characters start moving, from the slide-in
+ /// start.
+ const CONTENT_DELAY: Duration = Duration::from_millis(65);
+
+ /// Start the slide-in when the icon becomes visible, reset it when the
+ /// icon is hidden.
+ pub fn set_visible(&mut self, ctx: &mut EventCtx, visible: bool) {
+ if visible == self.visible {
+ return;
+ }
+ self.visible = visible;
+ self.timer = Stopwatch::new_stopped();
+ if visible && !animation_disabled() {
+ self.timer.start();
+ ctx.request_anim_frame();
+ }
+ ctx.request_paint();
+ }
+
+ /// Keep requesting animation frames while the slide-in runs. Returns
+ /// `true` when the input should be repainted.
+ pub fn process(&mut self, ctx: &mut EventCtx, event: Event) -> bool {
+ if !matches!(event, Event::Timer(EventCtx::ANIM_FRAME_TIMER)) || !self.timer.is_running() {
+ return false;
+ }
+ if self
+ .timer
+ .is_running_within(Self::START_DELAY.saturating_add(Self::DURATION))
+ {
+ ctx.request_anim_frame();
+ } else {
+ self.timer = Stopwatch::new_stopped();
+ }
+ ctx.request_paint();
+ true
+ }
+
+ pub fn is_visible(&self) -> bool {
+ self.visible
+ }
+
+ /// Progress of the eye icon, from 0.0 (off its place) to 1.0 (in place).
+ pub fn icon_progress(&self) -> f32 {
+ self.progress(Duration::ZERO)
+ }
+
+ /// Progress of the hidden characters, from 0.0 (start position) to 1.0
+ /// (in place next to the icon).
+ pub fn content_progress(&self) -> f32 {
+ self.progress(Self::CONTENT_DELAY)
+ }
+
+ fn progress(&self, delay: Duration) -> f32 {
+ if !self.visible {
+ return 0.0;
+ }
+ if !self.timer.is_running() {
+ return 1.0;
+ }
+ let elapsed = self.timer.elapsed();
+ match (
+ elapsed.checked_sub(Self::START_DELAY.saturating_add(delay)),
+ Self::DURATION.checked_sub(delay),
+ ) {
+ (Some(elapsed), Some(duration)) => (elapsed / duration).min(1.0),
+ _ => 0.0,
+ }
+ }
+
+ /// Offset of an element sliding `distance` pixels into place.
+ pub fn offset(progress: f32, distance: i16) -> i16 {
+ -(f32::from(distance) * (1.0 - progress)) as i16
+ }
+}
### core/embed/rust/src/ui/component/mod.rs
@@ -14,6 +14,8 @@ pub mod button_request;
pub mod cached_jpeg;
pub mod connect;
pub mod empty;
+#[cfg(feature = "touch")]
+pub mod eye_hint;
pub mod image;
#[cfg(all(feature = "ui_jpeg", feature = "micropython"))]
pub mod jpeg;
### core/embed/rust/src/ui/layout_delizia/component/keyboard/passphrase.rs
@@ -10,6 +10,7 @@ use super::super::super::constant::SCREEN;
use super::super::super::cshape;
use crate::strutil::{ShortString, TString};
use crate::ui::component::base::ComponentExt;
+use crate::ui::component::eye_hint::EyeHintAnimation;
use crate::ui::component::swipe_detect::SwipeConfig;
use crate::ui::component::text::common::TextBox;
use crate::ui::component::text::layout::{LayoutFit, LineBreaking};
@@ -211,6 +212,8 @@ impl PassphraseKeyboard {
/// Possibly changing the buttons' state after change of the input.
fn after_edit(&mut self, ctx: &mut EventCtx) {
+ self.input.update_eye_hint(ctx);
+
// When the input is empty, enable cancel button. Otherwise show erase and
// confirm button.
let is_empty = self.input.textbox.is_empty();
@@ -506,6 +509,7 @@ struct Input {
last_char_timer: Timer,
pad: Pad,
shown_area: Rect,
+ eye_hint: EyeHintAnimation,
}
impl Input {
@@ -523,6 +527,10 @@ impl Input {
/// Horizontal offset of the first dot, leaving room for the eye icon
const DOTS_OFFSET: i16 =
Self::EYE_ICON_PADDING + theme::ICON_EYE.toif.width() + Self::EYE_ICON_SPACE;
+ /// Distance the eye icon travels when sliding in, starting off the screen
+ const EYE_ICON_SLIDE: i16 = 40;
+ /// Distance the dots travel to make room for the sliding eye icon
+ const DOTS_SLIDE: i16 = 30;
fn new(max_len: usize) -> Self {
Self {
@@ -533,9 +541,22 @@ impl Input {
last_char_timer: Timer::new(),
pad: Pad::with_background(theme::BG),
shown_area: Rect::zero(),
+ eye_hint: EyeHintAnimation::default(),
}
}
+ /// Slide the eye icon in once the first character is hidden behind a dot,
+ /// and reset it when the input is cleared.
+ fn update_eye_hint(&mut self, ctx: &mut EventCtx) {
+ let count = self.textbox.count();
+ let visible = match count {
+ 0 => false,
+ 1 => self.eye_hint.is_visible() || self.display_style == DisplayStyle::Hidden,
+ _ => true,
+ };
+ self.eye_hint.set_visible(ctx, visible);
+ }
+
/// Maximum number of dots that fit in the input area (accounting for the
/// eye icon on the left and the confirm button taking the right portion of
/// the row).
@@ -591,7 +612,9 @@ impl Input {
debug_assert_ne!(self.display_style, DisplayStyle::Shown);
let style = theme::label_keyboard();
- let mut cursor = self.area.left_center().ofs(Offset::x(Self::DOTS_OFFSET));
+ let dots_offset = Self::DOTS_OFFSET
+ + EyeHintAnimation::offset(self.eye_hint.content_progress(), Self::DOTS_SLIDE);
+ let mut cursor = self.area.left_center().ofs(Offset::x(dots_offset));
let pp_len = self.textbox.count();
let last_char = self.display_style == DisplayStyle::LastOnly
@@ -604,15 +627,17 @@ impl Input {
}
// Eye icon hinting that holding the input reveals the passphrase
- ToifImage::new(
- self.area
- .left_center()
- .ofs(Offset::x(Self::EYE_ICON_PADDING)),
- theme::ICON_EYE.toif,
- )
- .with_align(Alignment2D::CENTER_LEFT)
- .with_fg(theme::GREY_LIGHT)
- .render(target);
+ if self.eye_hint.is_visible() {
+ let eye_offset = Self::EYE_ICON_PADDING
+ + EyeHintAnimation::offset(self.eye_hint.icon_progress(), Self::EYE_ICON_SLIDE);
+ ToifImage::new(
+ self.area.left_center().ofs(Offset::x(eye_offset)),
+ theme::ICON_EYE.toif,
+ )
+ .with_align(Alignment2D::CENTER_LEFT)
+ .with_fg(theme::GREY_LIGHT)
+ .render(target);
+ }
let visible_len = pp_len.min(max_dots);
let visible_icons = visible_len - usize::from(last_char);
@@ -686,7 +711,12 @@ impl Component for Input {
}
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
+ if self.eye_hint.process(ctx, event) {
+ self.pad.clear();
+ }
+
if self.textbox.is_empty() {
+ self.update_eye_hint(ctx);
return None;
}
@@ -714,6 +744,7 @@ impl Component for Input {
}
_ => {}
}
+ self.update_eye_hint(ctx);
None
}
### core/embed/rust/src/ui/layout_eckhart/firmware/keyboard/passphrase.rs
@@ -8,6 +8,7 @@ use super::super::keyboard::common::{
use super::super::keyboard::keypad::{ButtonState, KeypadState};
use super::super::{theme, StringInput, StringInputMsg};
use crate::strutil::TString;
+use crate::ui::component::eye_hint::EyeHintAnimation;
use crate::ui::component::text::common::TextBox;
use crate::ui::component::text::layout::{LayoutFit, LineBreaking};
use crate::ui::component::text::TextStyle;
@@ -28,6 +29,7 @@ pub struct PassphraseInput {
multi_tap: MultiTapKeyboard,
allow_cancel: bool,
allow_empty: bool,
+ eye_hint: EyeHintAnimation,
}
impl PassphraseInput {
@@ -40,6 +42,10 @@ impl PassphraseInput {
const EYE_ICON: Icon = theme::ICON_EYE;
const EYE_ICON_WIDTH: i16 = Self::EYE_ICON.toif.width();
const EYE_ICON_SPACE: i16 = 24;
+ /// Distance the eye icon travels when sliding in, starting off the screen
+ const EYE_ICON_SLIDE: i16 = 48;
+ /// Distance the dashes travel to make room for the sliding eye icon
+ const DASHES_SLIDE: i16 = 36;
const MAX_SHOWN_LEN: usize = 10; // max number of icons per line
const LAST_DIGIT_TIMEOUT: Duration = Duration::from_secs(1);
@@ -54,9 +60,22 @@ impl PassphraseInput {
multi_tap: MultiTapKeyboard::new(),
allow_cancel,
allow_empty,
+ eye_hint: EyeHintAnimation::default(),
}
}
+ /// Slide the eye icon in once the first character is hidden behind a dash,
+ /// and reset it when the input is cleared.
+ fn update_eye_hint(&mut self, ctx: &mut EventCtx) {
+ let count = self.textbox.count();
+ let visible = match count {
+ 0 => false,
+ 1 => self.eye_hint.is_visible() || self.display_style == DisplayStyle::Hidden,
+ _ => true,
+ };
+ self.eye_hint.set_visible(ctx, visible);
+ }
+
fn update_shown_area(&mut self) {
// The area where the passphrase is shown
let mut shown_area = Rect::from_top_left_and_size(
@@ -111,14 +130,22 @@ impl PassphraseInput {
}
// Eye icon hinting that holding the input reveals the passphrase
- ToifImage::new(hidden_area.left_center(), Self::EYE_ICON.toif)
+ if self.eye_hint.is_visible() {
+ let eye_offset =
+ EyeHintAnimation::offset(self.eye_hint.icon_progress(), Self::EYE_ICON_SLIDE);
+ ToifImage::new(
+ hidden_area.left_center().ofs(Offset::x(eye_offset)),
+ Self::EYE_ICON.toif,
+ )
.with_align(Alignment2D::CENTER_LEFT)
.with_fg(theme::GREY_LIGHT)
.render(target);
+ }
- let mut cursor = hidden_area
- .left_center()
- .ofs(Offset::x(Self::EYE_ICON_WIDTH + Self::EYE_ICON_SPACE));
+ let dashes_offset = Self::EYE_ICON_WIDTH
+ + Self::EYE_ICON_SPACE
+ + EyeHintAnimation::offset(self.eye_hint.content_progress(), Self::DASHES_SLIDE);
+ let mut cursor = hidden_area.left_center().ofs(Offset::x(dashes_offset));
// Number of visible icons + characters
let visible_len = pp_len.min(Self::MAX_SHOWN_LEN);
@@ -241,6 +268,7 @@ impl StringInput for PassphraseInput {
self.last_char_timer.stop();
self.display_style = DisplayStyle::LastWithMarker;
}
+ self.update_eye_hint(ctx);
}
fn on_erase(&mut self, ctx: &mut EventCtx, long_erase: bool) {
@@ -251,6 +279,7 @@ impl StringInput for PassphraseInput {
self.textbox.delete_last(ctx);
}
self.display_style = DisplayStyle::Hidden;
+ self.update_eye_hint(ctx);
}
fn get_keypad_state(&self) -> KeypadState {
@@ -341,7 +370,10 @@ impl Component for PassphraseInput {
}
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
- self.handle_event(ctx, event)
+ self.eye_hint.process(ctx, event);
+ let msg = self.handle_event(ctx, event);
+ self.update_eye_hint(ctx);
+ msg
}
fn render<'s>(&self, target: &mut impl Renderer<'s>) {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.