Exemple #1
0
async def handle_Initialize(ctx: wire.Context, msg: Initialize) -> Features:
    if msg.state is None or msg.state != cache.get_state(
            prev_state=bytes(msg.state)):
        cache.clear()
        if msg.skip_passphrase:
            cache.set_passphrase("")
    return get_features()
Exemple #2
0
async def respond_Features(ctx, msg):

    if msg.__qualname__ == 'Initialize':
        if msg.state is None or msg.state != cache.get_state(salt=msg.state[:32]):
            cache.clear()

    f = Features()
    f.vendor = 'trezor.io'
    f.major_version = symbol('VERSION_MAJOR')
    f.minor_version = symbol('VERSION_MINOR')
    f.patch_version = symbol('VERSION_PATCH')
    f.device_id = storage.get_device_id()
    f.pin_protection = config.has_pin()
    f.passphrase_protection = storage.has_passphrase()
    f.language = 'english'
    f.label = storage.get_label()
    f.coins = coins.COINS
    f.initialized = storage.is_initialized()
    f.revision = symbol('GITREV')
    f.pin_cached = config.has_pin()
    f.passphrase_cached = cache.has_passphrase()
    f.needs_backup = storage.needs_backup()
    f.flags = storage.get_flags()
    f.model = 'T'
    f.state = cache.get_state()

    return f
Exemple #3
0
async def respond_Features(ctx, msg):
    from apps.common import storage, coins, cache
    from trezor.messages.Features import Features

    if msg.__qualname__ == 'Initialize':
        if msg.state is None or msg.state != cache.get_state():
            cache.clear()

    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.model = 'T'
    f.coins = coins.COINS

    f.device_id = storage.get_device_id()
    f.label = storage.get_label()
    f.initialized = storage.is_initialized()
    f.passphrase_protection = storage.has_passphrase()
    f.pin_protection = config.has_pin()
    f.language = 'english'

    f.state = cache.get_state()

    return f
Exemple #4
0
async def respond_Features(ctx, msg):

    if msg.__qualname__ == 'Initialize':
        if msg.state is None or bytes(
                msg.state) != cache.get_state(state=bytes(msg.state)):
            cache.clear()

    f = Features()
    f.vendor = 'trezor.io'
    f.major_version = symbol('VERSION_MAJOR')
    f.minor_version = symbol('VERSION_MINOR')
    f.patch_version = symbol('VERSION_PATCH')
    f.device_id = storage.get_device_id()
    f.pin_protection = config.has_pin()
    f.passphrase_protection = storage.has_passphrase()
    f.language = 'english'
    f.label = storage.get_label()
    f.initialized = storage.is_initialized()
    f.revision = symbol('GITREV')
    f.pin_cached = config.has_pin()
    f.passphrase_cached = cache.has_passphrase()
    f.needs_backup = storage.needs_backup()
    f.flags = storage.get_flags()
    if model() in ['T', 'EMU']:  # emulator currently emulates model T
        f.model = 'T'
    f.unfinished_backup = storage.unfinished_backup()

    return f
Exemple #5
0
def wipe():
    config.wipe()
    cache.clear()
Exemple #6
0
async def handle_ClearSession(ctx, msg):
    cache.clear()
    return Success(message='Session cleared')
Exemple #7
0
async def handle_Initialize(ctx, msg):
    if msg.state is None or msg.state != cache.get_state(
            prev_state=bytes(msg.state)):
        cache.clear(msg.skip_passphrase)
    return get_features()
Exemple #8
0
async def handle_ClearSession(ctx: wire.Context, msg: ClearSession) -> Success:
    cache.clear(keep_passphrase=True)
    return Success(message="Session cleared")
Exemple #9
0
def wipe() -> None:
    config.wipe()
    cache.clear()
Exemple #10
0
async def respond_ClearSession(ctx, msg):
    cache.clear()
    return Success(message='Session cleared')
Exemple #11
0
async def respond_ClearSession(ctx, msg):
    from apps.common import cache
    from trezor.messages.Success import Success
    cache.clear()
    return Success(message='Session cleared')
Exemple #12
0
async def handle_ClearSession(ctx, msg):
    cache.clear(keep_passphrase=True)
    return Success(message="Session cleared")