remove forgotten debug print statements

(cherry picked from commit c2b8527f0c)
This commit is contained in:
scgbckbone 2023-10-04 15:17:59 +02:00 committed by doc-hex
parent abb1d5c2c3
commit 4414783e1c
3 changed files with 3 additions and 32 deletions

View File

@ -170,11 +170,7 @@ class SettingsObject:
fn = MK4_FILENAME(pos)
try:
os.remove(fn)
print("wiped slot", pos)
except Exception as exc:
import sys
sys.print_exception(exc)
print("failed to wipe slot")
except Exception:
# Error (ENOENT) expected here when saving first time, because the
# "old" slot was not in use
pass
@ -210,7 +206,6 @@ class SettingsObject:
# serialize the data into JSON
d = ujson.dumps(self.current)
print("write_slot:", pos,d)
with self._open_file(pos, 'wb') as fd:
# pad w/ zeros at least to 4k, but allow larger
dat_len = len(d)
@ -236,7 +231,6 @@ class SettingsObject:
# mk4: faster list of slots in use; doesn't open them
files = os.listdir(MK4_WORKDIR)
x = [int(fn[0:-4], 16) for fn in files if fn.endswith('.aes')]
print("used slots", x)
return x
def _nonempty_slots(self, dis=None):
@ -294,7 +288,6 @@ class SettingsObject:
self.current = d
self.my_pos = pos
else:
print("stale data - clean up", pos)
# stale data seen; clean it up.
assert self.current['_age'] > 0
self._wipe_slot(pos)
@ -304,7 +297,6 @@ class SettingsObject:
# done, if we found something
if self.my_pos is not None:
print("found slot", self.my_pos, self.current)
return
# nothing found, use defaults
@ -312,7 +304,6 @@ class SettingsObject:
# pick a (new) random home
self.my_pos = self.find_spot(-1)
print("found nothing, picking new random", self.my_pos)
if is_devmode:
self.current['chain'] = 'XTN'
@ -431,11 +422,9 @@ class SettingsObject:
aes = self.get_aes(pos).cipher
self._write_slot(pos, aes)
print("save: written to new slot", pos, "old slot", self.my_pos)
# erase old copy of data
if (self.my_pos is not None) and (self.my_pos != pos):
print("save: Erasing old copy of data on pos", self.my_pos)
self._wipe_slot(self.my_pos)
self.my_pos = pos
@ -444,7 +433,6 @@ class SettingsObject:
def blank(self):
# erase current copy of values in nvram; older ones may exist still
# - use when clearing the seed value
print("in settings.blank")
if self.my_pos is not None:
self._wipe_slot(self.my_pos)
self.my_pos = 0

View File

@ -424,18 +424,15 @@ class PinAttempt:
# capture values we have already
old_values = dict(settings.current)
print("old values", old_values)
print()
if chain is None:
chain = chains.get_chain(old_values.get("chain", None))
if raw_secret is None:
print("removing tmp_val")
assert pa.tmp_value
bypass_tmp = True
pa.tmp_value = None
if blank:
print("blanking in new_main secret")
# wipe current ephemeral secret settings slot
settings.blank()
old_values = None

View File

@ -823,40 +823,26 @@ class SeedVaultMenu(MenuSystem):
# slot wiping
if tmp_val:
# wipe current settings
print("wipe current ephemeral")
settings.blank()
print("done")
else:
# in main settings
print("save current main settings")
settings.save()
print("tmp_secret")
pa.tmp_secret(pad_raw_secret(encoded))
print("blank")
settings.blank()
print("done")
if pa.tmp_value:
print("restore to main")
await restore_to_main_secret(preserve_settings=True)
seeds = settings.get("seeds", [])
print("retrieved seeds from vault", seeds)
try:
del seeds[idx]
print("del idx", idx)
print("seeds after", seeds)
settings.set("seeds", seeds)
settings.save()
print("saved")
except Exception as e:
import sys
sys.print_exception(e)
except IndexError: pass
finally:
if tmp_val and (not wipe_slot):
# we were in ephemeral mode before and have not
# wiped seed - return back to ephemral
print("we were in tmp removed diff tmp - need to return")
pa.tmp_secret(tmp_val)
settings.set("seeds", seeds)
settings.save()