mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-13 19:18:56 +00:00
rename word variables in DebugLinkState message
This commit is contained in:
parent
14007cc613
commit
4fc8868589
@ -32,13 +32,13 @@ class TestDeviceRecovery(common.TrezorTest):
|
||||
fakes = 0
|
||||
for _ in range(int(12 * 1.5)):
|
||||
self.assertIsInstance(ret, proto.WordRequest)
|
||||
word = self.client.debug.read_word()
|
||||
(word, pos) = self.client.debug.read_word()
|
||||
|
||||
if word[1] != 0:
|
||||
ret = self.client.call_raw(proto.WordAck(word=mnemonic[word[1] - 1]))
|
||||
mnemonic[word[1] - 1] = None
|
||||
if pos != 0:
|
||||
ret = self.client.call_raw(proto.WordAck(word=mnemonic[pos - 1]))
|
||||
mnemonic[pos - 1] = None
|
||||
else:
|
||||
ret = self.client.call_raw(proto.WordAck(word=word[0]))
|
||||
ret = self.client.call_raw(proto.WordAck(word=word))
|
||||
fakes += 1
|
||||
|
||||
print mnemonic
|
||||
@ -82,13 +82,13 @@ class TestDeviceRecovery(common.TrezorTest):
|
||||
fakes = 0
|
||||
for _ in range(int(12 * 1.5)):
|
||||
self.assertIsInstance(ret, proto.WordRequest)
|
||||
word = self.client.debug.read_word()
|
||||
(word, pos) = self.client.debug.read_recvery_word()
|
||||
|
||||
if word[1] != 0:
|
||||
ret = self.client.call_raw(proto.WordAck(word=mnemonic[word[1] - 1]))
|
||||
mnemonic[word[1] - 1] = None
|
||||
if pos != 0:
|
||||
ret = self.client.call_raw(proto.WordAck(word=mnemonic[pos - 1]))
|
||||
mnemonic[pos - 1] = None
|
||||
else:
|
||||
ret = self.client.call_raw(proto.WordAck(word=word[0]))
|
||||
ret = self.client.call_raw(proto.WordAck(word=word))
|
||||
fakes += 1
|
||||
|
||||
print mnemonic
|
||||
|
@ -52,7 +52,7 @@ class TestDeviceReset(common.TrezorTest):
|
||||
|
||||
# Provide entropy
|
||||
self.assertIsInstance(ret, proto.EntropyRequest)
|
||||
internal_entropy = self.client.debug.read_entropy()
|
||||
internal_entropy = self.client.debug.read_reset_entropy()
|
||||
ret = self.client.call_raw(proto.EntropyAck(entropy=external_entropy))
|
||||
|
||||
# Generate mnemonic locally
|
||||
@ -62,7 +62,7 @@ class TestDeviceReset(common.TrezorTest):
|
||||
mnemonic = []
|
||||
for _ in range(strength/32*3):
|
||||
self.assertIsInstance(ret, proto.ButtonRequest)
|
||||
mnemonic.append(self.client.debug.read_word()[0])
|
||||
mnemonic.append(self.client.debug.read_reset_word())
|
||||
self.client.debug.press_yes()
|
||||
self.client.call_raw(proto.ButtonAck())
|
||||
|
||||
@ -74,7 +74,7 @@ class TestDeviceReset(common.TrezorTest):
|
||||
mnemonic = []
|
||||
for _ in range(strength/32*3):
|
||||
self.assertIsInstance(ret, proto.ButtonRequest)
|
||||
mnemonic.append(self.client.debug.read_word()[0])
|
||||
mnemonic.append(self.client.debug.read_reset_word())
|
||||
self.client.debug.press_yes()
|
||||
resp = self.client.call_raw(proto.ButtonAck())
|
||||
|
||||
@ -126,7 +126,7 @@ class TestDeviceReset(common.TrezorTest):
|
||||
|
||||
# Provide entropy
|
||||
self.assertIsInstance(ret, proto.EntropyRequest)
|
||||
internal_entropy = self.client.debug.read_entropy()
|
||||
internal_entropy = self.client.debug.read_reset_entropy()
|
||||
ret = self.client.call_raw(proto.EntropyAck(entropy=external_entropy))
|
||||
|
||||
# Generate mnemonic locally
|
||||
@ -136,7 +136,7 @@ class TestDeviceReset(common.TrezorTest):
|
||||
mnemonic = []
|
||||
for _ in range(strength/32*3):
|
||||
self.assertIsInstance(ret, proto.ButtonRequest)
|
||||
mnemonic.append(self.client.debug.read_word()[0])
|
||||
mnemonic.append(self.client.debug.read_reset_word())
|
||||
self.client.debug.press_yes()
|
||||
self.client.call_raw(proto.ButtonAck())
|
||||
|
||||
@ -148,7 +148,7 @@ class TestDeviceReset(common.TrezorTest):
|
||||
mnemonic = []
|
||||
for _ in range(strength/32*3):
|
||||
self.assertIsInstance(ret, proto.ButtonRequest)
|
||||
mnemonic.append(self.client.debug.read_word()[0])
|
||||
mnemonic.append(self.client.debug.read_reset_word())
|
||||
self.client.debug.press_yes()
|
||||
resp = self.client.call_raw(proto.ButtonAck())
|
||||
|
||||
|
@ -264,7 +264,7 @@ class DebugLinkMixin(object):
|
||||
return proto.PassphraseAck(passphrase=self.passphrase)
|
||||
|
||||
def callback_WordRequest(self, msg):
|
||||
(word, pos) = self.debug.read_word()
|
||||
(word, pos) = self.debug.read_recovery_word()
|
||||
if word != '':
|
||||
return proto.WordAck(word=word)
|
||||
if pos != 0:
|
||||
|
@ -66,13 +66,17 @@ class DebugLink(object):
|
||||
obj = self._call(proto.DebugLinkGetState())
|
||||
return obj.node
|
||||
|
||||
def read_word(self):
|
||||
def read_recovery_word(self):
|
||||
obj = self._call(proto.DebugLinkGetState())
|
||||
return (obj.word, obj.word_pos)
|
||||
return (obj.recovery_fake_word, obj.recovery_word_pos)
|
||||
|
||||
def read_entropy(self):
|
||||
def read_reset_word(self):
|
||||
obj = self._call(proto.DebugLinkGetState())
|
||||
return obj.entropy
|
||||
return obj.reset_word
|
||||
|
||||
def read_reset_entropy(self):
|
||||
obj = self._call(proto.DebugLinkGetState())
|
||||
return obj.reset_entropy
|
||||
|
||||
def read_passphrase_protection(self):
|
||||
obj = self._call(proto.DebugLinkGetState())
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user