1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 17:18:29 +00:00
trezor-firmware/core/mocks/generated/trezorconfig.py
matejcik 482b4569f5 build: fix and auto-generate mock files
Squashed commit of the following:

commit 84d3486f59bda063f06521c8b695ea4b07781ec6
Author: matejcik <ja@matejcik.cz>
Date:   Fri May 17 14:17:15 2019 +0200

    mocks: complete

commit d538133a6d0fb4af06c7c81f80b8675869fb5908
Author: matejcik <ja@matejcik.cz>
Date:   Fri May 17 14:12:26 2019 +0200

    mocks part 3

commit 9f0b868d41dafaf487df6fc844db7f3368eabe1b
Author: matejcik <ja@matejcik.cz>
Date:   Fri May 17 14:09:20 2019 +0200

    mocks: update generated mocks

commit 5d80c18a7824ed16fc11cde4cdb8ebca7ed33400
Author: matejcik <ja@matejcik.cz>
Date:   Thu May 16 15:49:40 2019 +0200

    mocks wip 2

commit 4b576eb796136a61eb88cb0d281fa4e21eadada8
Author: matejcik <ja@matejcik.cz>
Date:   Tue May 7 17:02:51 2019 +0200

    WIP mocks part 1

commit cf3f0d4471ab74b478d2970b0bb178feae7c86a3
Author: matejcik <ja@matejcik.cz>
Date:   Fri May 3 17:07:53 2019 +0200

    core: add package to secp256k1_zkp for mocking

commit 8a12f26c8c0d99363c8df96012426abbbb3ff6cb
Author: matejcik <ja@matejcik.cz>
Date:   Fri May 3 17:04:05 2019 +0200

    core: blackify extmod docstring quotes

commit b6f239676dde8b60b001fcae4e5de80a71dbacf2
Author: matejcik <ja@matejcik.cz>
Date:   Fri May 3 16:52:27 2019 +0200

    core: make build_mocks directory agnostic

mocks: detect bad packages

mocks: revert noqa in favor of setup.cfg

mocks: fix broken comment formatting
2019-05-17 15:45:47 +02:00

100 lines
2.3 KiB
Python

from typing import *
# extmod/modtrezorconfig/modtrezorconfig.c
def init(ui_wait_callback: Tuple[int, Callable[int, None]] = None) -> None:
"""
Initializes the storage. Must be called before any other method is
called from this module!
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def unlock(pin: int) -> bool:
"""
Attempts to unlock the storage with given PIN. Returns True on
success, False on failure.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def check_pin(pin: int) -> bool:
"""
Check the given PIN. Returns True on success, False on failure.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def lock() -> None:
"""
Locks the storage.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def has_pin() -> bool:
"""
Returns True if storage has a configured PIN, False otherwise.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def get_pin_rem() -> int:
"""
Returns the number of remaining PIN entry attempts.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def change_pin(pin: int, newpin: int) -> bool:
"""
Change PIN. Returns True on success, False on failure.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def get(app: int, key: int, public: bool = False) -> bytes:
"""
Gets the value of the given key for the given app (or None if not set).
Raises a RuntimeError if decryption or authentication of the stored
value fails.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def set(app: int, key: int, value: bytes, public: bool = False) -> None:
"""
Sets a value of given key for given app.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def delete(app: int, key: int, public: bool = False) -> bool:
"""
Deletes the given key of the given app.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def set_counter(
app: int, key: int, count: int, writable_locked: bool = False
) -> bool:
"""
Sets the given key of the given app as a counter with the given value.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def next_counter(app: int, key: int, writable_locked: bool = False) -> bool:
"""
Increments the counter stored under the given key of the given app and
returns the new value.
"""
# extmod/modtrezorconfig/modtrezorconfig.c
def wipe() -> None:
"""
Erases the whole config. Use with caution!
"""