This commit is contained in:
Peter D. Gray 2024-10-01 08:58:34 -04:00 committed by scgbckbone
parent 6b770024ce
commit 4087f8f25b
4 changed files with 9 additions and 12 deletions

View File

@ -16,7 +16,7 @@ from menu import MenuItem, MenuSystem
from utils import xfp2str, parse_extended_key, swab32, pad_raw_secret, problem_file_line
from uhashlib import sha256
from ux import ux_show_story, the_ux, ux_dramatic_pause, ux_confirm, OK, X
from ux import PressRelease, ux_input_numbers, ux_input_text, show_qr_code
from ux import PressRelease, ux_input_text, show_qr_code
from actions import goto_top_menu
from stash import SecretStash, ZeroSecretException
from ubinascii import hexlify as b2a_hex
@ -1208,7 +1208,9 @@ class PassphraseMenu(MenuSystem):
@classmethod
async def add_numbers(cls, *a):
# Mk4 only: add some digits (quick, easy)
pw = await ux_input_numbers(cls.pp_sofar)
from ux_mk4 import ux_input_digits
pw = await ux_input_digits(cls.pp_sofar)
if pw is not None:
cls.pp_sofar = pw
cls.check_length()

View File

@ -18,7 +18,7 @@ if version.has_qwerty:
from lcd_display import CHARS_W, CHARS_H
CH_PER_W = CHARS_W
STORY_H = CHARS_H
from ux_q1 import PressRelease, ux_enter_number, ux_input_numbers, ux_input_text, ux_show_pin
from ux_q1 import PressRelease, ux_enter_number, ux_input_text, ux_show_pin
from ux_q1 import ux_login_countdown, ux_confirm, ux_dice_rolling, ux_render_words
from ux_q1 import ux_show_phish_words
OK = "ENTER"
@ -29,7 +29,7 @@ else:
# (using FontSmall) .. except it's an approximation since variable-width font.
CH_PER_W = 19
STORY_H = 5
from ux_mk4 import PressRelease, ux_enter_number, ux_input_numbers, ux_input_text, ux_show_pin
from ux_mk4 import PressRelease, ux_enter_number, ux_input_text, ux_show_pin
from ux_mk4 import ux_login_countdown, ux_confirm, ux_dice_rolling, ux_render_words
from ux_mk4 import ux_show_phish_words
OK = "OK"

View File

@ -141,11 +141,6 @@ async def ux_enter_number(prompt, max_value, can_cancel=False):
# cleanup leading zeros and such
value = str(min(int(value), max_value))
async def ux_input_numbers(val, **kws):
# collect a series of digits
# - not wanted on Q1; just get the digits mixed in w/ the text.
raise NotImplementedError
async def ux_input_text(value, confirm_exit=False, hex_only=False, max_len=100,
prompt='Enter value', min_len=0, b39_complete=False, scan_ok=False,
placeholder=None, funct_keys=None, force_xy=None):

View File

@ -59,7 +59,7 @@ async def perform_web2fa(label, shared_secret):
#
# Mk4 and other devices w/o QR scanner, require user to enter 8 digits
#
from ux_mk4 import ux_input_numbers
from ux_mk4 import ux_input_digits
def limit_len(n):
ll = len(n)
@ -70,10 +70,10 @@ async def perform_web2fa(label, shared_secret):
return ''
while 1:
got = await ux_input_numbers('', limit_len, maxlen=8, prompt="8-digits From Web")
got = await ux_input_digits('', limit_len, maxlen=8, prompt="8-digits From Web")
if not got:
# abort w/ empty entry
# abort if empty entry
return False
if got == expect: