From a3d560529c99f484d2ce8f7e6132fcfcc654da7c Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 6 Aug 2018 16:15:44 +0200 Subject: [PATCH] trezorlib: post-merge updates --- trezorlib/btc.py | 13 ------------- trezorlib/client.py | 2 -- trezorlib/ripple.py | 7 ++----- .../device_tests/test_msg_ripple_get_address.py | 3 +-- .../tests/device_tests/test_msg_ripple_sign_tx.py | 3 +-- .../device_tests/test_msg_stellar_get_address.py | 3 +-- .../device_tests/test_msg_stellar_get_public_key.py | 3 +-- trezorlib/tools.py | 1 + 8 files changed, 7 insertions(+), 28 deletions(-) diff --git a/trezorlib/btc.py b/trezorlib/btc.py index bc266d490..f99ea885e 100644 --- a/trezorlib/btc.py +++ b/trezorlib/btc.py @@ -30,19 +30,6 @@ def verify_message(client, coin_name, address, signature, message): return isinstance(resp, proto.Success) -# @expect(proto.EncryptedMessage) -# def encrypt_message(client, pubkey, message, display_only, coin_name, n): -# if coin_name and n: -# return client.call(proto.EncryptMessage(pubkey=pubkey, message=message, display_only=display_only, coin_name=coin_name, address_n=n)) -# else: -# return client.call(proto.EncryptMessage(pubkey=pubkey, message=message, display_only=display_only)) - - -# @expect(proto.DecryptedMessage) -# def decrypt_message(client, n, nonce, message, msg_hmac): -# return client.call(proto.DecryptMessage(address_n=n, nonce=nonce, message=message, hmac=msg_hmac)) - - @session def sign_tx(client, coin_name, inputs, outputs, version=None, lock_time=None, expiry=None, overwintered=None, debug_processor=None): # start = time.time() diff --git a/trezorlib/client.py b/trezorlib/client.py index d1277c3d3..577559c8a 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -479,8 +479,6 @@ class ProtocolMixin(object): sign_tx = MovedTo(btc.sign_tx) sign_message = MovedTo(btc.sign_message) verify_message = MovedTo(btc.verify_message) - # encrypt_message = MovedTo(btc.encrypt_message) - # decrypt_message = MovedTo(btc.decrypt_message) # CoSi functionality cosi_commit = MovedTo(cosi.commit) diff --git a/trezorlib/ripple.py b/trezorlib/ripple.py index 6f1c38802..d66227d21 100644 --- a/trezorlib/ripple.py +++ b/trezorlib/ripple.py @@ -18,13 +18,10 @@ import base64 import struct from . import messages -from . import tools -from .client import field -from .client import expect +from .tools import expect -@field('address') -@expect(messages.RippleAddress) +@expect(messages.RippleAddress, field="address") def get_address(client, address_n, show_display=False): return client.call( messages.RippleGetAddress( diff --git a/trezorlib/tests/device_tests/test_msg_ripple_get_address.py b/trezorlib/tests/device_tests/test_msg_ripple_get_address.py index ac43065f9..8c1e1c2da 100644 --- a/trezorlib/tests/device_tests/test_msg_ripple_get_address.py +++ b/trezorlib/tests/device_tests/test_msg_ripple_get_address.py @@ -19,9 +19,8 @@ import pytest from .common import TrezorTest from .conftest import TREZOR_VERSION from binascii import hexlify -from trezorlib.client import CallException from trezorlib.ripple import get_address -from trezorlib.tools import parse_path +from trezorlib.tools import parse_path, CallException @pytest.mark.ripple diff --git a/trezorlib/tests/device_tests/test_msg_ripple_sign_tx.py b/trezorlib/tests/device_tests/test_msg_ripple_sign_tx.py index 43f64c7b7..ce04eb34e 100644 --- a/trezorlib/tests/device_tests/test_msg_ripple_sign_tx.py +++ b/trezorlib/tests/device_tests/test_msg_ripple_sign_tx.py @@ -21,8 +21,7 @@ from .conftest import TREZOR_VERSION from binascii import unhexlify from trezorlib import messages from trezorlib import ripple -from trezorlib.client import CallException -from trezorlib.tools import parse_path +from trezorlib.tools import parse_path, CallException @pytest.mark.ripple diff --git a/trezorlib/tests/device_tests/test_msg_stellar_get_address.py b/trezorlib/tests/device_tests/test_msg_stellar_get_address.py index f07b32ff5..16de53daf 100644 --- a/trezorlib/tests/device_tests/test_msg_stellar_get_address.py +++ b/trezorlib/tests/device_tests/test_msg_stellar_get_address.py @@ -21,8 +21,7 @@ from .conftest import TREZOR_VERSION from binascii import hexlify from trezorlib import stellar from trezorlib import messages as proto -from trezorlib.client import CallException -from trezorlib.tools import parse_path +from trezorlib.tools import parse_path, CallException @pytest.mark.stellar diff --git a/trezorlib/tests/device_tests/test_msg_stellar_get_public_key.py b/trezorlib/tests/device_tests/test_msg_stellar_get_public_key.py index 1442d9795..f1837d399 100644 --- a/trezorlib/tests/device_tests/test_msg_stellar_get_public_key.py +++ b/trezorlib/tests/device_tests/test_msg_stellar_get_public_key.py @@ -21,8 +21,7 @@ from .conftest import TREZOR_VERSION from binascii import hexlify from trezorlib import stellar from trezorlib import messages -from trezorlib.client import CallException -from trezorlib.tools import parse_path +from trezorlib.tools import parse_path, CallException @pytest.mark.stellar diff --git a/trezorlib/tools.py b/trezorlib/tools.py index 41675d98b..ee015c42f 100644 --- a/trezorlib/tools.py +++ b/trezorlib/tools.py @@ -14,6 +14,7 @@ # You should have received a copy of the License along with this library. # If not, see . +import functools import hashlib import struct import unicodedata