From a96c39a9d1a438626083cc5acc5fc11ab8a99d6e Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Wed, 27 Feb 2019 11:30:58 +0100 Subject: [PATCH] mocks: generate --- mocks/generated/trezorconfig.py | 41 ++++++++++++++++++++--- mocks/generated/trezorcrypto/bip32.py | 2 +- mocks/generated/trezorcrypto/bip39.py | 2 +- mocks/generated/trezorcrypto/secp256k1.py | 2 +- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/mocks/generated/trezorconfig.py b/mocks/generated/trezorconfig.py index 376b5184e..03f56ad4c 100644 --- a/mocks/generated/trezorconfig.py +++ b/mocks/generated/trezorconfig.py @@ -1,25 +1,31 @@ from typing import * # extmod/modtrezorconfig/modtrezorconfig.c -def init() -> None: +def init(ui_wait_callback: (int, int -> None)=None) -> None: ''' Initializes the storage. Must be called before any other method is called from this module! ''' # extmod/modtrezorconfig/modtrezorconfig.c -def check_pin(pin: int, waitcallback: (int, int -> None)) -> bool: +def check_pin(pin: int) -> bool: ''' Check the given PIN. Returns True on success, False on failure. ''' # extmod/modtrezorconfig/modtrezorconfig.c -def unlock(pin: int, waitcallback: (int, int -> None)) -> bool: +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 lock() -> None: + ''' + Locks the storage. + ''' + # extmod/modtrezorconfig/modtrezorconfig.c def has_pin() -> bool: ''' @@ -27,7 +33,13 @@ def has_pin() -> bool: ''' # extmod/modtrezorconfig/modtrezorconfig.c -def change_pin(pin: int, newpin: int, waitcallback: (int, int -> None)) -> bool: +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. ''' @@ -35,7 +47,8 @@ def change_pin(pin: int, newpin: int, waitcallback: (int, int -> None)) -> bool: # extmod/modtrezorconfig/modtrezorconfig.c def get(app: int, key: int, public: bool=False) -> bytes: ''' - Gets a value of given key for given app (or empty bytes if not set). + 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 @@ -44,6 +57,24 @@ 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: ''' diff --git a/mocks/generated/trezorcrypto/bip32.py b/mocks/generated/trezorcrypto/bip32.py index 95e4fb140..0efd9e835 100644 --- a/mocks/generated/trezorcrypto/bip32.py +++ b/mocks/generated/trezorcrypto/bip32.py @@ -112,7 +112,7 @@ class HDNode: Construct a BIP0032 HD node from a BIP0039 seed value. ''' - def from_mnemonic_cardano(mnemonic: str) -> bytes: + def from_mnemonic_cardano(mnemonic: str, passphrase: str) -> bytes: ''' Convert mnemonic to hdnode ''' diff --git a/mocks/generated/trezorcrypto/bip39.py b/mocks/generated/trezorcrypto/bip39.py index a3c2d2ece..7b66709c6 100644 --- a/mocks/generated/trezorcrypto/bip39.py +++ b/mocks/generated/trezorcrypto/bip39.py @@ -32,7 +32,7 @@ def check(mnemonic: str) -> bool: ''' # extmod/modtrezorcrypto/modtrezorcrypto-bip39.h -def seed(mnemonic: str, passphrase: str) -> bytes: +def seed(mnemonic: str, passphrase: str, callback: (int, int -> None)=None) -> bytes: ''' Generate seed from mnemonic and passphrase. ''' diff --git a/mocks/generated/trezorcrypto/secp256k1.py b/mocks/generated/trezorcrypto/secp256k1.py index 0dc82025a..985569868 100644 --- a/mocks/generated/trezorcrypto/secp256k1.py +++ b/mocks/generated/trezorcrypto/secp256k1.py @@ -13,7 +13,7 @@ def publickey(secret_key: bytes, compressed: bool = True) -> bytes: ''' # extmod/modtrezorcrypto/modtrezorcrypto-secp256k1.h -def sign(secret_key: bytes, digest: bytes, compressed: bool = True, ethereum_canonical: bool = False) -> bytes: +def sign(secret_key: bytes, digest: bytes, compressed: bool = True, canonical: int = None) -> bytes: ''' Uses secret key to produce the signature of the digest. '''