Skip to content

[Task][Device] Add TOTP validity countdown and semantic status colors #148

Description

@miso-develop

Parent spec

#137

Owner

  • ACTIVE_ROLE: implementation
  • DOMAIN: device

State

READY_FOR_IMPLEMENTATION

Dependency / collision boundary — re-evaluated 2026-09-17

The original blocker on #139 / PR #143 is resolved.

Current baseline at this re-evaluation:

Implementation ownership for this Task is the StickS3 Device UI/countdown/status-color surface defined below. Start from the current main at implementation bootstrap and re-run the normal Issue/PR/branch collision check before mutation.

Known integrated-file considerations:

There is no remaining dependency blocker at this handoff.

Objective

Improve the M5StickS3 OTP screen and status readability by showing the remaining validity of the currently displayed TOTP and by applying semantic text colors to Device State and Time values.

Scope

1. TOTP validity countdown

While an OTP is revealed, show how much validity remains in the current RFC 6238 30-second TOTP period.

Preferred presentation:

  • a compact circular countdown/progress animation similar in concept to common authenticator apps;
  • optionally include remaining seconds when legible on the 240x135 display.

Fallback:

  • if a circular indicator cannot be rendered without materially reducing OTP readability or causing flicker, a clear numeric remaining-seconds indicator is acceptable.

The countdown represents TOTP validity, not the existing 10-second reveal timeout.

2. TOTP rollover while revealed

The UI must never present a countdown for a new TOTP period while leaving the old OTP code visible.

If the 30-second TOTP boundary is crossed while reveal remains active:

  • regenerate the selected credential's TOTP for the new period;
  • replace the displayed OTP atomically with the new code;
  • reset the validity indicator for the new 30-second period;
  • do not extend the original 10-second reveal deadline.

If trusted time becomes non-ready or generation fails, follow the existing fail-closed reveal behavior rather than showing a stale OTP.

3. Semantic colors for State / Time

Color only the status value (or an equivalently clear status region); retain the State: / Time: labels and textual value so color is never the sole carrier of meaning.

State color mapping

  • UNLOCKED -> green
  • LOCKED -> amber/yellow (normal but not currently usable for OTP)
  • UNPROVISIONED -> amber/yellow (setup required)
  • REPROVISION -> red
  • SECURITY ERROR / unknown error -> red

Time color mapping

  • READY -> green
  • NOT SYNCED -> amber/yellow
  • TIME STALE -> red
  • TIME ERROR / unknown error -> red

Use display-native RGB565 or equivalent constants with enough contrast against the current black background. Exact hue may be adjusted for M5StickS3 readability, but semantic categories above must remain stable.

Acceptance criteria

  • OTP reveal still has the existing maximum 10-second visibility window.
  • While OTP is visible, the UI presents remaining validity for the current 30-second TOTP period.
  • Preferred implementation uses a compact circular countdown/progress indicator if physical readability/performance permit; otherwise a numeric seconds fallback is clearly implemented and documented.
  • The indicator progresses smoothly enough to be understandable without introducing whole-screen flicker.
  • Countdown rendering does not reduce the six-digit OTP below the readable size/layout established by [Task][Device] Refine StickS3 OTP screen readability and interactions #139.
  • Countdown is derived from trusted TOTP time/period semantics, not from the 10-second reveal timer.
  • Crossing a 30-second TOTP boundary during an active reveal refreshes the OTP and countdown together.
  • TOTP rollover does not reset/extend the original reveal deadline.
  • If trusted time becomes NOT SYNCED / TIME STALE or generation otherwise becomes unavailable, stale OTP is not retained on screen.
  • State and Time textual values remain visible and readable; color supplements rather than replaces text.
  • UNLOCKED and READY are visually green.
  • expected-but-not-ready states (LOCKED, UNPROVISIONED, NOT SYNCED) use amber/yellow rather than being presented as fatal errors.
  • REPROVISION, SECURITY ERROR, TIME STALE, and TIME ERROR are visually red.
  • Presence / unlock-request and other existing Device UI modes remain readable and retain their current security semantics.
  • No OTP value, secret, credential label, or additional secret-bearing state is logged or persisted for the animation.
  • Firmware/UI model/runtime contract tests cover countdown/rollover behavior and color-category mapping where practical.
  • Physical M5StickS3 validation confirms readable colors, no unacceptable flicker, and no OTP readability regression.

Security / timing constraints

  • Existing trusted-time gating remains authoritative.
  • The visual indicator must be computed from the same trusted time basis used for TOTP generation; do not introduce a second independent wall-clock truth.
  • OTP rollover must use existing bounded/transient generation paths and zeroization expectations.
  • Preserve the integrated [Task][Device] Implement configurable automatic LOCK policy #140 automatic-LOCK behavior and its explicit-Lock security boundary.
  • No change to Protocol v2, Vault format, credential export boundary, Trusted Browser behavior, or automatic LOCK semantics.

Out of scope

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions