1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-25 09:22:33 +00:00

fix style to match flake8

This commit is contained in:
ZuluCrypto 2018-04-28 12:59:08 -06:00
parent 200b5a71df
commit 5fccc4381b
No known key found for this signature in database
GPG Key ID: 0D1266F87C28A2E1
4 changed files with 29 additions and 20 deletions

View File

@ -975,6 +975,7 @@ def stellar_get_address(connect, address):
response = client.stellar_get_public_key(address_n)
return stellar.address_from_public_key(response.public_key)
@cli.command(help='Sign a string with a Stellar key')
@click.option('-n', '--address', required=False, help="BIP32 path. Default primary account is m/44'/148'/0'. Always use hardened paths and the m/44'/148'/ prefix")
@click.argument('message')
@ -985,6 +986,7 @@ def stellar_sign_message(connect, address, message):
response = client.stellar_sign_message(address_n, message)
return base64.b64encode(response.signature)
@cli.command(help='Verify that a signature is valid')
@click.option('--message-is-b64/--no-message-is-b64', default=False, required=False, help="If set, the message argument will be interpreted as a base64-encoded string")
@click.argument('address')
@ -1008,6 +1010,7 @@ def stellar_verify_message(connect, address, message_is_b64, signatureb64, messa
print("ERROR: invalid signature, verification failed")
sys.exit(1)
@cli.command(help='Sign a base64-encoded transaction envelope')
@click.option('-n', '--address', required=False, help="BIP32 path. Default primary account is m/44'/148'/0'. Always use hardened paths and the m/44'/148'/ prefix")
@click.option('-n', '--network-passphrase', required=False, help="Network passphrase (blank for public network). Testnet is: 'Test SDF Network ; September 2015'")

View File

@ -29,6 +29,7 @@ OP_INFLATION = 9 # Included for documentation purposes, not supported
OP_MANAGE_DATA = 10
OP_BUMP_SEQUENCE = 11
def expand_path_or_default(client, address):
"""Uses client to parse address and returns an array of integers
If no address is specified, the default of m/44'/148'/0' is used
@ -53,6 +54,7 @@ def address_from_public_key(pk_bytes):
return base64.b32encode(final_bytes)
def address_to_public_key(address_str):
"""Returns the raw 32 bytes representing a public key by extracting
it from the G... string
@ -109,6 +111,7 @@ def parse_transaction_bytes(tx_bytes):
return tx, operations
def _parse_operation_bytes(unpacker):
"""Returns a protobuf message representing the next operation as read from
the byte stream in unpacker
@ -272,6 +275,7 @@ def _parse_operation_bytes(unpacker):
raise ValueError("Unknown operation type: " + type)
def _xdr_read_asset(unpacker):
"""Reads a stellar Asset from unpacker"""
asset = proto.StellarAssetType(
@ -300,6 +304,7 @@ def _xdr_read_address(unpacker):
return unpacker.unpack_fopaque(32)
def _crc16_checksum(bytes):
"""Returns the CRC-16 checksum of bytearray bytes

View File

@ -16,6 +16,7 @@
from .common import TrezorTest
from trezorlib import stellar
@pytest.mark.xfail # requires trezor-mcu PR #259
class TestMsgStellarGetPublicKey(TrezorTest):

View File

@ -20,6 +20,7 @@
from base64 import b64decode, b64encode
from .common import TrezorTest
@pytest.mark.xfail # requires trezor-mcu PR #259
class TestMsgStellarSignTransaction(TrezorTest):
@ -39,7 +40,6 @@ class TestMsgStellarSignTransaction(TrezorTest):
response = self.client.stellar_sign_transaction(xdr, self.get_address_n(), self.get_network_passphrase())
assert b64encode(response.signature) == b'UAOL4ZPYIOzEgM66kBrhyNjLR66dNXtuNrmvd3m0/pc8qCSoLmYY4TybS0lHiMtb+LFZESTaxrpErMHz1sZ6DQ=='
def test_sign_tx_account_merge_op(self):
self.setup_mnemonic_nopin_nopassphrase()