Beispiel #1
0
 def sign_message(self, address, message, password):
     if self.has_seed():
         return BIP32_HD_Wallet.sign_message(self, address, message,
                                             password)
     use2FA = False
     self.signing = True
     self.get_client(
     )  # prompt for the PIN before displaying the dialog if necessary
     if not self.check_proper_device():
         self.give_error('Wrong device or password')
     address_path = self.address_id(address)
     self.plugin.handler.show_message("Signing message ...")
     try:
         info = self.get_client().signMessagePrepare(address_path, message)
         pin = ""
         if info['confirmationNeeded']:
             # TODO : handle different confirmation types. For the time being only supports keyboard 2FA
             use2FA = True
             confirmed, p, pin = self.password_dialog()
             if not confirmed:
                 raise Exception('Aborted by user')
             pin = pin.encode()
             self.client.bad = True
             self.device_checked = False
             self.get_client(True)
         signature = self.get_client().signMessageSign(pin)
     except BTChipException, e:
         if e.sw == 0x6a80:
             self.give_error(
                 "Unfortunately, this message cannot be signed by the Ledger wallet. Only alphanumerical messages shorter than 140 characters are supported. Please remove any extra characters (tab, carriage return) and retry."
             )
         else:
             self.give_error(e, True)
Beispiel #2
0
 def sign_message(self, address, message, password):
     if self.has_seed():
         return BIP32_HD_Wallet.sign_message(self, address, message, password)
     use2FA = False
     self.signing = True
     self.get_client() # prompt for the PIN before displaying the dialog if necessary
     if not self.check_proper_device():
         self.give_error('Wrong device or password')
     address_path = self.address_id(address)
     self.plugin.handler.show_message("Signing message ...")
     try:
         info = self.get_client().signMessagePrepare(address_path, message)
         pin = ""
         if info['confirmationNeeded']:
             # TODO : handle different confirmation types. For the time being only supports keyboard 2FA
             use2FA = True
             confirmed, p, pin = self.password_dialog()
             if not confirmed:
                 raise Exception('Aborted by user')
             pin = pin.encode()
             self.client.bad = True
             self.device_checked = False
             self.get_client(True)
         signature = self.get_client().signMessageSign(pin)
     except BTChipException, e:
         if e.sw == 0x6a80:
             self.give_error("Unfortunately, this message cannot be signed by the Ledger wallet. Only alphanumerical messages shorter than 140 characters are supported. Please remove any extra characters (tab, carriage return) and retry.")
         else:
             self.give_error(e, True)
Beispiel #3
0
 def sign_message(self, address, message, password):
     if self.has_seed():
         return BIP32_HD_Wallet.sign_message(self, address, message, password)
     if not self.check_proper_device():
         give_error("Wrong device or password")
     try:
         address_path = self.address_id(address)
         address_n = self.plugin.get_client().expand_path(address_path)
     except Exception, e:
         give_error(e)
Beispiel #4
0
 def sign_message(self, address, message, password):
     if self.has_seed():
         return BIP32_HD_Wallet.sign_message(self, address, message,
                                             password)
     if not self.check_proper_device():
         give_error('Wrong device or password')
     try:
         address_path = self.address_id(address)
         address_n = self.plugin.get_client().expand_path(address_path)
     except Exception, e:
         give_error(e)