Exemple #1
0
 def prompt_pin(self) -> bool:
     self.coin_name = "Bitcoin" if self.chain == Chain.MAIN else "Testnet"
     self.client.open()
     self._prepare_device()
     if not self.client.features.pin_protection:
         raise DeviceAlreadyUnlockedError("This device does not need a PIN")
     if self.client.features.unlocked:
         raise DeviceAlreadyUnlockedError(
             "The PIN has already been sent to this device"
         )
     print(
         "Use 'sendpin' to provide the number positions for the PIN as displayed on your device's screen",
         file=sys.stderr,
     )
     print(PIN_MATRIX_DESCRIPTION, file=sys.stderr)
     self.client.call_raw(
         messages.GetPublicKey(
             address_n=[0x8000002C, 0x80000001, 0x80000000],
             ecdsa_curve_name=None,
             show_display=False,
             coin_name=self.coin_name,
             script_type=messages.InputScriptType.SPENDADDRESS,
         )
     )
     return True
Exemple #2
0
 def prompt_pin(self):
     self.coin_name = 'Testnet' if self.is_testnet else 'Bitcoin'
     self.client.open()
     self.client.init_device()
     if not self.client.features.pin_protection:
         raise DeviceAlreadyUnlockedError('This device does not need a PIN')
     if self.client.features.pin_cached:
         raise DeviceAlreadyUnlockedError('The PIN has already been sent to this device')
     print('Use \'sendpin\' to provide the number positions for the PIN as displayed on your device\'s screen', file=sys.stderr)
     print(PIN_MATRIX_DESCRIPTION, file=sys.stderr)
     self.client.call_raw(proto.GetPublicKey(address_n=[0x8000002c, 0x80000001, 0x80000000], ecdsa_curve_name=None, show_display=False, coin_name=self.coin_name, script_type=proto.InputScriptType.SPENDADDRESS))
     return {'success': True}