1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

stellar: public key methods removed

This commit is contained in:
Tomas Susanka 2018-08-21 14:52:00 +02:00 committed by matejcik
parent 3c48f906b2
commit 88a02822d3
4 changed files with 0 additions and 93 deletions

View File

@ -1265,22 +1265,6 @@ def stellar_get_address(connect, address, show_display):
return stellar.get_address(client, address_n, show_display)
@cli.command(help="Get Stellar public key")
@click.option(
"-n",
"--address",
required=False,
help="BIP32 path. Always use hardened paths and the m/44'/148'/ prefix",
default=stellar.DEFAULT_BIP32_PATH,
)
@click.option("-d", "--show-display", is_flag=True)
@click.pass_obj
def stellar_get_public_key(connect, address, show_display):
client = connect()
address_n = tools.parse_path(address)
return binascii.hexlify(stellar.get_public_key(client, address_n, show_display))
@cli.command(help="Sign a base64-encoded transaction envelope")
@click.option(
"-n",

View File

@ -342,13 +342,6 @@ def _crc16_checksum(bytes):
# ====== Client functions ====== #
@expect(messages.StellarPublicKey, field="public_key")
def get_public_key(client, address_n, show_display=False):
return client.call(
messages.StellarGetPublicKey(address_n=address_n, show_display=show_display)
)
@expect(messages.StellarAddress, field="address")
def get_address(client, address_n, show_display=False):
return client.call(

View File

@ -54,19 +54,6 @@ class TestMsgStellarGetAddress(TrezorTest):
)
assert address == "GBAW5XGWORWVFE2XTJYDTLDHXTY2Q2MO73HYCGB3XMFMQ562Q2W2GJQX"
def test_stellar_get_address_get_pubkey(self):
self.setup_mnemonic_nopin_nopassphrase()
pubkey = stellar.get_public_key(
self.client, parse_path(stellar.DEFAULT_BIP32_PATH)
)
# GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW
address = stellar.get_address(
self.client, parse_path(stellar.DEFAULT_BIP32_PATH)
)
assert stellar.address_from_public_key(pubkey) == address
def test_stellar_get_address_fail(self):
self.setup_mnemonic_nopin_nopassphrase()

View File

@ -1,57 +0,0 @@
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2018 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
from binascii import hexlify
import pytest
from trezorlib import messages, stellar
from trezorlib.tools import CallException, parse_path
from .common import TrezorTest
from .conftest import TREZOR_VERSION
@pytest.mark.stellar
class TestMsgStellarGetPublicKey(TrezorTest):
def test_stellar_get_public_key(self):
self.setup_mnemonic_nopin_nopassphrase()
# GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW
response = stellar.get_public_key(
self.client, parse_path(stellar.DEFAULT_BIP32_PATH), show_display=True
)
assert (
hexlify(response)
== b"15d648bfe4d36f196cfb5735ffd8ca54cd4b8233f743f22449de7cf301cdb469"
)
assert (
stellar.address_from_public_key(response)
== "GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW"
)
def test_stellar_get_public_key_fail(self):
self.setup_mnemonic_nopin_nopassphrase()
with pytest.raises(CallException) as exc:
stellar.get_public_key(self.client, parse_path("m/0/1"))
if TREZOR_VERSION == 1:
assert exc.value.args[0] == messages.FailureType.ProcessError
assert exc.value.args[1].endswith("Failed to derive private key")
else:
assert exc.value.args[0] == messages.FailureType.FirmwareError
assert exc.value.args[1].endswith("Firmware error")