Skip to content

Commit

Permalink
SFT-2212: removed 2nd warning from key manager exports to accommodate
Browse files Browse the repository at this point in the history
longer message on other flows
  • Loading branch information
mjg-foundation committed Dec 19, 2023
1 parent 1f3ad20 commit 119c7d0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
4 changes: 2 additions & 2 deletions ports/stm32/boards/Passport/modules/derived_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
'indexed': True,
'words': False,
'task': nostr_key_task,
'continue_text': 'post on your behalf',
'info_type_text': 'your keys',
'continue_text': 'profile',
'info_type_text': 'your key',
'menu': nostr_menu},
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ async def generate_key(self):
qr_option=True,
sd_option=True,
path=self.path,
filename=self.filename).run()
filename=self.filename,
key_manager=True).run()
self.set_result(result)
return

Expand Down Expand Up @@ -79,8 +80,7 @@ async def show_qr_code(self):

result = await SeedWarningFlow(action_text="display your {} as a QR code"
.format(self.key_type['title']),
info_type_text=self.key_type.get('info_type_text'),
continue_text=self.key_type.get('continue_text', None)).run()
key_manager=True).run()

if not result:
self.back()
Expand Down Expand Up @@ -119,8 +119,7 @@ async def save_to_sd(self):

result = await SeedWarningFlow(action_text="copy your {} to the microSD card"
.format(self.key_type['title']),
info_type_text=self.key_type.get('info_type_text'),
continue_text=self.key_type.get('continue_text', None)).run()
key_manager=True).run()

if not result:
self.back()
Expand Down
18 changes: 13 additions & 5 deletions ports/stm32/boards/Passport/modules/flows/seed_warning_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ def __init__(self, mention_passphrase=False,
continue_text=None,
info_type_text=None,
initial=False,
allow_skip=True):
allow_skip=True,
key_manager=False):
self.mention_passphrase = mention_passphrase
self.action_text = action_text
self.continue_text = continue_text or "control your funds"
self.continue_text = continue_text or "funds"
self.info_type_text = info_type_text or "these words"
self.allow_skip = allow_skip
self.initial = initial
self.key_manager = key_manager
initial_state = self.show_skippable if (initial and allow_skip) else self.show_intro
super().__init__(initial_state=initial_state, name='SeedWarningFlow')

Expand Down Expand Up @@ -57,9 +59,11 @@ async def show_intro(self):
# Empty microns have no action, so backing out isn't allowed
left_micron = microns.Back if self.allow_skip else None

right_micron = microns.Checkmark if self.key_manager else microns.Forward

result = await InfoPage(
icon=lv.LARGE_ICON_SEED, text=text,
left_micron=left_micron, right_micron=microns.Forward).show()
left_micron=left_micron, right_micron=right_micron).show()

if not result:
self.set_result(False)
Expand All @@ -69,6 +73,10 @@ async def show_intro(self):
self.goto(self.prompt_backup)
return

if self.key_manager:
self.set_result(True)
return

self.goto(self.confirm_show)

async def prompt_backup(self):
Expand All @@ -90,8 +98,8 @@ async def confirm_show(self):
from pages import QuestionPage
import microns

text = 'Beware of any request to expose {} outside of Passport.' \
'Sharing them in any way could allow someone else to {}.' \
text = 'Anyone requesting you expose {} outside Passport ' \
'will gain full control over your {}. Take care.' \
.format(self.info_type_text, self.continue_text)
left_micron = microns.Cancel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def __init__(self,
filename=None,
initial=False,
allow_skip=True,
qr_button=False):
qr_button=False,
key_manager=False):
import microns

self.external_key = external_key
Expand All @@ -35,6 +36,7 @@ def __init__(self,
self.allow_skip = allow_skip
self.use_qr_button = qr_button
self.seen_warning = False
self.key_manager = key_manager
super().__init__(initial_state=self.generate_words, name='ViewSeedWordsFlow')

async def generate_words(self):
Expand Down Expand Up @@ -90,7 +92,8 @@ async def show_qr(self):
result = await SeedWarningFlow(action_text="display your seed as a QR code",
mention_passphrase=self.mention_passphrase,
initial=self.initial,
allow_skip=self.allow_skip).run()
allow_skip=self.allow_skip,
key_manager=self.key_manager).run()

if not result:
self.back()
Expand Down Expand Up @@ -126,7 +129,8 @@ async def save_to_sd(self):
result = await SeedWarningFlow(action_text="copy your seed to the microSD card",
mention_passphrase=self.mention_passphrase,
initial=self.initial,
allow_skip=self.allow_skip).run()
allow_skip=self.allow_skip,
key_manager=self.key_manager).run()

if not result:
self.back()
Expand All @@ -151,7 +155,8 @@ async def show_seed_words(self):
if not self.seen_warning: # We already gave the seed warning flow
result = await SeedWarningFlow(mention_passphrase=self.mention_passphrase,
initial=self.initial,
allow_skip=self.allow_skip).run()
allow_skip=self.allow_skip,
key_manager=self.key_manager).run()

if not result:
self.set_result(False)
Expand Down

0 comments on commit 119c7d0

Please sign in to comment.