diff --git a/mocks/trezor/crypto/HDNode.py b/mocks/trezor/crypto/HDNode.py index 72d517a4f..cf9b6e25c 100644 --- a/mocks/trezor/crypto/HDNode.py +++ b/mocks/trezor/crypto/HDNode.py @@ -12,13 +12,13 @@ def derive_path(path: list) -> None: ''' # extmod/modtrezorcrypto/modtrezorcrypto-bip32.h -def serialize_public() -> str: +def serialize_public(version: int) -> str: ''' Serialize the public info from HD node to base58 string. ''' # extmod/modtrezorcrypto/modtrezorcrypto-bip32.h -def serialize_private() -> str: +def serialize_private(version: int) -> str: ''' Serialize the private info HD node to base58 string. ''' diff --git a/mocks/trezor/crypto/__init__.py b/mocks/trezor/crypto/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/mocks/trezor/crypto/bip32.py b/mocks/trezor/crypto/bip32.py index 4eb2a5cac..e4c401102 100644 --- a/mocks/trezor/crypto/bip32.py +++ b/mocks/trezor/crypto/bip32.py @@ -1,6 +1,6 @@ # extmod/modtrezorcrypto/modtrezorcrypto-bip32.h -def deserialize(value: str) -> HDNode: +def deserialize(value:str, version_public: int, version_private: int) -> HDNode: ''' Construct a BIP0032 HD node from a base58-serialized value. ''' diff --git a/mocks/trezor/crypto/hashlib.py b/mocks/trezor/crypto/hashlib.py index b86b6887e..3c99d2e6e 100644 --- a/mocks/trezor/crypto/hashlib.py +++ b/mocks/trezor/crypto/hashlib.py @@ -5,20 +5,8 @@ def blake2b(data: bytes=None, key: bytes=None) -> Blake2b: Creates a hash context object. ''' -# extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h -def sha3_256(data: bytes=None) -> Sha3_256: - ''' - Creates a hash context object. - ''' - -# extmod/modtrezorcrypto/modtrezorcrypto-sha512.h -def sha512(data: bytes=None) -> Sha512: - ''' - Creates a hash context object. - ''' - -# extmod/modtrezorcrypto/modtrezorcrypto-sha256.h -def sha256(data: bytes=None) -> Sha256: +# extmod/modtrezorcrypto/modtrezorcrypto-blake2s.h +def blake2s(data: bytes=None, key: bytes=None) -> Blake2s: ''' Creates a hash context object. ''' @@ -29,20 +17,32 @@ def ripemd160(data: bytes=None) -> Ripemd160: Creates a hash context object. ''' -# extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h -def sha3_512(data: bytes=None) -> Sha3_512: - ''' - Creates a hash context object. - ''' - # extmod/modtrezorcrypto/modtrezorcrypto-sha1.h def sha1(data: bytes=None) -> Sha1: ''' Creates a hash context object. ''' -# extmod/modtrezorcrypto/modtrezorcrypto-blake2s.h -def blake2s(data: bytes=None, key: bytes=None) -> Blake2s: +# extmod/modtrezorcrypto/modtrezorcrypto-sha256.h +def sha256(data: bytes=None) -> Sha256: + ''' + Creates a hash context object. + ''' + +# extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h +def sha3_256(data: bytes=None) -> Sha3_256: + ''' + Creates a hash context object. + ''' + +# extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h +def sha3_512(data: bytes=None) -> Sha3_512: + ''' + Creates a hash context object. + ''' + +# extmod/modtrezorcrypto/modtrezorcrypto-sha512.h +def sha512(data: bytes=None) -> Sha512: ''' Creates a hash context object. ''' diff --git a/mocks/trezor/debug.py b/mocks/trezor/debug.py deleted file mode 100644 index 2898ed8b1..000000000 --- a/mocks/trezor/debug.py +++ /dev/null @@ -1,6 +0,0 @@ - -# extmod/modtrezordebug/modtrezordebug.c -def memaccess(address: int, length: int) -> bytes: - ''' - Creates a bytes object that can be used to access certain memory location. - ''' diff --git a/mocks/trezor/msg.py b/mocks/trezor/msg.py index 7e20f1316..3f9e38e9e 100644 --- a/mocks/trezor/msg.py +++ b/mocks/trezor/msg.py @@ -1,18 +1,18 @@ # extmod/modtrezormsg/modtrezormsg.c -def set_interfaces(ifaces: list/tuple) -> None: +def init_usb(usb_info, usb_ifaces) -> None: ''' - Configures USB interfaces with a list/tuple of (usage_page, ...) + Registers passed interfaces and initializes the USB stack ''' # extmod/modtrezormsg/modtrezormsg.c -def get_interfaces() -> tuple: +def deinit_usb() -> None: ''' - Reads a tuple (of usage pages) of configured USB interfaces + Cleans up the USB stack ''' # extmod/modtrezormsg/modtrezormsg.c -def send(usage_page: int, message: bytes) -> int: +def send(iface: int, message: bytes) -> int: ''' Sends message using USB HID (device) or UDP (emulator). ''' diff --git a/mocks/trezor/ui/display.py b/mocks/trezor/ui/display.py index 996c477d1..bda1416e5 100644 --- a/mocks/trezor/ui/display.py +++ b/mocks/trezor/ui/display.py @@ -39,7 +39,7 @@ def icon(x: int, y: int, icon: bytes, fgcolor: int, bgcolor: int) -> None: ''' # extmod/modtrezorui/modtrezorui-display.h -def print(text: str, fgcolor: int, bgcolor: int) -> None: +def print(text: str) -> None: ''' Renders text using 5x8 bitmap font (using special text mode) '''