1
0

command-line handler for trezor

This commit is contained in:
ThomasV
2015-06-10 22:08:19 +02:00
parent 557286ff79
commit 2863d19579
2 changed files with 21 additions and 5 deletions

View File

@@ -93,8 +93,11 @@ class Plugin(BasePlugin):
self.wallet = None
@hook
def init_cmdline(self):
self.handler = TrezorCmdLineHandler()
def cmdline_load_wallet(self, wallet):
self.wallet = wallet
self.wallet.plugin = self
if self.handler is None:
self.handler = TrezorCmdLineHandler()
@hook
def load_wallet(self, wallet, window):
@@ -493,12 +496,22 @@ class TrezorGuiMixin(object):
class TrezorCmdLineHandler:
def get_passphrase(self, msg):
import getpass
print_msg(msg)
return raw_input()
return getpass.getpass('')
def get_pin(self, msg):
t = { 'a':'7', 'b':'8', 'c':'9', 'd':'4', 'e':'5', 'f':'6', 'g':'1', 'h':'2', 'i':'3'}
print_msg(msg)
print_msg("a b c\nd e f\ng h i\n-----")
o = raw_input()
return ''.join(map(lambda x: t[x], o))
def stop(self):
pass
def show_message(self, msg):
print_msg(msg)
return raw_input()
class TrezorQtHandler: