async def request_pin_ack(ctx, *args, **kwargs): try: await ctx.call(ButtonRequest(code=ButtonRequestType.Other), MessageType.ButtonAck) return await ctx.wait(request_pin(*args, **kwargs)) except PinCancelled: raise wire.ActionCancelled("Cancelled")
async def get_owner_key(ctx, msg): if not config.has_pin(): return Failure(message='PIN is not set') label = "Enter your PIN" while True: try: pin = await ctx.wait(request_pin(label)) if config.unlock(pin_to_int(pin)): break else: label = "Wrong PIN, enter again" except PinCancelled: raise wire.ActionCancelled("Cancelled") export_warning_msg = 'Exposing the key to a third party allows them to see your balance.' await beam_confirm_message(ctx, 'Owner key', export_warning_msg, False) wait_warning_msg = 'Please wait few seconds until exporting is done' await beam_confirm_message(ctx, 'Owner key', wait_warning_msg, False) pin = pin.encode() owner_key = generate_owner_key(pin) if msg.show_display: await beam_confirm_message(ctx, 'Owner key', owner_key, True) return BeamOwnerKey(key=owner_key)
async def request_pin_ack(ctx, *args, **kwargs): # TODO: send PinMatrixRequest here, with specific code? await ctx.call(ButtonRequest(code=Other), wire_types.ButtonAck) try: return await ctx.wait(request_pin(*args, **kwargs)) except PinCancelled: raise wire.FailureError(FailureType.ActionCancelled, 'Cancelled')
async def request_pin_ack(ctx, *args, **kwargs): try: await ctx.call(ButtonRequest(code=Other), wire_types.ButtonAck) return await ctx.wait(request_pin(*args, **kwargs)) except PinCancelled: raise wire.FailureError(FailureType.ActionCancelled, 'Cancelled')
async def request_pin_ack(ctx: wire.Context, *args: Any, **kwargs: Any) -> str: try: await ctx.call(ButtonRequest(code=ButtonRequestType.Other), ButtonAck) return await ctx.wait(request_pin(*args, **kwargs)) except PinCancelled: raise wire.ActionCancelled("Cancelled")