示例#1
0
async def dispatch_DebugLinkGetState(ctx, msg):
    m = DebugLinkState()
    m.mnemonic = storage.get_mnemonic()
    m.passphrase_protection = storage.has_passphrase()
    m.reset_entropy = reset_device.internal_entropy
    m.reset_word = reset_device.current_word
    return m
示例#2
0
    async def dispatch_DebugLinkGetState(
            ctx: wire.Context,
            msg: DebugLinkGetState) -> DebugLinkState | None:
        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 = 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
示例#3
0
 async def dispatch_DebugLinkGetState(ctx, msg):
     m = DebugLinkState()
     m.mnemonic = storage.get_mnemonic()
     m.passphrase_protection = storage.has_passphrase()
     m.reset_word_pos = reset_word_index
     m.reset_entropy = reset_internal_entropy
     if reset_current_words:
         m.reset_word = " ".join(reset_current_words)
     return m
示例#4
0
async def dispatch_DebugLinkGetState(ctx, msg):
    from trezor.messages.DebugLinkState import DebugLinkState
    from apps.common import storage
    from apps.management import reset_device

    m = DebugLinkState()
    m.mnemonic = storage.get_mnemonic()
    m.passphrase_protection = storage.has_passphrase()
    m.reset_entropy = reset_device.internal_entropy
    m.reset_word = reset_device.current_word

    return m
示例#5
0
    async def dispatch_DebugLinkGetState(
            ctx: wire.Context, msg: DebugLinkGetState) -> DebugLinkState:
        from trezor.messages.DebugLinkState import DebugLinkState
        from apps.common import storage, mnemonic

        m = DebugLinkState()
        m.mnemonic_secret, m.mnemonic_type = mnemonic.get()
        m.passphrase_protection = storage.device.has_passphrase()
        m.reset_word_pos = reset_word_index
        m.reset_entropy = reset_internal_entropy
        if reset_current_words:
            m.reset_word = " ".join(reset_current_words)
        return m
示例#6
0
    async def dispatch_DebugLinkGetState(
        ctx: wire.Context, msg: DebugLinkGetState
    ) -> DebugLinkState:
        from trezor.messages.DebugLinkState import DebugLinkState
        from apps.common import mnemonic
        from apps.common.storage.device import has_passphrase

        m = DebugLinkState()
        m.mnemonic_secret = mnemonic.get_secret()
        m.mnemonic_type = mnemonic.get_type()
        m.passphrase_protection = has_passphrase()
        m.reset_entropy = reset_internal_entropy

        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
示例#7
0
    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
示例#8
0
async def dispatch_DebugLinkGetState(ctx, msg):
    from trezor.messages.DebugLinkState import DebugLinkState
    from apps.common import storage, request_pin
    from apps.management import reset_device

    if request_pin.matrix:
        matrix = ''.join([str(d) for d in request_pin.matrix.digits])
    else:
        matrix = None

    m = DebugLinkState()
    m.pin = storage.config_get(storage.PIN).decode()
    m.mnemonic = storage.config_get(storage.MNEMONIC).decode()
    m.passphrase_protection = storage.is_protected_by_passphrase()
    m.matrix = matrix
    m.reset_entropy = reset_device.internal_entropy
    m.reset_word = reset_device.current_word

    # TODO: handle other fields:
    # f.recovery_fake_word = recovery_get_fake_word()
    # f.recovery_word_pos = recovery_get_word_pos()
    # f.node = storage.get_node()

    return m