async def dispatch_DebugLinkGetState( ctx: wire.Context, msg: DebugLinkGetState) -> DebugLinkState | None: from trezor.messages import DebugLinkState from apps.common import mnemonic, passphrase m = DebugLinkState() m.mnemonic_secret = mnemonic.get_secret() m.mnemonic_type = mnemonic.get_type() m.passphrase_protection = passphrase.is_enabled() m.reset_entropy = storage.reset_internal_entropy if msg.wait_layout: if not storage.watch_layout_changes: raise wire.ProcessError("Layout is not watched") storage.layout_watcher = LAYOUT_WATCHER_STATE loop.schedule(return_layout_change()) return None else: m.layout_lines = storage.current_content if msg.wait_word_pos: m.reset_word_pos = await reset_word_index.take() if msg.wait_word_list: m.reset_word = " ".join(await reset_current_words.take()) return m
async def dispatch_DebugLinkGetState( ctx: wire.Context, msg: DebugLinkGetState) -> DebugLinkState: from trezor.messages.DebugLinkState import DebugLinkState from apps.common import mnemonic, passphrase m = DebugLinkState() m.mnemonic_secret = mnemonic.get_secret() m.mnemonic_type = mnemonic.get_type() m.passphrase_protection = passphrase.is_enabled() m.reset_entropy = reset_internal_entropy if msg.wait_layout or current_content is None: m.layout_lines = await layout_change_chan.take() else: m.layout_lines = current_content if msg.wait_word_pos: m.reset_word_pos = await reset_word_index.take() if msg.wait_word_list: m.reset_word = " ".join(await reset_current_words.take()) return m