Example #1
0
def set_countdown_pin_mode():
    #   cd_mode = various harm levels
    s = SettingsObject()
    which = s.get('cd_mode', 0)  # default is brick
    del s

    ch = ['Brick', 'Final PIN', 'Test Mode']

    def set(idx, text):
        # save it, but "outside" of login PIN
        s = SettingsObject()
        s.set('cd_mode', idx)
        s.save()
        del s

    return which, ch, set
Example #2
0
def scramble_keypad_chooser():
    #   rngk = randomize keypad for PIN entry

    s = SettingsObject()
    which = s.get('rngk', 0)
    del s

    ch = ['Normal', 'Scramble Keys']

    def set(idx, text):
        # save it, but "outside" of login PIN
        s = SettingsObject()
        s.set('rngk', idx)
        s.save()
        del s

    return which, ch, set
Example #3
0
def real_countdown_chooser(tag, offset, def_to):
    # Login countdown length, stored in minutes
    #
    lgto_ch = [
        'Disabled',
        ' 5 minutes',
        '15 minutes',
        '30 minutes',
        ' 1 hour',
        ' 2 hours',
        ' 4 hours',
        ' 8 hours',
        '12 hours',
        '24 hours',
        '48 hours',
        ' 3 days',
        ' 1 week',
        '28 days later',
    ]
    lgto_va = [
        0, 5, 15, 30, 60, 2 * 60, 4 * 60, 8 * 60, 12 * 60, 24 * 60, 48 * 60,
        72 * 60, 7 * 24 * 60, 28 * 24 * 60
    ]

    # 'disabled' choice not appropriate for cd_lgto case
    ch = lgto_ch[offset:]
    va = lgto_va[offset:]

    s = SettingsObject()
    timeout = s.get(tag, def_to)  # in minutes
    try:
        which = va.index(timeout)
    except ValueError:
        which = 0

    def set_it(idx, text):
        # save on key0, not normal settings
        s = SettingsObject()
        s.set(tag, va[idx])
        s.save()
        del s

    return which, ch, set_it
Example #4
0
async def pick_nickname(*a):
    # from settings menu, enter a nickname
    from nvstore import SettingsObject

    # Value is not stored with normal settings, it's part of "prelogin" settings
    # which are encrypted with zero-key.
    s = SettingsObject()
    nick = s.get('nick', '')

    if not nick:
        ch = await ux_show_story('''\
You can give this Coldcard a nickname and it will be shown before login.''')
        if ch != 'y': return

    from seed import spinner_edit
    nn = await spinner_edit(nick, confirm_exit=False)

    nn = nn.strip() if nn else None
    s.set('nick', nn)
    s.save()
    del s
Example #5
0
    numpad = MembraneNumpad(loop)
else:
    # Setup touch numpad (mark 1 hardware)
    from touchpad import TouchNumpad
    numpad = TouchNumpad(loop)

# Serial Flash memory
from sflash import SPIFlash
sf = SPIFlash()

# NV settings
from nvstore import SettingsObject
settings = SettingsObject(loop)

# important default/restore preference
numpad.sensitivity = settings.get('sens', numpad.sensitivity)


async def done_splash2():
    # Boot up code; after splash screen is done.

    # MAYBE: check if we're a brick and die again? Or show msg?

    if version.is_factory_mode():
        # in factory mode, turn on USB early to allow debug/setup
        from usb import enable_usb
        enable_usb(loop, True)

        # always start the self test.
        if not settings.get('tested', False):
            from actions import start_selftest