|
@ -1,5 +1,6 @@ |
|
|
import time |
|
|
import time |
|
|
from struct import pack |
|
|
from struct import pack |
|
|
|
|
|
from typing import Optional |
|
|
|
|
|
|
|
|
from electrum import ecc |
|
|
from electrum import ecc |
|
|
from electrum.i18n import _ |
|
|
from electrum.i18n import _ |
|
@ -7,11 +8,12 @@ from electrum.util import UserCancelled |
|
|
from electrum.keystore import bip39_normalize_passphrase |
|
|
from electrum.keystore import bip39_normalize_passphrase |
|
|
from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 |
|
|
from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 |
|
|
from electrum.logging import Logger |
|
|
from electrum.logging import Logger |
|
|
from electrum.plugins.hw_wallet.plugin import HardwareClientBase |
|
|
from electrum.plugins.hw_wallet.plugin import HardwareClientBase, HardwareHandlerBase |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GuiMixin(object): |
|
|
class GuiMixin(object): |
|
|
# Requires: self.proto, self.device |
|
|
# Requires: self.proto, self.device |
|
|
|
|
|
handler: Optional[HardwareHandlerBase] |
|
|
|
|
|
|
|
|
messages = { |
|
|
messages = { |
|
|
3: _("Confirm the transaction output on your {} device"), |
|
|
3: _("Confirm the transaction output on your {} device"), |
|
@ -45,6 +47,7 @@ class GuiMixin(object): |
|
|
return self.proto.ButtonAck() |
|
|
return self.proto.ButtonAck() |
|
|
|
|
|
|
|
|
def callback_PinMatrixRequest(self, msg): |
|
|
def callback_PinMatrixRequest(self, msg): |
|
|
|
|
|
show_strength = True |
|
|
if msg.type == 2: |
|
|
if msg.type == 2: |
|
|
msg = _("Enter a new PIN for your {}:") |
|
|
msg = _("Enter a new PIN for your {}:") |
|
|
elif msg.type == 3: |
|
|
elif msg.type == 3: |
|
@ -52,7 +55,8 @@ class GuiMixin(object): |
|
|
"NOTE: the positions of the numbers have changed!")) |
|
|
"NOTE: the positions of the numbers have changed!")) |
|
|
else: |
|
|
else: |
|
|
msg = _("Enter your current {} PIN:") |
|
|
msg = _("Enter your current {} PIN:") |
|
|
pin = self.handler.get_pin(msg.format(self.device)) |
|
|
show_strength = False |
|
|
|
|
|
pin = self.handler.get_pin(msg.format(self.device), show_strength=show_strength) |
|
|
if len(pin) > 9: |
|
|
if len(pin) > 9: |
|
|
self.handler.show_error(_('The PIN cannot be longer than 9 characters.')) |
|
|
self.handler.show_error(_('The PIN cannot be longer than 9 characters.')) |
|
|
pin = '' # to cancel below |
|
|
pin = '' # to cancel below |
|
|