tcmdline.py - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
tcmdline.py (909B)
---
1 from electrum.plugin import hook
2 from electrum.i18n import _
3 from electrum.util import print_stderr
4 from .trezor import TrezorPlugin, PASSPHRASE_ON_DEVICE
5 from ..hw_wallet import CmdLineHandler
6
7 class TrezorCmdLineHandler(CmdLineHandler):
8 def __init__(self):
9 self.passphrase_on_device = False
10 super().__init__()
11
12 def get_passphrase(self, msg, confirm):
13 import getpass
14 print_stderr(msg)
15 if self.passphrase_on_device and self.yes_no_question(_('Enter passphrase on device?')):
16 return PASSPHRASE_ON_DEVICE
17 else:
18 return getpass.getpass('')
19
20 class Plugin(TrezorPlugin):
21 handler = CmdLineHandler()
22 @hook
23 def init_keystore(self, keystore):
24 if not isinstance(keystore, self.keystore_class):
25 return
26 keystore.handler = self.handler
27
28 def create_handler(self, window):
29 return self.handler