コード例 #1
0
async def protect_by_passphrase(session_id):
    from apps.common import storage

    if storage.is_protected_by_passphrase():
        return await request_passphrase(session_id)
    else:
        return ''
コード例 #2
0
async def respond_Features(session_id, msg):
    from apps.common import storage, coins
    from trezor.messages.Features import Features

    f = Features()
    f.vendor = 'trezor.io'
    f.revision = '0123456789'
    f.bootloader_hash = '0123456789'
    f.major_version = 2
    f.minor_version = 0
    f.patch_version = 0
    f.coins = coins.COINS

    f.device_id = storage.get_device_id()
    f.label = storage.get_label()
    f.language = storage.get_language()
    f.initialized = storage.is_initialized()
    f.pin_protection = storage.is_protected_by_pin()
    f.passphrase_protection = storage.is_protected_by_passphrase()

    return f
コード例 #3
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