mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 11:28:14 +00:00
Use getpass('') and confirm passphrase
Added getpass as a dependency Switched pin entry from raw_input() to getpass.getpass('') Switch passphrase entry from raw_input() to getpass.getpass('') Ask user to confirm passphrase
This commit is contained in:
parent
f790c95df0
commit
86a46933b5
@ -6,6 +6,7 @@ import hashlib
|
|||||||
import unicodedata
|
import unicodedata
|
||||||
import mapping
|
import mapping
|
||||||
import json
|
import json
|
||||||
|
import getpass
|
||||||
|
|
||||||
import tools
|
import tools
|
||||||
import messages_pb2 as proto
|
import messages_pb2 as proto
|
||||||
@ -165,15 +166,19 @@ class TextUIMixin(object):
|
|||||||
desc = 'PIN'
|
desc = 'PIN'
|
||||||
|
|
||||||
log("Please enter %s: " % desc)
|
log("Please enter %s: " % desc)
|
||||||
pin = raw_input()
|
pin = getpass.getpass('')
|
||||||
return proto.PinMatrixAck(pin=pin)
|
return proto.PinMatrixAck(pin=pin)
|
||||||
|
|
||||||
def callback_PassphraseRequest(self, msg):
|
def callback_PassphraseRequest(self, msg):
|
||||||
log("Passphrase required: ")
|
log("Passphrase required: ")
|
||||||
passphrase = raw_input()
|
passphrase = getpass.getpass('')
|
||||||
|
log("Confirm your Passphrase: ")
|
||||||
|
if passphrase == getpass(''):
|
||||||
passphrase = unicode(str(bytearray(passphrase, 'utf-8')), 'utf-8')
|
passphrase = unicode(str(bytearray(passphrase, 'utf-8')), 'utf-8')
|
||||||
|
|
||||||
return proto.PassphraseAck(passphrase=passphrase)
|
return proto.PassphraseAck(passphrase=passphrase)
|
||||||
|
else:
|
||||||
|
log("Passphrase did not match! ")
|
||||||
|
exit()
|
||||||
|
|
||||||
def callback_WordRequest(self, msg):
|
def callback_WordRequest(self, msg):
|
||||||
log("Enter one word of mnemonic: ")
|
log("Enter one word of mnemonic: ")
|
||||||
|
Loading…
Reference in New Issue
Block a user