def sign(ctrl, display_label): ctrl.dlg_config_fun(dlg_title="Confirm message signing.", show_progress_bar=False) if display_label: ctrl.display_msg_fun(display_label) else: ctrl.display_msg_fun( '<b>Click the confirmation button on your hardware wallet...</b>' ) if hw_session.app_config.hw_type == HWType.trezor: import hw_intf_trezor as trezor return trezor.sign_message(hw_session, bip32path, message) elif hw_session.app_config.hw_type == HWType.keepkey: import hw_intf_keepkey as keepkey return keepkey.sign_message(hw_session, bip32path, message) elif hw_session.app_config.hw_type == HWType.ledger_nano_s: import hw_intf_ledgernano as ledger return ledger.sign_message(hw_session, bip32path, message) else: logging.error('Invalid HW type: ' + str(hw_session.app_config.hw_type))
def sign(ctrl, display_label): ctrl.dlg_config_fun(dlg_title="Confirm message signing.", show_progress_bar=False) if not display_label: if hw_session.app_config.hw_type == HWType.ledger_nano_s: message_hash = hashlib.sha256(message.encode('ascii')).hexdigest().upper() display_label = '<b>Click the confirmation button on your hardware wallet to sign the message...</b>' \ '<br><br><b>Message:</b><br><span>' + message + '</span><br><br><b>SHA256 hash</b>:' \ '<br>' + message_hash else: display_label = '<b>Click the confirmation button on your hardware wallet to sign the message...</b>' ctrl.display_msg_fun(display_label) if hw_session.app_config.hw_type == HWType.trezor: import hw_intf_trezor as trezor return trezor.sign_message(hw_session, bip32path, message) elif hw_session.app_config.hw_type == HWType.keepkey: import hw_intf_keepkey as keepkey return keepkey.sign_message(hw_session, bip32path, message) elif hw_session.app_config.hw_type == HWType.ledger_nano_s: import hw_intf_ledgernano as ledger return ledger.sign_message(hw_session, bip32path, message) else: logging.error('Invalid HW type: ' + str(hw_session.app_config.hw_type))