Skip to content

Commit

Permalink
Merge branch 'dev' into more_entropy
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Do committed Jan 18, 2023
2 parents 8f92d10 + 7a13dfc commit 3326100
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 44 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="seedsigner",
version="0.5.0",
version="0.5.2",
author="SeedSigner",
author_email="author@example.com",
description="Build an offline, airgapped Bitcoin signing device for less than $50!",
Expand All @@ -23,4 +23,4 @@
package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
python_requires=">=3.6",
)
)
8 changes: 5 additions & 3 deletions src/seedsigner/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Controller(Singleton):
rather than at the top in order avoid circular imports.
"""

VERSION = "0.5.1"
VERSION = "0.5.2"

# Declare class member vars with type hints to enable richer IDE support throughout
# the code.
Expand Down Expand Up @@ -228,12 +228,14 @@ def run(self):
# Home always wipes the back_stack
self.clear_back_stack()

# Clear other temp vars
# Home always wipes the back_stack/state of temp vars
self.resume_main_flow = None
self.multisig_wallet_descriptor = None
self.unverified_address = None
self.address_explorer_data = None

self.psbt = None
self.psbt_parser = None
self.psbt_seed = None

print(f"back_stack: {self.back_stack}")

Expand Down
8 changes: 4 additions & 4 deletions src/seedsigner/gui/screens/seed_screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,7 @@ def _run(self):
self.hw_button3.is_selected = True
self.hw_button3.render()
self.renderer.show_image()

if len(self.passphrase) > 0:
return self.passphrase.strip()
return self.passphrase

elif input == HardwareButtonsConstants.KEY_PRESS and self.top_nav.is_selected:
# Back button clicked
Expand Down Expand Up @@ -1018,6 +1016,8 @@ def __post_init__(self):
screen_y = self.buttons[0].screen_y - GUIConstants.COMPONENT_PADDING - int(GUIConstants.BODY_FONT_SIZE*2.5)
))

if self.passphrase != self.passphrase.strip() or " " in self.passphrase:
self.passphrase = self.passphrase.replace(" ", "\u2589")
available_height = self.components[-1].screen_y - self.top_nav.height + GUIConstants.COMPONENT_PADDING
max_font_size = GUIConstants.TOP_NAV_TITLE_FONT_SIZE + 8
min_font_size = GUIConstants.TOP_NAV_TITLE_FONT_SIZE - 4
Expand Down Expand Up @@ -1509,4 +1509,4 @@ def __post_init__(self):
self.keys_charset = "0123456789"
self.show_save_button = True

super().__post_init__()
super().__post_init__()
6 changes: 3 additions & 3 deletions src/seedsigner/models/settings_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ class SettingsDefinition:
attr_name=SettingsConstants.SETTING__COMPACT_SEEDQR,
display_name="CompactSeedQR",
visibility=SettingsConstants.VISIBILITY__ADVANCED,
default_value=SettingsConstants.OPTION__DISABLED),
default_value=SettingsConstants.OPTION__ENABLED),

SettingsEntry(category=SettingsConstants.CATEGORY__FEATURES,
attr_name=SettingsConstants.SETTING__BIP85_CHILD_SEEDS,
Expand Down Expand Up @@ -490,10 +490,10 @@ class SettingsDefinition:


@classmethod
def get_settings_entries(cls, visibiilty: str = SettingsConstants.VISIBILITY__GENERAL) -> List[SettingsEntry]:
def get_settings_entries(cls, visibility: str = SettingsConstants.VISIBILITY__GENERAL) -> List[SettingsEntry]:
entries = []
for entry in cls.settings_entries:
if entry.visibility == visibiilty:
if entry.visibility == visibility:
entries.append(entry)
return entries

Expand Down
20 changes: 10 additions & 10 deletions src/seedsigner/views/psbt_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def run(self):
button_data.append(TYPE_12WORD)
button_data.append(TYPE_24WORD)

if self.controller.psbt_seed:
if PSBTParser.has_matching_input_fingerprint(psbt=self.controller.psbt, seed=self.controller.psbt_seed, network=self.settings.get_value(SettingsConstants.SETTING__NETWORK)):
# skip the seed prompt if a seed was previous selected and has matching input fingerprint
return Destination(PSBTOverviewView)

selected_menu_num = ButtonListScreen(
title="Select Signer",
is_button_text_centered=False,
Expand Down Expand Up @@ -143,6 +148,7 @@ def run(self):
selected_menu_num = screen.display()

if selected_menu_num == RET_CODE__BACK_BUTTON:
self.controller.psbt_seed = None
return Destination(BackStackView)

# expecting p2sh (legacy multisig) and p2pkh to have no policy set
Expand Down Expand Up @@ -446,11 +452,8 @@ def run(self):
show_back_button=False,
).display()

# Clear out the bad PSBT
self.controller.psbt = None
self.controller.psbt_parser = None
self.controller.psbt_seed = None

# We're done with this PSBT. Route back to MainMenuView which always
# clears all ephemeral data (except in-memory seeds).
return Destination(MainMenuView, clear_history=True)


Expand Down Expand Up @@ -501,11 +504,8 @@ def run(self):
)
QRDisplayScreen(qr_encoder=qr_encoder).display()

# We're done with this PSBT. Remove all related data
self.controller.psbt = None
self.controller.psbt_parser = None
self.controller.psbt_seed = None

# We're done with this PSBT. Route back to MainMenuView which always
# clears all ephemeral data (except in-memory seeds).
return Destination(MainMenuView, clear_history=True)


Expand Down
28 changes: 7 additions & 21 deletions src/seedsigner/views/seed_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,12 @@ def run(self):
if ret == RET_CODE__BACK_BUTTON:
return Destination(BackStackView)

# The new passphrase will be the return value
# The new passphrase will be the return value; it might be empty.
self.seed.set_passphrase(ret)
return Destination(SeedReviewPassphraseView)
if len(self.seed.passphrase) > 0:
return Destination(SeedReviewPassphraseView)
else:
return Destination(SeedFinalizeView)



Expand Down Expand Up @@ -428,7 +431,6 @@ def run(self):
from seedsigner.views.psbt_views import PSBTOverviewView

SCAN_PSBT = ("Scan PSBT", FontAwesomeIconConstants.QRCODE)
REVIEW_PSBT = "Review PSBT"
VERIFY_ADDRESS = "Verify Addr"
EXPORT_XPUB = "Export Xpub"
EXPLORER = "Address Explorer"
Expand All @@ -454,20 +456,7 @@ def run(self):
VERIFY_ADDRESS += f" {addr}"
button_data.append(VERIFY_ADDRESS)

if self.controller.psbt:
if PSBTParser.has_matching_input_fingerprint(self.controller.psbt, self.seed, network=self.settings.get_value(SettingsConstants.SETTING__NETWORK)):
if self.controller.resume_main_flow and self.controller.resume_main_flow == Controller.FLOW__PSBT:
# Re-route us directly back to the start of the PSBT flow
self.controller.resume_main_flow = None
self.controller.psbt_seed = self.seed
return Destination(PSBTOverviewView, skip_current_view=True)
else:
# This seed does not seem to be a signer for this PSBT
# TODO: How sure are we? Should disable this entirely if we're 100% sure?
REVIEW_PSBT += " (?)"
button_data.append(REVIEW_PSBT)
else:
button_data.append(SCAN_PSBT)
button_data.append(SCAN_PSBT)

if self.settings.get_value(SettingsConstants.SETTING__XPUB_EXPORT) == SettingsConstants.OPTION__ENABLED:
button_data.append(EXPORT_XPUB)
Expand All @@ -490,12 +479,9 @@ def run(self):
# Force BACK to always return to the Main Menu
return Destination(MainMenuView)

if button_data[selected_menu_num] == REVIEW_PSBT:
self.controller.psbt_seed = self.controller.get_seed(self.seed_num)
return Destination(PSBTOverviewView)

if button_data[selected_menu_num] == SCAN_PSBT:
from seedsigner.views.scan_views import ScanView
self.controller.psbt_seed = self.controller.get_seed(self.seed_num)
return Destination(ScanView)

elif button_data[selected_menu_num] == VERIFY_ADDRESS:
Expand Down
2 changes: 1 addition & 1 deletion src/seedsigner/views/settings_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def run(self):
DONATE = "Donate"

settings_entries = SettingsDefinition.get_settings_entries(
visibiilty=self.visibility
visibility=self.visibility
)
button_data=[e.display_name for e in settings_entries]

Expand Down

0 comments on commit 3326100

Please sign in to comment.