mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-14 01:10:58 +00:00
fix whitespace
This commit is contained in:
parent
a8a68ca5fc
commit
fc1b12d80d
@ -51,7 +51,7 @@ class TestDeviceRecovery(common.TrezorTest):
|
|||||||
|
|
||||||
self.assertTrue(self.client.features.pin_protection)
|
self.assertTrue(self.client.features.pin_protection)
|
||||||
self.assertTrue(self.client.features.passphrase_protection)
|
self.assertTrue(self.client.features.passphrase_protection)
|
||||||
|
|
||||||
# Do passphrase-protected action, PassphraseRequest should be raised
|
# Do passphrase-protected action, PassphraseRequest should be raised
|
||||||
resp = self.client.call_raw(proto.Ping(passphrase_protection=True))
|
resp = self.client.call_raw(proto.Ping(passphrase_protection=True))
|
||||||
self.assertIsInstance(resp, proto.PassphraseRequest)
|
self.assertIsInstance(resp, proto.PassphraseRequest)
|
||||||
@ -106,7 +106,7 @@ class TestDeviceRecovery(common.TrezorTest):
|
|||||||
# Do PIN-protected action, PinRequest should NOT be raised
|
# Do PIN-protected action, PinRequest should NOT be raised
|
||||||
resp = self.client.call_raw(proto.Ping(pin_protection=True))
|
resp = self.client.call_raw(proto.Ping(pin_protection=True))
|
||||||
self.assertIsInstance(resp, proto.Success)
|
self.assertIsInstance(resp, proto.Success)
|
||||||
|
|
||||||
def test_word_fail(self):
|
def test_word_fail(self):
|
||||||
ret = self.client.call_raw(proto.RecoveryDevice(word_count=12,
|
ret = self.client.call_raw(proto.RecoveryDevice(word_count=12,
|
||||||
passphrase_protection=False,
|
passphrase_protection=False,
|
||||||
|
@ -95,7 +95,7 @@ def main():
|
|||||||
data = {'label': label,
|
data = {'label': label,
|
||||||
'bip32_path': bip32_path,
|
'bip32_path': bip32_path,
|
||||||
'password_encrypted_hex': binascii.hexlify(passw_encrypted)}
|
'password_encrypted_hex': binascii.hexlify(passw_encrypted)}
|
||||||
|
|
||||||
json.dump(data, open(passw_file, 'wb'))
|
json.dump(data, open(passw_file, 'wb'))
|
||||||
|
|
||||||
# Let's load password
|
# Let's load password
|
||||||
|
@ -17,7 +17,7 @@ def point_to_pubkey(point):
|
|||||||
x_str = number_to_string(point.x(), order)
|
x_str = number_to_string(point.x(), order)
|
||||||
y_str = number_to_string(point.y(), order)
|
y_str = number_to_string(point.y(), order)
|
||||||
vk = x_str + y_str
|
vk = x_str + y_str
|
||||||
return chr((ord(vk[63]) & 1) + 2) + vk[0:32] # To compressed key
|
return chr((ord(vk[63]) & 1) + 2) + vk[0:32] # To compressed key
|
||||||
|
|
||||||
def sec_to_public_pair(pubkey):
|
def sec_to_public_pair(pubkey):
|
||||||
"""Convert a public key in sec binary format to a public pair."""
|
"""Convert a public key in sec binary format to a public pair."""
|
||||||
@ -115,7 +115,7 @@ def deserialize(xpub):
|
|||||||
node.fingerprint = struct.unpack('>I', data[5:9])[0]
|
node.fingerprint = struct.unpack('>I', data[5:9])[0]
|
||||||
node.child_num = struct.unpack('>I', data[9:13])[0]
|
node.child_num = struct.unpack('>I', data[9:13])[0]
|
||||||
node.chain_code = data[13:45]
|
node.chain_code = data[13:45]
|
||||||
|
|
||||||
key = data[45:-4]
|
key = data[45:-4]
|
||||||
if key[0] == '\x00':
|
if key[0] == '\x00':
|
||||||
node.private_key = key[1:]
|
node.private_key = key[1:]
|
||||||
|
@ -78,7 +78,7 @@ class expect(object):
|
|||||||
# or raises an exception
|
# or raises an exception
|
||||||
def __init__(self, *expected):
|
def __init__(self, *expected):
|
||||||
self.expected = expected
|
self.expected = expected
|
||||||
|
|
||||||
def __call__(self, f):
|
def __call__(self, f):
|
||||||
def wrapped_f(*args, **kwargs):
|
def wrapped_f(*args, **kwargs):
|
||||||
ret = f(*args, **kwargs)
|
ret = f(*args, **kwargs)
|
||||||
@ -220,7 +220,7 @@ class DebugLinkMixin(object):
|
|||||||
|
|
||||||
# Always press Yes and provide correct pin
|
# Always press Yes and provide correct pin
|
||||||
self.setup_debuglink(True, True)
|
self.setup_debuglink(True, True)
|
||||||
|
|
||||||
# Do not expect any specific response from device
|
# Do not expect any specific response from device
|
||||||
self.expected_responses = None
|
self.expected_responses = None
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ class DebugLinkMixin(object):
|
|||||||
resp = super(DebugLinkMixin, self).call_raw(msg)
|
resp = super(DebugLinkMixin, self).call_raw(msg)
|
||||||
self._check_request(resp)
|
self._check_request(resp)
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def _check_request(self, msg):
|
def _check_request(self, msg):
|
||||||
if self.expected_responses != None:
|
if self.expected_responses != None:
|
||||||
try:
|
try:
|
||||||
@ -310,7 +310,7 @@ class DebugLinkMixin(object):
|
|||||||
if not msg.HasField(field.name) or getattr(msg, field.name) != value:
|
if not msg.HasField(field.name) or getattr(msg, field.name) != value:
|
||||||
raise CallException(types.Failure_Other,
|
raise CallException(types.Failure_Other,
|
||||||
"Expected %s, got %s" % (pprint(expected), pprint(msg)))
|
"Expected %s, got %s" % (pprint(expected), pprint(msg)))
|
||||||
|
|
||||||
def callback_ButtonRequest(self, msg):
|
def callback_ButtonRequest(self, msg):
|
||||||
log("ButtonRequest code: " + get_buttonrequest_value(msg.code))
|
log("ButtonRequest code: " + get_buttonrequest_value(msg.code))
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class DebugLink(object):
|
|||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.transport.close()
|
self.transport.close()
|
||||||
|
|
||||||
def _call(self, msg, nowait=False):
|
def _call(self, msg, nowait=False):
|
||||||
print "DEBUGLINK SEND", pprint(msg)
|
print "DEBUGLINK SEND", pprint(msg)
|
||||||
self.transport.write(msg)
|
self.transport.write(msg)
|
||||||
@ -53,7 +53,7 @@ class DebugLink(object):
|
|||||||
|
|
||||||
print "Encoded PIN:", pin_encoded
|
print "Encoded PIN:", pin_encoded
|
||||||
return pin_encoded
|
return pin_encoded
|
||||||
|
|
||||||
def read_layout(self):
|
def read_layout(self):
|
||||||
obj = self._call(proto.DebugLinkGetState())
|
obj = self._call(proto.DebugLinkGetState())
|
||||||
return obj.layout
|
return obj.layout
|
||||||
|
@ -10,7 +10,7 @@ def build_map():
|
|||||||
|
|
||||||
map_type_to_class[i] = msg_class
|
map_type_to_class[i] = msg_class
|
||||||
map_class_to_type[msg_class] = i
|
map_class_to_type[msg_class] = i
|
||||||
|
|
||||||
def get_type(msg):
|
def get_type(msg):
|
||||||
return map_class_to_type[msg.__class__]
|
return map_class_to_type[msg.__class__]
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class PinMatrixWidget(QWidget):
|
|||||||
'''
|
'''
|
||||||
def __init__(self, show_strength=True, parent=None):
|
def __init__(self, show_strength=True, parent=None):
|
||||||
super(PinMatrixWidget, self).__init__(parent)
|
super(PinMatrixWidget, self).__init__(parent)
|
||||||
|
|
||||||
self.password = QLineEdit()
|
self.password = QLineEdit()
|
||||||
self.password.setValidator(QRegExpValidator(QRegExp('[1-9]+'), None))
|
self.password.setValidator(QRegExpValidator(QRegExp('[1-9]+'), None))
|
||||||
self.password.setEchoMode(QLineEdit.Password)
|
self.password.setEchoMode(QLineEdit.Password)
|
||||||
|
Loading…
Reference in New Issue
Block a user