1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

fix(core): create protobuf messages correctly

This commit is contained in:
matejcik 2021-01-14 14:18:12 +01:00 committed by matejcik
parent 0964517fe7
commit 73a28e12f2
3 changed files with 22 additions and 21 deletions

View File

@ -35,19 +35,20 @@ if False:
def get_features() -> Features:
f = Features()
f.vendor = "trezor.io"
f.language = "en-US"
f.major_version = utils.VERSION_MAJOR
f.minor_version = utils.VERSION_MINOR
f.patch_version = utils.VERSION_PATCH
f.revision = utils.GITREV.encode()
f.model = utils.MODEL
f.device_id = storage.device.get_device_id()
f.label = storage.device.get_label()
f.pin_protection = config.has_pin()
f.unlocked = config.is_unlocked()
f.passphrase_protection = storage.device.is_passphrase_enabled()
f = Features(
vendor="trezor.io",
language="en-US",
major_version=utils.VERSION_MAJOR,
minor_version=utils.VERSION_MINOR,
patch_version=utils.VERSION_PATCH,
revision=utils.GITREV.encode(),
model=utils.MODEL,
device_id=storage.device.get_device_id(),
label=storage.device.get_label(),
pin_protection=config.has_pin(),
unlocked=config.is_unlocked(),
passphrase_protection=storage.device.is_passphrase_enabled(),
)
if utils.BITCOIN_ONLY:
f.capabilities = [

View File

@ -32,7 +32,7 @@ async def sign_message(ctx, msg, keychain):
secp256k1.CANONICAL_SIG_ETHEREUM,
)
sig = EthereumMessageSignature()
sig.address = address.address_from_bytes(node.ethereum_pubkeyhash())
sig.signature = signature[1:] + bytearray([signature[0]])
return sig
return EthereumMessageSignature(
address=address.address_from_bytes(node.ethereum_pubkeyhash()),
signature=signature[1:] + bytearray([signature[0]]),
)

View File

@ -72,7 +72,7 @@ async def sign_tx(ctx, msg: NEMSignTx, keychain):
signature = ed25519.sign(node.private_key(), tx, NEM_HASH_ALG)
resp = NEMSignedTx()
resp.data = tx
resp.signature = signature
return resp
return NEMSignedTx(
data=tx,
signature=signature,
)