refactor(core): simplify layout-specific `show_intro_backup()`
What changed, and why it matters
This is a small internal cleanup in the Trezor firmware's backup setup screens. It removes an unnecessary 'single_share' flag from a function and instead decides which text to show based on whether a word count is provided. There is no visible security change.
No security action required. Treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors show_intro_backup() across four UI layout implementations (bolt, caesar, delizia, eckhart) and its callers in reset_device. The single_share: bool parameter is removed; the same behavior is achieved by checking whether num_of_words is None (multi-share) or set (single-share). The call sites are updated accordingly. No logic, privilege, or trust boundary changes are introduced.
Changed components
core/src/apps/management/reset_device/__init__.pycore/src/apps/management/reset_device/layout.pycore/src/trezor/ui/layouts/bolt/reset.pycore/src/trezor/ui/layouts/caesar/reset.pycore/src/trezor/ui/layouts/delizia/reset.pycore/src/trezor/ui/layouts/eckhart/reset.pyInspect captured patch +14 / −20
diff --git a/core/src/apps/management/reset_device/__init__.py b/core/src/apps/management/reset_device/__init__.py
index 1074b5e6..d1a544a7 100644
--- a/core/src/apps/management/reset_device/__init__.py
+++ b/core/src/apps/management/reset_device/__init__.py
@@ -177,7 +177,7 @@ async def _entropy_check(secret: bytes) -> bool:
async def _backup_bip39(mnemonic: str) -> None:
words = mnemonic.split()
- await layout.show_backup_intro(single_share=True, num_of_words=len(words))
+ await layout.show_backup_intro(num_of_words=len(words))
await layout.show_and_confirm_single_share(words)
@@ -188,7 +188,7 @@ async def _backup_slip39_single(
words = mnemonics[0][0].split()
# for a single 1-of-1 group, we use the same layouts as for BIP39
- await layout.show_backup_intro(single_share=True, num_of_words=len(words))
+ await layout.show_backup_intro(num_of_words=len(words))
await layout.show_and_confirm_single_share(words)
@@ -197,7 +197,7 @@ async def _backup_slip39_basic(
) -> None:
group_threshold = 1
- await layout.show_backup_intro(single_share=False)
+ await layout.show_backup_intro()
# get number of shares
await layout.slip39_show_checklist(0, advanced=False)
@@ -224,7 +224,7 @@ async def _backup_slip39_basic(
async def _backup_slip39_advanced(
encrypted_master_secret: bytes, num_of_words: int, extendable: bool
) -> None:
- await layout.show_backup_intro(single_share=False)
+ await layout.show_backup_intro()
# get number of groups
await layout.slip39_show_checklist(0, advanced=True)
diff --git a/core/src/apps/management/reset_device/layout.py b/core/src/apps/management/reset_device/layout.py
index be6f1b5c..1e0bdeeb 100644
--- a/core/src/apps/management/reset_device/layout.py
+++ b/core/src/apps/management/reset_device/layout.py
@@ -104,12 +104,10 @@ async def _do_confirm_share_words(
return True
-async def show_backup_intro(
- single_share: bool, num_of_words: int | None = None
-) -> None:
+async def show_backup_intro(num_of_words: int | None = None) -> None:
from trezor.ui.layouts.reset import show_intro_backup
- await show_intro_backup(single_share, num_of_words)
+ await show_intro_backup(num_of_words)
async def show_backup_success() -> None:
diff --git a/core/src/trezor/ui/layouts/bolt/reset.py b/core/src/trezor/ui/layouts/bolt/reset.py
index f722409c..b77997cf 100644
--- a/core/src/trezor/ui/layouts/bolt/reset.py
+++ b/core/src/trezor/ui/layouts/bolt/reset.py
@@ -279,9 +279,8 @@ def slip39_advanced_prompt_group_threshold(num_of_groups: int) -> Awaitable[int]
)
-def show_intro_backup(single_share: bool, num_of_words: int | None) -> Awaitable[None]:
- if single_share:
- assert num_of_words is not None
+def show_intro_backup(num_of_words: int | None) -> Awaitable[None]:
+ if num_of_words is not None:
description = TR.backup__info_single_share_backup.format(num_of_words)
else:
description = TR.backup__info_multi_share_backup
diff --git a/core/src/trezor/ui/layouts/caesar/reset.py b/core/src/trezor/ui/layouts/caesar/reset.py
index daf78d04..27028be0 100644
--- a/core/src/trezor/ui/layouts/caesar/reset.py
+++ b/core/src/trezor/ui/layouts/caesar/reset.py
@@ -251,9 +251,8 @@ def slip39_advanced_prompt_group_threshold(num_of_groups: int) -> Awaitable[int]
)
-def show_intro_backup(single_share: bool, num_of_words: int | None) -> Awaitable[None]:
- if single_share:
- assert num_of_words is not None
+def show_intro_backup(num_of_words: int | None) -> Awaitable[None]:
+ if num_of_words is not None:
description = TR.backup__info_single_share_backup.format(num_of_words)
else:
description = TR.backup__info_multi_share_backup
diff --git a/core/src/trezor/ui/layouts/delizia/reset.py b/core/src/trezor/ui/layouts/delizia/reset.py
index 2adf4eec..69921ade 100644
--- a/core/src/trezor/ui/layouts/delizia/reset.py
+++ b/core/src/trezor/ui/layouts/delizia/reset.py
@@ -282,9 +282,8 @@ async def slip39_advanced_prompt_group_threshold(num_of_groups: int) -> int:
)
-async def show_intro_backup(single_share: bool, num_of_words: int | None) -> None:
- if single_share:
- assert num_of_words is not None
+async def show_intro_backup(num_of_words: int | None) -> None:
+ if num_of_words is not None:
description = TR.backup__info_single_share_backup.format(num_of_words)
else:
description = TR.backup__info_multi_share_backup
diff --git a/core/src/trezor/ui/layouts/eckhart/reset.py b/core/src/trezor/ui/layouts/eckhart/reset.py
index 050bdb69..64d68392 100644
--- a/core/src/trezor/ui/layouts/eckhart/reset.py
+++ b/core/src/trezor/ui/layouts/eckhart/reset.py
@@ -306,9 +306,8 @@ async def slip39_advanced_prompt_group_threshold(num_of_groups: int) -> int:
)
-async def show_intro_backup(single_share: bool, num_of_words: int | None) -> None:
- if single_share:
- assert num_of_words is not None
+async def show_intro_backup(num_of_words: int | None) -> None:
+ if num_of_words is not None:
description = TR.backup__info_single_share_backup.format(num_of_words)
else:
description = TR.backup__info_multi_share_backup
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.