Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dire-warning detour if invalid BIP-85 child index #372

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/seedsigner/views/seed_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,16 @@ def run(self):
if ret == RET_CODE__BACK_BUTTON:
return Destination(BackStackView)

if not 0 <= int(ret) < 2**31:
return Destination(
SeedBIP85InvalidChildIndexView,
view_args=dict(
seed_num=self.seed_num,
num_words=self.num_words
),
skip_current_view=True
)

return Destination(
SeedWordsWarningView,
view_args=dict(
Expand All @@ -951,6 +961,32 @@ def run(self):
)


class SeedBIP85InvalidChildIndexView(View):
def __init__(self, seed_num: int, num_words: int):
super().__init__()
self.seed_num = seed_num
self.num_words = num_words


def run(self):
DireWarningScreen(
title="BIP-85 Index Error",
show_back_button=False,
status_headline=f"Invalid Child Index",
text=f"BIP-85 Child Index must be between 0 and {2**31-1}.",
button_data=["Try Again"]
).display()

return Destination(
SeedBIP85SelectChildIndexView,
view_args=dict(
seed_num=self.seed_num,
num_words=self.num_words
),
skip_current_view=True
)



"""****************************************************************************
Seed Words Backup Test
Expand Down