mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 17:31:36 +00:00
keepkey: cmdline plugin
This commit is contained in:
parent
c7b1721f58
commit
ddae2516c1
3 changed files with 32 additions and 31 deletions
32
plugins/keepkey/cmdline.py
Normal file
32
plugins/keepkey/cmdline.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
from keepkey import KeepKeyPlugin
|
||||||
|
from electrum.util import print_msg
|
||||||
|
from electrum.plugins import hook
|
||||||
|
|
||||||
|
class KeepKeyCmdLineHandler:
|
||||||
|
|
||||||
|
def get_passphrase(self, msg):
|
||||||
|
import getpass
|
||||||
|
print_msg(msg)
|
||||||
|
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)
|
||||||
|
|
||||||
|
class Plugin(KeepKeyPlugin):
|
||||||
|
@hook
|
||||||
|
def cmdline_load_wallet(self, wallet):
|
||||||
|
self.wallet = wallet
|
||||||
|
self.wallet.plugin = self
|
||||||
|
if self.handler is None:
|
||||||
|
self.handler = KeepKeyCmdLineHandler()
|
||||||
|
|
|
@ -420,15 +420,6 @@ class KeepKeyPlugin(BasePlugin):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CmdlinePlugin(KeepKeyPlugin):
|
|
||||||
|
|
||||||
@hook
|
|
||||||
def cmdline_load_wallet(self, wallet):
|
|
||||||
self.wallet = wallet
|
|
||||||
self.wallet.plugin = self
|
|
||||||
if self.handler is None:
|
|
||||||
self.handler = KeepKeyCmdLineHandler()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class KeepKeyGuiMixin(object):
|
class KeepKeyGuiMixin(object):
|
||||||
|
@ -478,26 +469,6 @@ class KeepKeyGuiMixin(object):
|
||||||
return proto.WordAck(word=word)
|
return proto.WordAck(word=word)
|
||||||
|
|
||||||
|
|
||||||
class KeepKeyCmdLineHandler:
|
|
||||||
|
|
||||||
def get_passphrase(self, msg):
|
|
||||||
import getpass
|
|
||||||
print_msg(msg)
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
if KEEPKEY:
|
if KEEPKEY:
|
||||||
class QtGuiKeepKeyClient(ProtocolMixin, KeepKeyGuiMixin, BaseClient):
|
class QtGuiKeepKeyClient(ProtocolMixin, KeepKeyGuiMixin, BaseClient):
|
||||||
|
|
|
@ -27,10 +27,8 @@ class Plugin(TrezorPlugin):
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def cmdline_load_wallet(self, wallet):
|
def cmdline_load_wallet(self, wallet):
|
||||||
print "cmdline load wallet"
|
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
self.wallet.plugin = self
|
self.wallet.plugin = self
|
||||||
if self.handler is None:
|
if self.handler is None:
|
||||||
self.handler = TrezorCmdLineHandler()
|
self.handler = TrezorCmdLineHandler()
|
||||||
print self.wallet
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue