mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-27 10:22:34 +00:00
travis: add make style (using flake8)
This commit is contained in:
parent
2c3221810e
commit
73b2ea6c85
@ -38,6 +38,7 @@ script:
|
|||||||
- test "$GOAL" != "unix" || make build_unix TREZOR_NOUI=1
|
- test "$GOAL" != "unix" || make build_unix TREZOR_NOUI=1
|
||||||
- test "$GOAL" != "unix" || make test
|
- test "$GOAL" != "unix" || make test
|
||||||
- test "$GOAL" != "unix" || make testpy
|
- test "$GOAL" != "unix" || make testpy
|
||||||
|
- test "$GOAL" != "unix" || make style
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
webhooks:
|
webhooks:
|
||||||
|
3
Makefile
3
Makefile
@ -50,6 +50,9 @@ testpy: ## run selected unit tests from python-trezor
|
|||||||
pylint: ## run pylint on application sources
|
pylint: ## run pylint on application sources
|
||||||
pylint --rcfile=pylint.rc -E $(shell find src -name *.py)
|
pylint --rcfile=pylint.rc -E $(shell find src -name *.py)
|
||||||
|
|
||||||
|
style: ## run code style check on application sources
|
||||||
|
flake8 --ignore=E221,E241,E402,E501,F401 $(shell find src -name *.py)
|
||||||
|
|
||||||
## build commands:
|
## build commands:
|
||||||
|
|
||||||
build: build_boardloader build_bootloader build_firmware build_unix build_cross ## build all
|
build: build_boardloader build_bootloader build_firmware build_unix build_cross ## build all
|
||||||
|
@ -26,6 +26,7 @@ def strip(address_type, raw_address):
|
|||||||
l = length(address_type)
|
l = length(address_type)
|
||||||
return raw_address[l:]
|
return raw_address[l:]
|
||||||
|
|
||||||
|
|
||||||
def split(coin, raw_address):
|
def split(coin, raw_address):
|
||||||
l = None
|
l = None
|
||||||
for f in ['', '_p2sh', '_p2wpkh', '_p2wsh']:
|
for f in ['', '_p2sh', '_p2wpkh', '_p2wsh']:
|
||||||
|
@ -2,6 +2,7 @@ from trezor.crypto.hashlib import sha256
|
|||||||
|
|
||||||
from apps.wallet.sign_tx.signing import HashWriter, write_varint
|
from apps.wallet.sign_tx.signing import HashWriter, write_varint
|
||||||
|
|
||||||
|
|
||||||
def message_digest(coin, message):
|
def message_digest(coin, message):
|
||||||
|
|
||||||
h = HashWriter(sha256)
|
h = HashWriter(sha256)
|
||||||
|
@ -9,5 +9,6 @@ def dispatch_EthereumGetAddress(*args, **kwargs):
|
|||||||
from .ethereum_get_address import layout_ethereum_get_address
|
from .ethereum_get_address import layout_ethereum_get_address
|
||||||
return layout_ethereum_get_address(*args, **kwargs)
|
return layout_ethereum_get_address(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def boot():
|
def boot():
|
||||||
register(EthereumGetAddress, protobuf_workflow, dispatch_EthereumGetAddress)
|
register(EthereumGetAddress, protobuf_workflow, dispatch_EthereumGetAddress)
|
||||||
|
@ -13,8 +13,8 @@ async def layout_ethereum_get_address(session_id, msg):
|
|||||||
node.derive_path(msg.address_n or ())
|
node.derive_path(msg.address_n or ())
|
||||||
|
|
||||||
seckey = node.private_key()
|
seckey = node.private_key()
|
||||||
public_key = secp256k1.publickey(seckey, False) # uncompressed
|
public_key = secp256k1.publickey(seckey, False) # uncompressed
|
||||||
address = sha3_256(public_key[1:]).digest(True)[12:] # Keccak
|
address = sha3_256(public_key[1:]).digest(True)[12:] # Keccak
|
||||||
|
|
||||||
if msg.show_display:
|
if msg.show_display:
|
||||||
await _show_address(session_id, address)
|
await _show_address(session_id, address)
|
||||||
|
@ -86,8 +86,8 @@ _APDU_DATA = const(7) # uint8_t data[1]; // Data field
|
|||||||
|
|
||||||
|
|
||||||
def frame_init() -> dict:
|
def frame_init() -> dict:
|
||||||
# uint32_t cid; // Channel identifier
|
# uint32_t cid; // Channel identifier
|
||||||
# uint8_t cmd; // Command - b7 set
|
# uint8_t cmd; // Command - b7 set
|
||||||
# uint8_t bcnth; // Message byte count - high part
|
# uint8_t bcnth; // Message byte count - high part
|
||||||
# uint8_t bcntl; // Message byte count - low part
|
# uint8_t bcntl; // Message byte count - low part
|
||||||
# uint8_t data[HID_RPT_SIZE - 7]; // Data payload
|
# uint8_t data[HID_RPT_SIZE - 7]; // Data payload
|
||||||
@ -100,8 +100,8 @@ def frame_init() -> dict:
|
|||||||
|
|
||||||
|
|
||||||
def frame_cont() -> dict:
|
def frame_cont() -> dict:
|
||||||
# uint32_t cid; // Channel identifier
|
# uint32_t cid; // Channel identifier
|
||||||
# uint8_t seq; // Sequence number - b7 cleared
|
# uint8_t seq; // Sequence number - b7 cleared
|
||||||
# uint8_t data[HID_RPT_SIZE - 5]; // Data payload
|
# uint8_t data[HID_RPT_SIZE - 5]; // Data payload
|
||||||
return {
|
return {
|
||||||
'cid': 0 | uctypes.UINT32,
|
'cid': 0 | uctypes.UINT32,
|
||||||
@ -114,7 +114,7 @@ def resp_cmd_init() -> dict:
|
|||||||
# uint8_t nonce[8]; // Client application nonce
|
# uint8_t nonce[8]; // Client application nonce
|
||||||
# uint32_t cid; // Channel identifier
|
# uint32_t cid; // Channel identifier
|
||||||
# uint8_t versionInterface; // Interface version
|
# uint8_t versionInterface; // Interface version
|
||||||
# uint8_t versionMajor; // Major version number
|
# uint8_t versionMajor; // Major version number
|
||||||
# uint8_t versionMinor; // Minor version number
|
# uint8_t versionMinor; // Minor version number
|
||||||
# uint8_t versionBuild; // Build version number
|
# uint8_t versionBuild; // Build version number
|
||||||
# uint8_t capFlags; // Capabilities flags
|
# uint8_t capFlags; // Capabilities flags
|
||||||
@ -415,8 +415,7 @@ class ConfirmContent(ui.Widget):
|
|||||||
name = knownapps.knownapps[app_id]
|
name = knownapps.knownapps[app_id]
|
||||||
icon = res.load('apps/fido_u2f/res/u2f_%s.toif' % name.lower().replace(' ', '_'))
|
icon = res.load('apps/fido_u2f/res/u2f_%s.toif' % name.lower().replace(' ', '_'))
|
||||||
else:
|
else:
|
||||||
name = ubinascii.hexlify(app_id[:4]) + '...' + \
|
name = '%s...%s' % (ubinascii.hexlify(app_id[:4]), ubinascii.hexlify(app_id[-4:]))
|
||||||
ubinascii.hexlify(app_id[-4:])
|
|
||||||
icon = res.load('apps/fido_u2f/res/u2f_unknown.toif')
|
icon = res.load('apps/fido_u2f/res/u2f_unknown.toif')
|
||||||
self.app_name = name
|
self.app_name = name
|
||||||
self.app_icon = icon
|
self.app_icon = icon
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
from trezor.crypto import hashlib
|
from trezor.crypto import hashlib
|
||||||
|
|
||||||
knownapps = {
|
knownapps = {
|
||||||
hashlib.sha256(b'https://bitbucket.org').digest() : 'Bitbucket',
|
hashlib.sha256(b'https://bitbucket.org').digest(): 'Bitbucket',
|
||||||
hashlib.sha256(b'https://www.dropbox.com/u2f-app-id.json').digest() : 'Dropbox',
|
hashlib.sha256(b'https://www.dropbox.com/u2f-app-id.json').digest(): 'Dropbox',
|
||||||
hashlib.sha256(b'https://www.fastmail.com').digest() : 'FastMail',
|
hashlib.sha256(b'https://www.fastmail.com').digest(): 'FastMail',
|
||||||
hashlib.sha256(b'https://github.com/u2f/trusted_facets').digest() : 'GitHub',
|
hashlib.sha256(b'https://github.com/u2f/trusted_facets').digest(): 'GitHub',
|
||||||
hashlib.sha256(b'https://gitlab.com').digest() : 'GitLab',
|
hashlib.sha256(b'https://gitlab.com').digest(): 'GitLab',
|
||||||
hashlib.sha256(b'https://www.gstatic.com/securitykey/origins.json').digest() : 'Google',
|
hashlib.sha256(b'https://www.gstatic.com/securitykey/origins.json').digest(): 'Google',
|
||||||
hashlib.sha256(b'https://slushpool.com/static/security/u2f.json').digest() : 'Slush Pool',
|
hashlib.sha256(b'https://slushpool.com/static/security/u2f.json').digest(): 'Slush Pool',
|
||||||
hashlib.sha256(b'https://demo.yubico.com').digest() : 'Yubico U2F Demo',
|
hashlib.sha256(b'https://demo.yubico.com').digest(): 'Yubico U2F Demo',
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ async def layout_get_entropy(session_id, msg):
|
|||||||
from trezor.messages.Entropy import Entropy
|
from trezor.messages.Entropy import Entropy
|
||||||
from trezor.crypto import random
|
from trezor.crypto import random
|
||||||
|
|
||||||
|
|
||||||
l = min(msg.size, 1024)
|
l = min(msg.size, 1024)
|
||||||
|
|
||||||
await _show_entropy(session_id)
|
await _show_entropy(session_id)
|
||||||
|
@ -53,7 +53,6 @@ def sign_challenge(seckey: bytes,
|
|||||||
from trezor.crypto.curve import ed25519
|
from trezor.crypto.curve import ed25519
|
||||||
from ..common.signverify import message_digest
|
from ..common.signverify import message_digest
|
||||||
|
|
||||||
|
|
||||||
if sigtype == 'gpg':
|
if sigtype == 'gpg':
|
||||||
data = challenge_hidden
|
data = challenge_hidden
|
||||||
elif sigtype == 'ssh':
|
elif sigtype == 'ssh':
|
||||||
@ -63,8 +62,7 @@ def sign_challenge(seckey: bytes,
|
|||||||
data = challenge_hidden
|
data = challenge_hidden
|
||||||
else:
|
else:
|
||||||
# sigtype is coin
|
# sigtype is coin
|
||||||
challenge = sha256(challenge_hidden).digest() + \
|
challenge = sha256(challenge_hidden).digest() + sha256(challenge_visual).digest()
|
||||||
sha256(challenge_visual).digest()
|
|
||||||
data = message_digest(sigtype, challenge)
|
data = message_digest(sigtype, challenge)
|
||||||
|
|
||||||
if curve == 'secp256k1':
|
if curve == 'secp256k1':
|
||||||
|
@ -162,7 +162,7 @@ class MessageType(Type):
|
|||||||
@classmethod
|
@classmethod
|
||||||
async def load(cls, source=None, target=None):
|
async def load(cls, source=None, target=None):
|
||||||
if target is None:
|
if target is None:
|
||||||
target = build_protobuf_message(cls)
|
target = build_message(cls)
|
||||||
if source is None:
|
if source is None:
|
||||||
source = StreamReader()
|
source = StreamReader()
|
||||||
try:
|
try:
|
||||||
|
@ -48,6 +48,7 @@ class __dummy:
|
|||||||
def __getitem__(self, *args):
|
def __getitem__(self, *args):
|
||||||
return object
|
return object
|
||||||
|
|
||||||
|
|
||||||
__t = __dummy()
|
__t = __dummy()
|
||||||
|
|
||||||
for __n in __names_get:
|
for __n in __names_get:
|
||||||
@ -64,4 +65,5 @@ def TypeVar(*args):
|
|||||||
def NewType(*args):
|
def NewType(*args):
|
||||||
return lambda x: x
|
return lambda x: x
|
||||||
|
|
||||||
|
|
||||||
TYPE_CHECKING = False
|
TYPE_CHECKING = False
|
||||||
|
@ -59,25 +59,23 @@ def decode(string: str) -> bytes:
|
|||||||
return bytes((b for b in reversed(result + [0] * (origlen - newlen))))
|
return bytes((b for b in reversed(result + [0] * (origlen - newlen))))
|
||||||
|
|
||||||
|
|
||||||
def encode_check(data: bytes, digestfunc=None) -> str:
|
def _dsha256_32(data: bytes) -> bytes:
|
||||||
|
from .hashlib import sha256
|
||||||
|
return sha256(sha256(data).digest()).digest()[:4]
|
||||||
|
|
||||||
|
|
||||||
|
def encode_check(data: bytes, digestfunc=_dsha256_32) -> str:
|
||||||
'''
|
'''
|
||||||
Convert bytes to base58 encoded string, append checksum.
|
Convert bytes to base58 encoded string, append checksum.
|
||||||
'''
|
'''
|
||||||
if digestfunc is None:
|
|
||||||
from .hashlib import sha256
|
|
||||||
digestfunc = lambda x: sha256(sha256(x).digest()).digest()[:4]
|
|
||||||
return encode(data + digestfunc(data))
|
return encode(data + digestfunc(data))
|
||||||
|
|
||||||
|
|
||||||
def decode_check(string: str, digestfunc=None) -> bytes:
|
def decode_check(string: str, digestfunc=_dsha256_32) -> bytes:
|
||||||
'''
|
'''
|
||||||
Convert base58 encoded string to bytes and verify checksum.
|
Convert base58 encoded string to bytes and verify checksum.
|
||||||
'''
|
'''
|
||||||
result = decode(string)
|
result = decode(string)
|
||||||
|
|
||||||
if digestfunc is None:
|
|
||||||
from .hashlib import sha256
|
|
||||||
digestfunc = lambda x: sha256(sha256(x).digest()).digest()[:4]
|
|
||||||
digestlen = len(digestfunc(b''))
|
digestlen = len(digestfunc(b''))
|
||||||
result, check = result[:-digestlen], result[-digestlen:]
|
result, check = result[:-digestlen], result[-digestlen:]
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class Address(p.MessageType):
|
class Address(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address', p.UnicodeType, 0), # required
|
1: ('address', p.UnicodeType, 0), # required
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 30
|
MESSAGE_WIRE_TYPE = 30
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class ApplySettings(p.MessageType):
|
class ApplySettings(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('language', p.UnicodeType, 0),
|
1: ('language', p.UnicodeType, 0),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class ButtonAck(p.MessageType):
|
class ButtonAck(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 27
|
MESSAGE_WIRE_TYPE = 27
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class ButtonRequest(p.MessageType):
|
class ButtonRequest(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('code', p.UVarintType, 0),
|
1: ('code', p.UVarintType, 0),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class Cancel(p.MessageType):
|
class Cancel(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 20
|
MESSAGE_WIRE_TYPE = 20
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class ChangePin(p.MessageType):
|
class ChangePin(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('remove', p.BoolType, 0),
|
1: ('remove', p.BoolType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class CipherKeyValue(p.MessageType):
|
class CipherKeyValue(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class CipheredKeyValue(p.MessageType):
|
class CipheredKeyValue(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('value', p.BytesType, 0),
|
1: ('value', p.BytesType, 0),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class ClearSession(p.MessageType):
|
class ClearSession(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 24
|
MESSAGE_WIRE_TYPE = 24
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class CoinType(p.MessageType):
|
class CoinType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('coin_name', p.UnicodeType, 0),
|
1: ('coin_name', p.UnicodeType, 0),
|
||||||
2: ('coin_shortcut', p.UnicodeType, 0),
|
2: ('coin_shortcut', p.UnicodeType, 0),
|
||||||
3: ('address_type', p.UVarintType, 0), # default=0
|
3: ('address_type', p.UVarintType, 0), # default=0
|
||||||
4: ('maxfee_kb', p.UVarintType, 0),
|
4: ('maxfee_kb', p.UVarintType, 0),
|
||||||
5: ('address_type_p2sh', p.UVarintType, 0), # default=5
|
5: ('address_type_p2sh', p.UVarintType, 0), # default=5
|
||||||
8: ('signed_message_header', p.UnicodeType, 0),
|
8: ('signed_message_header', p.UnicodeType, 0),
|
||||||
9: ('xpub_magic', p.UVarintType, 0), # default=76067358
|
9: ('xpub_magic', p.UVarintType, 0), # default=76067358
|
||||||
10: ('xprv_magic', p.UVarintType, 0), # default=76066276
|
10: ('xprv_magic', p.UVarintType, 0), # default=76066276
|
||||||
11: ('segwit', p.BoolType, 0),
|
11: ('segwit', p.BoolType, 0),
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DebugLinkDecision(p.MessageType):
|
class DebugLinkDecision(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('yes_no', p.BoolType, 0), # required
|
1: ('yes_no', p.BoolType, 0), # required
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 100
|
MESSAGE_WIRE_TYPE = 100
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DebugLinkFlashErase(p.MessageType):
|
class DebugLinkFlashErase(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('sector', p.UVarintType, 0),
|
1: ('sector', p.UVarintType, 0),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DebugLinkGetState(p.MessageType):
|
class DebugLinkGetState(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 101
|
MESSAGE_WIRE_TYPE = 101
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DebugLinkLog(p.MessageType):
|
class DebugLinkLog(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('level', p.UVarintType, 0),
|
1: ('level', p.UVarintType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DebugLinkMemory(p.MessageType):
|
class DebugLinkMemory(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('memory', p.BytesType, 0),
|
1: ('memory', p.BytesType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DebugLinkMemoryRead(p.MessageType):
|
class DebugLinkMemoryRead(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address', p.UVarintType, 0),
|
1: ('address', p.UVarintType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DebugLinkMemoryWrite(p.MessageType):
|
class DebugLinkMemoryWrite(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address', p.UVarintType, 0),
|
1: ('address', p.UVarintType, 0),
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .HDNodeType import HDNodeType
|
from .HDNodeType import HDNodeType
|
||||||
|
|
||||||
|
|
||||||
class DebugLinkState(p.MessageType):
|
class DebugLinkState(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('layout', p.BytesType, 0),
|
1: ('layout', p.BytesType, 0),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DebugLinkStop(p.MessageType):
|
class DebugLinkStop(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 103
|
MESSAGE_WIRE_TYPE = 103
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DecryptMessage(p.MessageType):
|
class DecryptMessage(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class DecryptedMessage(p.MessageType):
|
class DecryptedMessage(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('message', p.BytesType, 0),
|
1: ('message', p.BytesType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class ECDHSessionKey(p.MessageType):
|
class ECDHSessionKey(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('session_key', p.BytesType, 0),
|
1: ('session_key', p.BytesType, 0),
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EncryptMessage(p.MessageType):
|
class EncryptMessage(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('pubkey', p.BytesType, 0),
|
1: ('pubkey', p.BytesType, 0),
|
||||||
2: ('message', p.BytesType, 0),
|
2: ('message', p.BytesType, 0),
|
||||||
3: ('display_only', p.BoolType, 0),
|
3: ('display_only', p.BoolType, 0),
|
||||||
4: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
4: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
5: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
5: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 49
|
MESSAGE_WIRE_TYPE = 49
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EncryptedMessage(p.MessageType):
|
class EncryptedMessage(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('nonce', p.BytesType, 0),
|
1: ('nonce', p.BytesType, 0),
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class Entropy(p.MessageType):
|
class Entropy(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('entropy', p.BytesType, 0), # required
|
1: ('entropy', p.BytesType, 0), # required
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 10
|
MESSAGE_WIRE_TYPE = 10
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EntropyAck(p.MessageType):
|
class EntropyAck(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('entropy', p.BytesType, 0),
|
1: ('entropy', p.BytesType, 0),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EntropyRequest(p.MessageType):
|
class EntropyRequest(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 35
|
MESSAGE_WIRE_TYPE = 35
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EstimateTxSize(p.MessageType):
|
class EstimateTxSize(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('outputs_count', p.UVarintType, 0), # required
|
1: ('outputs_count', p.UVarintType, 0), # required
|
||||||
2: ('inputs_count', p.UVarintType, 0), # required
|
2: ('inputs_count', p.UVarintType, 0), # required
|
||||||
3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 43
|
MESSAGE_WIRE_TYPE = 43
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EthereumAddress(p.MessageType):
|
class EthereumAddress(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address', p.BytesType, 0), # required
|
1: ('address', p.BytesType, 0), # required
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 57
|
MESSAGE_WIRE_TYPE = 57
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EthereumGetAddress(p.MessageType):
|
class EthereumGetAddress(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EthereumSignTx(p.MessageType):
|
class EthereumSignTx(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EthereumTxAck(p.MessageType):
|
class EthereumTxAck(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('data_chunk', p.BytesType, 0),
|
1: ('data_chunk', p.BytesType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class EthereumTxRequest(p.MessageType):
|
class EthereumTxRequest(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('data_length', p.UVarintType, 0),
|
1: ('data_length', p.UVarintType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class Failure(p.MessageType):
|
class Failure(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('code', p.UVarintType, 0),
|
1: ('code', p.UVarintType, 0),
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .CoinType import CoinType
|
from .CoinType import CoinType
|
||||||
|
|
||||||
|
|
||||||
class Features(p.MessageType):
|
class Features(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('vendor', p.UnicodeType, 0),
|
1: ('vendor', p.UnicodeType, 0),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class FirmwareErase(p.MessageType):
|
class FirmwareErase(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 6
|
MESSAGE_WIRE_TYPE = 6
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class FirmwareRequest(p.MessageType):
|
class FirmwareRequest(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('offset', p.UVarintType, 0),
|
1: ('offset', p.UVarintType, 0),
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class FirmwareUpload(p.MessageType):
|
class FirmwareUpload(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('payload', p.BytesType, 0), # required
|
1: ('payload', p.BytesType, 0), # required
|
||||||
2: ('hash', p.BytesType, 0),
|
2: ('hash', p.BytesType, 0),
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 7
|
MESSAGE_WIRE_TYPE = 7
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .MultisigRedeemScriptType import MultisigRedeemScriptType
|
from .MultisigRedeemScriptType import MultisigRedeemScriptType
|
||||||
|
|
||||||
|
|
||||||
class GetAddress(p.MessageType):
|
class GetAddress(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
2: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
2: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
||||||
3: ('show_display', p.BoolType, 0),
|
3: ('show_display', p.BoolType, 0),
|
||||||
4: ('multisig', MultisigRedeemScriptType, 0),
|
4: ('multisig', MultisigRedeemScriptType, 0),
|
||||||
5: ('script_type', p.UVarintType, 0), # default=0
|
5: ('script_type', p.UVarintType, 0), # default=0
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 29
|
MESSAGE_WIRE_TYPE = 29
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .IdentityType import IdentityType
|
from .IdentityType import IdentityType
|
||||||
|
|
||||||
|
|
||||||
class GetECDHSessionKey(p.MessageType):
|
class GetECDHSessionKey(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('identity', IdentityType, 0),
|
1: ('identity', IdentityType, 0),
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class GetEntropy(p.MessageType):
|
class GetEntropy(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('size', p.UVarintType, 0), # required
|
1: ('size', p.UVarintType, 0), # required
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 9
|
MESSAGE_WIRE_TYPE = 9
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class GetFeatures(p.MessageType):
|
class GetFeatures(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 55
|
MESSAGE_WIRE_TYPE = 55
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class GetPublicKey(p.MessageType):
|
class GetPublicKey(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
2: ('ecdsa_curve_name', p.UnicodeType, 0),
|
2: ('ecdsa_curve_name', p.UnicodeType, 0),
|
||||||
3: ('show_display', p.BoolType, 0),
|
3: ('show_display', p.BoolType, 0),
|
||||||
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 11
|
MESSAGE_WIRE_TYPE = 11
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .HDNodeType import HDNodeType
|
from .HDNodeType import HDNodeType
|
||||||
|
|
||||||
|
|
||||||
class HDNodePathType(p.MessageType):
|
class HDNodePathType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('node', HDNodeType, 0), # required
|
1: ('node', HDNodeType, 0), # required
|
||||||
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class HDNodeType(p.MessageType):
|
class HDNodeType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('depth', p.UVarintType, 0), # required
|
1: ('depth', p.UVarintType, 0), # required
|
||||||
2: ('fingerprint', p.UVarintType, 0), # required
|
2: ('fingerprint', p.UVarintType, 0), # required
|
||||||
3: ('child_num', p.UVarintType, 0), # required
|
3: ('child_num', p.UVarintType, 0), # required
|
||||||
4: ('chain_code', p.BytesType, 0), # required
|
4: ('chain_code', p.BytesType, 0), # required
|
||||||
5: ('private_key', p.BytesType, 0),
|
5: ('private_key', p.BytesType, 0),
|
||||||
6: ('public_key', p.BytesType, 0),
|
6: ('public_key', p.BytesType, 0),
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class IdentityType(p.MessageType):
|
class IdentityType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('proto', p.UnicodeType, 0),
|
1: ('proto', p.UnicodeType, 0),
|
||||||
@ -10,5 +9,5 @@ class IdentityType(p.MessageType):
|
|||||||
3: ('host', p.UnicodeType, 0),
|
3: ('host', p.UnicodeType, 0),
|
||||||
4: ('port', p.UnicodeType, 0),
|
4: ('port', p.UnicodeType, 0),
|
||||||
5: ('path', p.UnicodeType, 0),
|
5: ('path', p.UnicodeType, 0),
|
||||||
6: ('index', p.UVarintType, 0), # default=0
|
6: ('index', p.UVarintType, 0), # default=0
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class Initialize(p.MessageType):
|
class Initialize(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 0
|
MESSAGE_WIRE_TYPE = 0
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .HDNodeType import HDNodeType
|
from .HDNodeType import HDNodeType
|
||||||
|
|
||||||
|
|
||||||
class LoadDevice(p.MessageType):
|
class LoadDevice(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('mnemonic', p.UnicodeType, 0),
|
1: ('mnemonic', p.UnicodeType, 0),
|
||||||
2: ('node', HDNodeType, 0),
|
2: ('node', HDNodeType, 0),
|
||||||
3: ('pin', p.UnicodeType, 0),
|
3: ('pin', p.UnicodeType, 0),
|
||||||
4: ('passphrase_protection', p.BoolType, 0),
|
4: ('passphrase_protection', p.BoolType, 0),
|
||||||
5: ('language', p.UnicodeType, 0), # default=u'english'
|
5: ('language', p.UnicodeType, 0), # default=u'english'
|
||||||
6: ('label', p.UnicodeType, 0),
|
6: ('label', p.UnicodeType, 0),
|
||||||
7: ('skip_checksum', p.BoolType, 0),
|
7: ('skip_checksum', p.BoolType, 0),
|
||||||
8: ('u2f_counter', p.UVarintType, 0),
|
8: ('u2f_counter', p.UVarintType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class MessageSignature(p.MessageType):
|
class MessageSignature(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address', p.UnicodeType, 0),
|
1: ('address', p.UnicodeType, 0),
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .HDNodePathType import HDNodePathType
|
from .HDNodePathType import HDNodePathType
|
||||||
|
|
||||||
|
|
||||||
class MultisigRedeemScriptType(p.MessageType):
|
class MultisigRedeemScriptType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('pubkeys', HDNodePathType, p.FLAG_REPEATED),
|
1: ('pubkeys', HDNodePathType, p.FLAG_REPEATED),
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class PassphraseAck(p.MessageType):
|
class PassphraseAck(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('passphrase', p.UnicodeType, 0), # required
|
1: ('passphrase', p.UnicodeType, 0), # required
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 42
|
MESSAGE_WIRE_TYPE = 42
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class PassphraseRequest(p.MessageType):
|
class PassphraseRequest(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 41
|
MESSAGE_WIRE_TYPE = 41
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class PinMatrixAck(p.MessageType):
|
class PinMatrixAck(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('pin', p.UnicodeType, 0), # required
|
1: ('pin', p.UnicodeType, 0), # required
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 19
|
MESSAGE_WIRE_TYPE = 19
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class PinMatrixRequest(p.MessageType):
|
class PinMatrixRequest(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('type', p.UVarintType, 0),
|
1: ('type', p.UVarintType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class Ping(p.MessageType):
|
class Ping(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('message', p.UnicodeType, 0),
|
1: ('message', p.UnicodeType, 0),
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .HDNodeType import HDNodeType
|
from .HDNodeType import HDNodeType
|
||||||
|
|
||||||
|
|
||||||
class PublicKey(p.MessageType):
|
class PublicKey(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('node', HDNodeType, 0), # required
|
1: ('node', HDNodeType, 0), # required
|
||||||
2: ('xpub', p.UnicodeType, 0),
|
2: ('xpub', p.UnicodeType, 0),
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 12
|
MESSAGE_WIRE_TYPE = 12
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class RecoveryDevice(p.MessageType):
|
class RecoveryDevice(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('word_count', p.UVarintType, 0),
|
1: ('word_count', p.UVarintType, 0),
|
||||||
2: ('passphrase_protection', p.BoolType, 0),
|
2: ('passphrase_protection', p.BoolType, 0),
|
||||||
3: ('pin_protection', p.BoolType, 0),
|
3: ('pin_protection', p.BoolType, 0),
|
||||||
4: ('language', p.UnicodeType, 0), # default=u'english'
|
4: ('language', p.UnicodeType, 0), # default=u'english'
|
||||||
5: ('label', p.UnicodeType, 0),
|
5: ('label', p.UnicodeType, 0),
|
||||||
6: ('enforce_wordlist', p.BoolType, 0),
|
6: ('enforce_wordlist', p.BoolType, 0),
|
||||||
8: ('type', p.UVarintType, 0),
|
8: ('type', p.UVarintType, 0),
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class ResetDevice(p.MessageType):
|
class ResetDevice(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('display_random', p.BoolType, 0),
|
1: ('display_random', p.BoolType, 0),
|
||||||
2: ('strength', p.UVarintType, 0), # default=256
|
2: ('strength', p.UVarintType, 0), # default=256
|
||||||
3: ('passphrase_protection', p.BoolType, 0),
|
3: ('passphrase_protection', p.BoolType, 0),
|
||||||
4: ('pin_protection', p.BoolType, 0),
|
4: ('pin_protection', p.BoolType, 0),
|
||||||
5: ('language', p.UnicodeType, 0), # default=u'english'
|
5: ('language', p.UnicodeType, 0), # default=u'english'
|
||||||
6: ('label', p.UnicodeType, 0),
|
6: ('label', p.UnicodeType, 0),
|
||||||
7: ('u2f_counter', p.UVarintType, 0),
|
7: ('u2f_counter', p.UVarintType, 0),
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class SetU2FCounter(p.MessageType):
|
class SetU2FCounter(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('u2f_counter', p.UVarintType, 0),
|
1: ('u2f_counter', p.UVarintType, 0),
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .IdentityType import IdentityType
|
from .IdentityType import IdentityType
|
||||||
|
|
||||||
|
|
||||||
class SignIdentity(p.MessageType):
|
class SignIdentity(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('identity', IdentityType, 0),
|
1: ('identity', IdentityType, 0),
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class SignMessage(p.MessageType):
|
class SignMessage(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
2: ('message', p.BytesType, 0), # required
|
2: ('message', p.BytesType, 0), # required
|
||||||
3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 38
|
MESSAGE_WIRE_TYPE = 38
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class SignTx(p.MessageType):
|
class SignTx(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('outputs_count', p.UVarintType, 0), # required
|
1: ('outputs_count', p.UVarintType, 0), # required
|
||||||
2: ('inputs_count', p.UVarintType, 0), # required
|
2: ('inputs_count', p.UVarintType, 0), # required
|
||||||
3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
3: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
||||||
4: ('version', p.UVarintType, 0), # default=1
|
4: ('version', p.UVarintType, 0), # default=1
|
||||||
5: ('lock_time', p.UVarintType, 0), # default=0
|
5: ('lock_time', p.UVarintType, 0), # default=0
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 15
|
MESSAGE_WIRE_TYPE = 15
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class SignedIdentity(p.MessageType):
|
class SignedIdentity(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address', p.UnicodeType, 0),
|
1: ('address', p.UnicodeType, 0),
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .TxInputType import TxInputType
|
from .TxInputType import TxInputType
|
||||||
from .TxOutputType import TxOutputType
|
from .TxOutputType import TxOutputType
|
||||||
from .TransactionType import TransactionType
|
from .TransactionType import TransactionType
|
||||||
|
|
||||||
|
|
||||||
class SimpleSignTx(p.MessageType):
|
class SimpleSignTx(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('inputs', TxInputType, p.FLAG_REPEATED),
|
1: ('inputs', TxInputType, p.FLAG_REPEATED),
|
||||||
2: ('outputs', TxOutputType, p.FLAG_REPEATED),
|
2: ('outputs', TxOutputType, p.FLAG_REPEATED),
|
||||||
3: ('transactions', TransactionType, p.FLAG_REPEATED),
|
3: ('transactions', TransactionType, p.FLAG_REPEATED),
|
||||||
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
||||||
5: ('version', p.UVarintType, 0), # default=1
|
5: ('version', p.UVarintType, 0), # default=1
|
||||||
6: ('lock_time', p.UVarintType, 0), # default=0
|
6: ('lock_time', p.UVarintType, 0), # default=0
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 16
|
MESSAGE_WIRE_TYPE = 16
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .HDNodeType import HDNodeType
|
from .HDNodeType import HDNodeType
|
||||||
|
|
||||||
|
|
||||||
class Storage(p.MessageType):
|
class Storage(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('version', p.UVarintType, 0), # required
|
1: ('version', p.UVarintType, 0), # required
|
||||||
2: ('node', HDNodeType, 0),
|
2: ('node', HDNodeType, 0),
|
||||||
3: ('mnemonic', p.UnicodeType, 0),
|
3: ('mnemonic', p.UnicodeType, 0),
|
||||||
4: ('passphrase_protection', p.BoolType, 0),
|
4: ('passphrase_protection', p.BoolType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class Success(p.MessageType):
|
class Success(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('message', p.UnicodeType, 0),
|
1: ('message', p.UnicodeType, 0),
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .TxInputType import TxInputType
|
from .TxInputType import TxInputType
|
||||||
from .TxOutputBinType import TxOutputBinType
|
from .TxOutputBinType import TxOutputBinType
|
||||||
from .TxOutputType import TxOutputType
|
from .TxOutputType import TxOutputType
|
||||||
|
|
||||||
|
|
||||||
class TransactionType(p.MessageType):
|
class TransactionType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('version', p.UVarintType, 0),
|
1: ('version', p.UVarintType, 0),
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .TransactionType import TransactionType
|
from .TransactionType import TransactionType
|
||||||
|
|
||||||
|
|
||||||
class TxAck(p.MessageType):
|
class TxAck(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('tx', TransactionType, 0),
|
1: ('tx', TransactionType, 0),
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .MultisigRedeemScriptType import MultisigRedeemScriptType
|
from .MultisigRedeemScriptType import MultisigRedeemScriptType
|
||||||
|
|
||||||
|
|
||||||
class TxInputType(p.MessageType):
|
class TxInputType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
2: ('prev_hash', p.BytesType, 0), # required
|
2: ('prev_hash', p.BytesType, 0), # required
|
||||||
3: ('prev_index', p.UVarintType, 0), # required
|
3: ('prev_index', p.UVarintType, 0), # required
|
||||||
4: ('script_sig', p.BytesType, 0),
|
4: ('script_sig', p.BytesType, 0),
|
||||||
5: ('sequence', p.UVarintType, 0), # default=4294967295
|
5: ('sequence', p.UVarintType, 0), # default=4294967295
|
||||||
6: ('script_type', p.UVarintType, 0), # default=0
|
6: ('script_type', p.UVarintType, 0), # default=0
|
||||||
7: ('multisig', MultisigRedeemScriptType, 0),
|
7: ('multisig', MultisigRedeemScriptType, 0),
|
||||||
8: ('amount', p.UVarintType, 0),
|
8: ('amount', p.UVarintType, 0),
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class TxOutputBinType(p.MessageType):
|
class TxOutputBinType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('amount', p.UVarintType, 0), # required
|
1: ('amount', p.UVarintType, 0), # required
|
||||||
2: ('script_pubkey', p.BytesType, 0), # required
|
2: ('script_pubkey', p.BytesType, 0), # required
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .MultisigRedeemScriptType import MultisigRedeemScriptType
|
from .MultisigRedeemScriptType import MultisigRedeemScriptType
|
||||||
|
|
||||||
|
|
||||||
class TxOutputType(p.MessageType):
|
class TxOutputType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address', p.UnicodeType, 0),
|
1: ('address', p.UnicodeType, 0),
|
||||||
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
2: ('address_n', p.UVarintType, p.FLAG_REPEATED),
|
||||||
3: ('amount', p.UVarintType, 0), # required
|
3: ('amount', p.UVarintType, 0), # required
|
||||||
4: ('script_type', p.UVarintType, 0), # required
|
4: ('script_type', p.UVarintType, 0), # required
|
||||||
5: ('multisig', MultisigRedeemScriptType, 0),
|
5: ('multisig', MultisigRedeemScriptType, 0),
|
||||||
6: ('op_return_data', p.BytesType, 0),
|
6: ('op_return_data', p.BytesType, 0),
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
from .TxRequestDetailsType import TxRequestDetailsType
|
from .TxRequestDetailsType import TxRequestDetailsType
|
||||||
from .TxRequestSerializedType import TxRequestSerializedType
|
from .TxRequestSerializedType import TxRequestSerializedType
|
||||||
|
|
||||||
|
|
||||||
class TxRequest(p.MessageType):
|
class TxRequest(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('request_type', p.UVarintType, 0),
|
1: ('request_type', p.UVarintType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class TxRequestDetailsType(p.MessageType):
|
class TxRequestDetailsType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('request_index', p.UVarintType, 0),
|
1: ('request_index', p.UVarintType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class TxRequestSerializedType(p.MessageType):
|
class TxRequestSerializedType(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('signature_index', p.UVarintType, 0),
|
1: ('signature_index', p.UVarintType, 0),
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class TxSize(p.MessageType):
|
class TxSize(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('tx_size', p.UVarintType, 0),
|
1: ('tx_size', p.UVarintType, 0),
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class VerifyMessage(p.MessageType):
|
class VerifyMessage(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('address', p.UnicodeType, 0),
|
1: ('address', p.UnicodeType, 0),
|
||||||
2: ('signature', p.BytesType, 0),
|
2: ('signature', p.BytesType, 0),
|
||||||
3: ('message', p.BytesType, 0),
|
3: ('message', p.BytesType, 0),
|
||||||
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
4: ('coin_name', p.UnicodeType, 0), # default=u'Bitcoin'
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 39
|
MESSAGE_WIRE_TYPE = 39
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class WipeDevice(p.MessageType):
|
class WipeDevice(p.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 5
|
MESSAGE_WIRE_TYPE = 5
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class WordAck(p.MessageType):
|
class WordAck(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('word', p.UnicodeType, 0), # required
|
1: ('word', p.UnicodeType, 0), # required
|
||||||
}
|
}
|
||||||
MESSAGE_WIRE_TYPE = 47
|
MESSAGE_WIRE_TYPE = 47
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Automatically generated by pb2py
|
# Automatically generated by pb2py
|
||||||
from micropython import const
|
|
||||||
|
|
||||||
import protobuf as p
|
import protobuf as p
|
||||||
|
|
||||||
|
|
||||||
class WordRequest(p.MessageType):
|
class WordRequest(p.MessageType):
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: ('type', p.UVarintType, 0),
|
1: ('type', p.UVarintType, 0),
|
||||||
|
@ -9,5 +9,5 @@ def get_protobuf_type_name(wire_type):
|
|||||||
|
|
||||||
def get_protobuf_type(wire_type):
|
def get_protobuf_type(wire_type):
|
||||||
name = get_protobuf_type_name(wire_type)
|
name = get_protobuf_type_name(wire_type)
|
||||||
module = __import__('trezor.messages.%s' % name, None, None, (name,) , 0)
|
module = __import__('trezor.messages.%s' % name, None, None, (name, ), 0)
|
||||||
return getattr(module, name)
|
return getattr(module, name)
|
||||||
|
@ -20,4 +20,5 @@ def gettext(message):
|
|||||||
'''
|
'''
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
_ = gettext
|
_ = gettext
|
||||||
|
@ -18,9 +18,9 @@ def rgbcolor(r: int, g: int, b: int) -> int:
|
|||||||
|
|
||||||
|
|
||||||
LIGHT_RED = rgbcolor(0xFF, 0x00, 0x00)
|
LIGHT_RED = rgbcolor(0xFF, 0x00, 0x00)
|
||||||
#RED E4572E
|
# RED E4572E
|
||||||
RED = rgbcolor(0xE4, 0x57, 0x2E)
|
RED = rgbcolor(0xE4, 0x57, 0x2E)
|
||||||
#ACTIVE DARK RED A64022
|
# ACTIVE DARK RED A64022
|
||||||
ACTIVE_RED = rgbcolor(0xA6, 0x40, 0x22)
|
ACTIVE_RED = rgbcolor(0xA6, 0x40, 0x22)
|
||||||
PINK = rgbcolor(0xE9, 0x1E, 0x63)
|
PINK = rgbcolor(0xE9, 0x1E, 0x63)
|
||||||
PURPLE = rgbcolor(0x9C, 0x27, 0xB0)
|
PURPLE = rgbcolor(0x9C, 0x27, 0xB0)
|
||||||
@ -31,9 +31,9 @@ LIGHT_BLUE = rgbcolor(0x03, 0xA9, 0xF4)
|
|||||||
CYAN = rgbcolor(0x00, 0xBC, 0xD4)
|
CYAN = rgbcolor(0x00, 0xBC, 0xD4)
|
||||||
TEAL = rgbcolor(0x00, 0x96, 0x88)
|
TEAL = rgbcolor(0x00, 0x96, 0x88)
|
||||||
|
|
||||||
#GREEN 4CC148
|
# GREEN 4CC148
|
||||||
GREEN = rgbcolor(0x4C, 0xC1, 0x48)
|
GREEN = rgbcolor(0x4C, 0xC1, 0x48)
|
||||||
#ACTIVE DARK GREEN 1A8C14
|
# ACTIVE DARK GREEN 1A8C14
|
||||||
ACTIVE_GREEN = rgbcolor(0x1A, 0x8C, 0x14)
|
ACTIVE_GREEN = rgbcolor(0x1A, 0x8C, 0x14)
|
||||||
|
|
||||||
LIGHT_GREEN = rgbcolor(0x87, 0xCE, 0x26)
|
LIGHT_GREEN = rgbcolor(0x87, 0xCE, 0x26)
|
||||||
|
@ -42,9 +42,9 @@ class Swipe(ui.Widget):
|
|||||||
# check if its vertical scroll up
|
# check if its vertical scroll up
|
||||||
velya = abs(pdy / td) if td > 0 else 1
|
velya = abs(pdy / td) if td > 0 else 1
|
||||||
ratio = int(pdxa / pdya * 100) if pdya > 0 else 100
|
ratio = int(pdxa / pdya * 100) if pdya > 0 else 100
|
||||||
if (velya >= _SWIPE_VELOCITY_THRESHOLD
|
if (velya >= _SWIPE_VELOCITY_THRESHOLD and
|
||||||
and pdya >= _SWIPE_DISTANCE_THRESHOLD
|
pdya >= _SWIPE_DISTANCE_THRESHOLD and
|
||||||
and ratio <= _SWIPE_RATIO_THRESHOLD):
|
ratio <= _SWIPE_RATIO_THRESHOLD):
|
||||||
light = ui.display.backlight()
|
light = ui.display.backlight()
|
||||||
if light > self.light_target:
|
if light > self.light_target:
|
||||||
light -= 5
|
light -= 5
|
||||||
@ -68,17 +68,17 @@ class Swipe(ui.Widget):
|
|||||||
# Horizontal direction
|
# Horizontal direction
|
||||||
velxa = abs(pdx / td)
|
velxa = abs(pdx / td)
|
||||||
ratio = int(pdya / pdxa * 100) if pdxa > 0 else 100
|
ratio = int(pdya / pdxa * 100) if pdxa > 0 else 100
|
||||||
if (velxa >= _SWIPE_VELOCITY_THRESHOLD
|
if (velxa >= _SWIPE_VELOCITY_THRESHOLD and
|
||||||
and pdxa >= _SWIPE_DISTANCE_THRESHOLD
|
pdxa >= _SWIPE_DISTANCE_THRESHOLD and
|
||||||
and ratio <= _SWIPE_RATIO_THRESHOLD):
|
ratio <= _SWIPE_RATIO_THRESHOLD):
|
||||||
return SWIPE_RIGHT if pdx > 0 else SWIPE_LEFT
|
return SWIPE_RIGHT if pdx > 0 else SWIPE_LEFT
|
||||||
else:
|
else:
|
||||||
# Vertical direction
|
# Vertical direction
|
||||||
velya = abs(pdy / td)
|
velya = abs(pdy / td)
|
||||||
ratio = int(pdxa / pdya * 100) if pdya > 0 else 100
|
ratio = int(pdxa / pdya * 100) if pdya > 0 else 100
|
||||||
if (velya >= _SWIPE_VELOCITY_THRESHOLD
|
if (velya >= _SWIPE_VELOCITY_THRESHOLD and
|
||||||
and pdya >= _SWIPE_DISTANCE_THRESHOLD
|
pdya >= _SWIPE_DISTANCE_THRESHOLD and
|
||||||
and ratio <= _SWIPE_RATIO_THRESHOLD):
|
ratio <= _SWIPE_RATIO_THRESHOLD):
|
||||||
if pdy < 0:
|
if pdy < 0:
|
||||||
ui.display.backlight(self.light_origin)
|
ui.display.backlight(self.light_origin)
|
||||||
return SWIPE_DOWN if pdy > 0 else SWIPE_UP
|
return SWIPE_DOWN if pdy > 0 else SWIPE_UP
|
||||||
|
@ -3,6 +3,8 @@ CURDIR=$(pwd)
|
|||||||
mkdir -p $CURDIR/pb2/
|
mkdir -p $CURDIR/pb2/
|
||||||
echo > $CURDIR/pb2/__init__.py
|
echo > $CURDIR/pb2/__init__.py
|
||||||
|
|
||||||
|
mkdir -p ../src/trezor/messages
|
||||||
|
|
||||||
INDEX=../src/trezor/messages/wire_types.py
|
INDEX=../src/trezor/messages/wire_types.py
|
||||||
rm -f $INDEX
|
rm -f $INDEX
|
||||||
echo '# Automatically generated by pb2py' >> $INDEX
|
echo '# Automatically generated by pb2py' >> $INDEX
|
||||||
@ -18,7 +20,7 @@ done
|
|||||||
for i in types messages storage ; do
|
for i in types messages storage ; do
|
||||||
# Convert google protobuf library to trezor's internal format
|
# Convert google protobuf library to trezor's internal format
|
||||||
cd $CURDIR
|
cd $CURDIR
|
||||||
../../trezor-common/tools/pb2py -m -p $CURDIR -i $INDEX $i ../src/trezor/messages/
|
./pb2py -m -p $CURDIR -i $INDEX $i ../src/trezor/messages/
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -rf $CURDIR/pb2/
|
rm -rf $CURDIR/pb2/
|
||||||
|
189
tools/pb2py
Executable file
189
tools/pb2py
Executable file
@ -0,0 +1,189 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Converts Google's protobuf python definitions of TREZOR wire messages
|
||||||
|
# to plain-python objects as used in TREZOR Core and python-trezor
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
|
||||||
|
|
||||||
|
|
||||||
|
def process_type(t, cls, msg_id, indexfile, is_upy):
|
||||||
|
print(" * type %s" % t)
|
||||||
|
|
||||||
|
imports = ['import protobuf as p']
|
||||||
|
|
||||||
|
out = ["", "", "class %s(p.MessageType):" % t, ]
|
||||||
|
|
||||||
|
if cls.DESCRIPTOR.fields_by_name:
|
||||||
|
out.append(" FIELDS = {")
|
||||||
|
elif msg_id is None:
|
||||||
|
out.append(" pass")
|
||||||
|
|
||||||
|
for v in sorted(cls.DESCRIPTOR.fields_by_name.values(), key=lambda x: x.number):
|
||||||
|
number = v.number
|
||||||
|
fieldname = v.name
|
||||||
|
type = None
|
||||||
|
repeated = v.label == 3
|
||||||
|
required = v.label == 2
|
||||||
|
|
||||||
|
# print v.has_default_value, v.default_value
|
||||||
|
|
||||||
|
if v.type in (4, 13, 14):
|
||||||
|
# TYPE_UINT64 = 4
|
||||||
|
# TYPE_UINT32 = 13
|
||||||
|
# TYPE_ENUM = 14
|
||||||
|
type = 'p.UVarintType'
|
||||||
|
|
||||||
|
elif v.type == 9:
|
||||||
|
# TYPE_STRING = 9
|
||||||
|
type = 'p.UnicodeType'
|
||||||
|
|
||||||
|
elif v.type == 8:
|
||||||
|
# TYPE_BOOL = 8
|
||||||
|
type = 'p.BoolType'
|
||||||
|
|
||||||
|
elif v.type == 12:
|
||||||
|
# TYPE_BYTES = 12
|
||||||
|
type = 'p.BytesType'
|
||||||
|
|
||||||
|
elif v.type == 11:
|
||||||
|
# TYPE_MESSAGE = 1
|
||||||
|
type = v.message_type.name
|
||||||
|
imports.append("from .%s import %s" %
|
||||||
|
(v.message_type.name, v.message_type.name))
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise Exception("Unknown field type %s for field %s" %
|
||||||
|
(v.type, fieldname))
|
||||||
|
|
||||||
|
if required:
|
||||||
|
comment = ' # required'
|
||||||
|
elif v.has_default_value:
|
||||||
|
comment = ' # default=%s' % repr(v.default_value)
|
||||||
|
else:
|
||||||
|
comment = ''
|
||||||
|
|
||||||
|
if repeated:
|
||||||
|
flags = 'p.FLAG_REPEATED'
|
||||||
|
else:
|
||||||
|
flags = '0'
|
||||||
|
|
||||||
|
out.append(" %d: ('%s', %s, %s),%s" %
|
||||||
|
(number, fieldname, type, flags, comment))
|
||||||
|
|
||||||
|
# print fieldname, number, type, repeated, comment
|
||||||
|
# print v.__dict__
|
||||||
|
# print v.CPPTYPE_STRING
|
||||||
|
# print v.LABEL_REPEATED
|
||||||
|
# print v.enum_type
|
||||||
|
# v.has_default_value, v.default_value
|
||||||
|
# v.label == 3 # repeated
|
||||||
|
# print v.number
|
||||||
|
|
||||||
|
if cls.DESCRIPTOR.fields_by_name:
|
||||||
|
out.append(" }")
|
||||||
|
|
||||||
|
if msg_id is not None:
|
||||||
|
out.append(" MESSAGE_WIRE_TYPE = %d" % msg_id)
|
||||||
|
if indexfile is not None:
|
||||||
|
if is_upy:
|
||||||
|
indexfile.write("%s = const(%d)\n" % (t, msg_id))
|
||||||
|
else:
|
||||||
|
indexfile.write("%s = %d\n" % (t, msg_id))
|
||||||
|
|
||||||
|
return imports + out
|
||||||
|
|
||||||
|
|
||||||
|
def process_enum(t, cls, is_upy):
|
||||||
|
out = []
|
||||||
|
|
||||||
|
if is_upy:
|
||||||
|
out += ("from micropython import const", "")
|
||||||
|
|
||||||
|
print(" * enum %s" % t)
|
||||||
|
|
||||||
|
for k, v in cls.items():
|
||||||
|
# Remove type name from the beginning of the constant
|
||||||
|
# For example "PinMatrixRequestType_Current" -> "Current"
|
||||||
|
if k.startswith("%s_" % t):
|
||||||
|
k = k.replace("%s_" % t, '')
|
||||||
|
|
||||||
|
# If type ends with *Type, but constant use type name without *Type, remove it too :)
|
||||||
|
# For example "ButtonRequestType & ButtonRequest_Other" => "Other"
|
||||||
|
if t.endswith("Type") and k.startswith("%s_" % t.replace("Type", '')):
|
||||||
|
k = k.replace("%s_" % t.replace("Type", ''), '')
|
||||||
|
|
||||||
|
if is_upy:
|
||||||
|
out.append("%s = const(%s)" % (k, v))
|
||||||
|
else:
|
||||||
|
out.append("%s = %s" % (k, v))
|
||||||
|
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def find_msg_type(msg_types, t):
|
||||||
|
for k, v in msg_types:
|
||||||
|
msg_name = k.replace('MessageType_', '')
|
||||||
|
if msg_name == t:
|
||||||
|
return v
|
||||||
|
|
||||||
|
|
||||||
|
def process_module(mod, genpath, indexfile, is_upy):
|
||||||
|
|
||||||
|
print("Processing module %s" % mod.__name__)
|
||||||
|
types = dict([(name, cls)
|
||||||
|
for name, cls in mod.__dict__.items() if isinstance(cls, type)])
|
||||||
|
|
||||||
|
msg_types = __import__('pb2', globals(), locals(), [
|
||||||
|
'messages_pb2', ]).messages_pb2.MessageType.items()
|
||||||
|
|
||||||
|
for t, cls in types.items():
|
||||||
|
# Find message type for given class
|
||||||
|
msg_id = find_msg_type(msg_types, t)
|
||||||
|
|
||||||
|
out = process_type(t, cls, msg_id, indexfile, is_upy)
|
||||||
|
|
||||||
|
write_to_file(genpath, t, out)
|
||||||
|
|
||||||
|
enums = dict([(name, cls) for name, cls in mod.__dict__.items()
|
||||||
|
if isinstance(cls, EnumTypeWrapper)])
|
||||||
|
|
||||||
|
for t, cls in enums.items():
|
||||||
|
out = process_enum(t, cls, is_upy)
|
||||||
|
write_to_file(genpath, t, out)
|
||||||
|
|
||||||
|
|
||||||
|
def write_to_file(genpath, t, out):
|
||||||
|
# Write generated sourcecode to given file
|
||||||
|
f = open(os.path.join(genpath, "%s.py" % t), 'w')
|
||||||
|
out = ["# Automatically generated by pb2py"] + out
|
||||||
|
|
||||||
|
data = "\n".join(out) + "\n"
|
||||||
|
|
||||||
|
f.write(data)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('modulename', type=str, help="Name of module to generate")
|
||||||
|
parser.add_argument('genpath', type=str, help="Directory for generated source code")
|
||||||
|
parser.add_argument('-i', '--indexfile', type=str, help="[optional] Generate index file of wire types")
|
||||||
|
parser.add_argument('-p', '--protopath', type=str, help="[optional] Path to search for pregenerated Google's python sources")
|
||||||
|
parser.add_argument('-m', '--micropython', action='store_true', help="Use micropython-favoured source code")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.indexfile:
|
||||||
|
indexfile = open(args.indexfile, 'a')
|
||||||
|
else:
|
||||||
|
indexfile = None
|
||||||
|
|
||||||
|
if args.protopath:
|
||||||
|
sys.path.append(args.protopath)
|
||||||
|
|
||||||
|
# Dynamically load module from argv[1]
|
||||||
|
tmp = __import__('pb2', globals(), locals(), ['%s_pb2' % args.modulename])
|
||||||
|
mod = getattr(tmp, "%s_pb2" % args.modulename)
|
||||||
|
|
||||||
|
process_module(mod, args.genpath, indexfile, args.micropython)
|
Loading…
Reference in New Issue
Block a user