def prompt_pin(self, device_type=None, path=None, passphrase='', chain=''): if device_type == "keepkey" or device_type == "trezor": # The device will randomize its pin entry matrix on the device # but the corresponding digits in the receiving UI always map # to: # 7 8 9 # 4 5 6 # 1 2 3 client = self._get_client(device_type=device_type, path=path, passphrase=passphrase, chain=chain) return hwi_commands.prompt_pin(client) else: raise Exception("Invalid HWI device type %s, prompt_pin is only supported for Trezor and Keepkey devices" % device_type)
def hwi_prompt_pin(): print(request.form) type = request.form.get("type") path = request.form.get("path") try: if type == "keepkey" or type == "trezor": # The KeepKey will randomize its pin entry matrix on the device # but the corresponding digits in the receiving UI always map # to: # 7 8 9 # 4 5 6 # 1 2 3 client = get_hwi_client(type, path) status = hwilib_commands.prompt_pin(client) return jsonify(success=True, status=status) else: return jsonify(success=False, error="Invalid HWI device type %s" % type) except Exception as e: print(e) return jsonify(success=False, error=e)