prohibit built-in input in calc mode; save dfu bytes by removing unused imports
This commit is contained in:
parent
c966f9a2f3
commit
e9a770315d
@ -3,11 +3,7 @@
|
||||
# bbqr.py - Implement BBQr protocol for multiple QR support (also compression and filetype info)
|
||||
#
|
||||
import utime, uzlib, ngu
|
||||
import uasyncio as asyncio
|
||||
from struct import pack, unpack
|
||||
from utils import B2A, problem_file_line
|
||||
from imptask import IMPT
|
||||
from queues import Queue
|
||||
from utils import problem_file_line
|
||||
from exceptions import QRDecodeExplained
|
||||
from ubinascii import unhexlify as a2b_hex
|
||||
|
||||
|
||||
@ -4,15 +4,7 @@
|
||||
#
|
||||
# Test with: ./simulator.py --q1 --eff -g --set calc=1
|
||||
#
|
||||
import utime, gc, ngu, sys, re
|
||||
import uasyncio as asyncio
|
||||
from uasyncio import sleep_ms
|
||||
from charcodes import *
|
||||
from lcd_display import CHARS_W, CHARS_H, CursorSpec, CURSOR_SOLID, CURSOR_OUTLINE
|
||||
from exceptions import AbortInteraction, QRDecodeExplained
|
||||
import bip39
|
||||
from decoders import decode_qr_result
|
||||
from ubinascii import hexlify as b2a_hex
|
||||
import utime, ngu, re
|
||||
from utils import B2A, word_wrap
|
||||
from ux_q1 import ux_input_text
|
||||
|
||||
@ -27,7 +19,7 @@ async def login_repl():
|
||||
re_pin = re.compile(r'^(\d\d+)[-_ ](\d\d+)$')
|
||||
|
||||
# in decreasing order of hazard...
|
||||
blacklist = ['import', '__', 'exec', 'locals', 'globals', 'eval' ]
|
||||
blacklist = ['import', '__', 'exec', 'locals', 'globals', 'eval', 'input']
|
||||
|
||||
lines = '''\
|
||||
|
||||
@ -39,7 +31,6 @@ Example Commands:
|
||||
>> cls() # clear screen\
|
||||
'''.split('\n')
|
||||
|
||||
|
||||
state = dict()
|
||||
state['sha256'] = lambda x: B2A(ngu.hash.sha256s(x))
|
||||
state['sha512'] = lambda x: B2A(ngu.hash.sha512(x).digest())
|
||||
|
||||
@ -2,12 +2,9 @@
|
||||
#
|
||||
# ownership.py - store a cache of hashes related to addresses we might control.
|
||||
#
|
||||
import os, sys, chains, stash, ngu, struct, version
|
||||
from uhashlib import sha256
|
||||
from ubinascii import b2a_base64, a2b_base64
|
||||
import os, sys, chains, ngu, struct, version
|
||||
from glob import settings
|
||||
from ucollections import namedtuple
|
||||
from wallet import WalletABC
|
||||
from ubinascii import hexlify as b2a_hex
|
||||
from exceptions import UnknownAddressExplained
|
||||
|
||||
@ -208,12 +205,11 @@ class OwnershipCache:
|
||||
# Find it!
|
||||
# - returns wallet object, and tuple2 of final 2 subpath components
|
||||
# - if you start w/ testnet, we'll follow that
|
||||
from chains import current_chain
|
||||
from multisig import MultisigWallet
|
||||
from public_constants import AFC_SCRIPT, AF_P2WPKH_P2SH, AF_P2SH, AF_P2WSH_P2SH
|
||||
from glob import dis
|
||||
|
||||
ch = current_chain()
|
||||
ch = chains.current_chain()
|
||||
|
||||
addr_fmt = ch.possible_address_fmt(addr)
|
||||
if not addr_fmt:
|
||||
|
||||
@ -2,15 +2,12 @@
|
||||
#
|
||||
# tapsigner.py - TAPSIGNER backup file support
|
||||
#
|
||||
import gc, sys, ustruct, ngu, chains, ure, time
|
||||
import ustruct, ngu, ure
|
||||
from ubinascii import unhexlify as a2b_hex
|
||||
from ux import ux_show_story, the_ux, ux_confirm, ux_dramatic_pause, ux_aborted
|
||||
from ux import ux_enter_bip32_index, ux_input_text, import_export_prompt
|
||||
from export import make_json_wallet, make_summary_file, make_descriptor_wallet_export
|
||||
from export import make_bitcoin_core_wallet, generate_wasabi_wallet, generate_generic_export
|
||||
from export import generate_unchained_export, generate_electrum_wallet
|
||||
from ubinascii import a2b_base64
|
||||
from ux import ux_show_story
|
||||
from ux import ux_input_text, import_export_prompt
|
||||
from files import CardSlot, CardMissingError, needs_microsd
|
||||
from glob import settings
|
||||
from charcodes import KEY_NFC, KEY_QR, KEY_CANCEL
|
||||
from actions import file_picker, import_extended_key_as_secret
|
||||
|
||||
@ -50,8 +47,6 @@ async def import_tapsigner_backup_file(_1, _2, item):
|
||||
elif choice == KEY_QR:
|
||||
# how is binary encoded? who made this QR??!
|
||||
from ux_q1 import QRScannerInteraction
|
||||
from ubinascii import a2b_base64
|
||||
from ubinascii import unhexlify as a2b_hex
|
||||
|
||||
prob = None
|
||||
while 1:
|
||||
@ -74,9 +69,17 @@ async def import_tapsigner_backup_file(_1, _2, item):
|
||||
fn = await file_picker(suffix="aes", min_size=100, max_size=160, **choice)
|
||||
if not fn: return
|
||||
meta += (" (%s)" % fn)
|
||||
with CardSlot(**choice) as card:
|
||||
with open(fn, 'rb') as fp:
|
||||
data = fp.read()
|
||||
try:
|
||||
with CardSlot(**choice) as card:
|
||||
with open(fn, 'rb') as fp:
|
||||
data = fp.read()
|
||||
except CardMissingError:
|
||||
await needs_microsd()
|
||||
return
|
||||
except Exception as e:
|
||||
from utils import problem_file_line
|
||||
await ux_show_story('Failed to read!\n\n\n%s\n%s' % (e, problem_file_line(e)))
|
||||
return
|
||||
|
||||
if await ux_show_story("Make sure to have your TAPSIGNER handy as you will need to provide "
|
||||
"'Backup Password' from the back of the card in the next step.\n\n"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user