Skip to content

Commit

Permalink
Merge pull request #372 from jdlcdl/limit_bip85_index
Browse files Browse the repository at this point in the history
dire-warning detour if invalid BIP-85 child index
  • Loading branch information
newtonick authored Jun 29, 2023
2 parents 8b21749 + 3aab038 commit 9ef9b90
Showing 1 changed file with 36 additions and 0 deletions.
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

0 comments on commit 9ef9b90

Please sign in to comment.