mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
Implementation of ChangePin
This commit is contained in:
parent
e34874b7c1
commit
fe0e409e77
8
cmd.py
8
cmd.py
@ -107,6 +107,9 @@ class Commands(object):
|
||||
def set_label(self, args):
|
||||
return self.client.apply_settings(label=args.label)
|
||||
|
||||
def change_pin(self, args):
|
||||
return self.client.change_pin(args.remove)
|
||||
|
||||
def load_device(self, args):
|
||||
if not args.mnemonic and not args.xprv:
|
||||
raise Exception("Please provide mnemonic or xprv")
|
||||
@ -146,6 +149,7 @@ class Commands(object):
|
||||
get_features.help = 'Retrieve device features and settings'
|
||||
get_public_node.help = 'Get public node of given path'
|
||||
set_label.help = 'Set new wallet label'
|
||||
change_pin.help = 'Change new PIN or remove existing'
|
||||
list_coins.help = 'List all supported coin types by the device'
|
||||
load_device.help = 'Load custom configuration to the device'
|
||||
reset_device.help = 'Perform factory reset of the device and generate new seed'
|
||||
@ -176,6 +180,10 @@ class Commands(object):
|
||||
# (('-c', '--clear'), {'action': 'store_true', 'default': False})
|
||||
)
|
||||
|
||||
change_pin.arguments = (
|
||||
(('-r', '--remove'), {'action': 'store_true', 'default': False}),
|
||||
)
|
||||
|
||||
load_device.arguments = (
|
||||
(('-m', '--mnemonic'), {'type': str, 'nargs': '+'}),
|
||||
(('-x', '--xprv'), {'type': str}),
|
||||
|
@ -5,8 +5,8 @@ from trezorlib.transport_pipe import PipeTransport
|
||||
from trezorlib.transport_hid import HidTransport
|
||||
from trezorlib.transport_socket import SocketTransportClient
|
||||
|
||||
use_real = True
|
||||
use_pipe = False
|
||||
use_real = False
|
||||
use_pipe = True
|
||||
|
||||
if use_real:
|
||||
|
||||
|
@ -1,4 +1,25 @@
|
||||
#!/usr/bin/python
|
||||
'''
|
||||
* ApplySettings workflow, zistit cez Features ci sa zmeny aplikovali
|
||||
* WipeDevice workflow, zistit cez Features ci to prebehlo
|
||||
* LoadDevice workflow, zistit cez Features ci to prebehlo
|
||||
* ResetDevice workflow
|
||||
|
||||
- zrejme v sucinnosti s inymi testami
|
||||
* ButtonRequest/ButtonAck workflow (vyvolat napr. pomocou GetEntropy, myslim ze ten GetEntropy vyzaduje PIN, ale ja by som to dal na button)
|
||||
* PinMatrixRequest/PinMatrixAck workflow (vyvolat napr. pomocou ChangePin)
|
||||
* PassphraseRequest/PassphraseAck workflow (vyvolat napr. pomocou GetAddress)
|
||||
|
||||
* rozsirit test_sign.tx o viac transakcii (zlozitejsich)
|
||||
|
||||
- chceme v tomto release(?)
|
||||
* SignMessage workflow
|
||||
* VerifyMessage workflow
|
||||
|
||||
* otestovat session handling (tento test bude zrejme failovat na RPi)
|
||||
'''
|
||||
|
||||
|
||||
'''
|
||||
import sys
|
||||
sys.path = ['../',] + sys.path
|
||||
|
@ -123,6 +123,11 @@ class TrezorClient(object):
|
||||
|
||||
return out
|
||||
|
||||
def change_pin(self, remove=False):
|
||||
ret = self.call(proto.ChangePin(remove=remove))
|
||||
self.init_device() # Re-read features
|
||||
return ret
|
||||
|
||||
def _pprint(self, msg):
|
||||
return "<%s>:\n%s" % (msg.__class__.__name__, msg)
|
||||
|
||||
|
@ -15,6 +15,7 @@ class PinButton(QPushButton):
|
||||
|
||||
def _pressed(self):
|
||||
self.password.setText(self.password.text() + str(self.encoded_value))
|
||||
print self.encoded_value
|
||||
self.password.setFocus()
|
||||
|
||||
class PinMatrixWidget(QWidget):
|
||||
@ -40,11 +41,12 @@ class PinMatrixWidget(QWidget):
|
||||
|
||||
grid = QGridLayout()
|
||||
grid.setSpacing(0)
|
||||
for x in range(9):
|
||||
button = PinButton(self.password, x + 1)
|
||||
button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
button.setFocusPolicy(Qt.NoFocus)
|
||||
grid.addWidget(button, x / 3, x % 3)
|
||||
for y in range(3)[::-1]:
|
||||
for x in range(3):
|
||||
button = PinButton(self.password, x + y * 3 + 1)
|
||||
button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
button.setFocusPolicy(Qt.NoFocus)
|
||||
grid.addWidget(button, 3 - y, x)
|
||||
|
||||
hbox = QHBoxLayout()
|
||||
hbox.addWidget(self.password)
|
||||
|
Loading…
Reference in New Issue
Block a user