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 new file mode 100644 index 000000000..b3f3a012c --- /dev/null +++ b/trezorlib/tests/device_tests/test_msg_stellar_get_public_key.py @@ -0,0 +1,26 @@ +# This file is part of the TREZOR project. +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 GNU Lesser General Public License +# along with this library. If not, see . + +from .common import * +import trezorlib.stellar as stellar + +class TestMsgStellarGetPublicKey(TrezorTest): + + def test_stellar_get_address(self): + self.setup_mnemonic_nopin_nopassphrase() + + # GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW + response = self.client.stellar_get_public_key(self.client.expand_path("m/44'/148'/0'")) + assert stellar.address_from_public_key(response.public_key) == b'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW' diff --git a/trezorlib/tests/device_tests/test_msg_stellar_sign_transaction.py b/trezorlib/tests/device_tests/test_msg_stellar_sign_transaction.py new file mode 100644 index 000000000..f3b0df104 --- /dev/null +++ b/trezorlib/tests/device_tests/test_msg_stellar_sign_transaction.py @@ -0,0 +1,48 @@ +# This file is part of the TREZOR project. +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 GNU Lesser General Public License +# along with this library. If not, see . +# +# XDR decoding tool available at: +# https://www.stellar.org/laboratory/#xdr-viewer +# + +import base64 +from .common import * + +class TestMsgStellarSignTransaction(TrezorTest): + + def get_network_passphrase(self): + """Use the same passphrase as the network that generated the test XDR/signatures""" + return "Integration Test Network ; zulucrypto" + + def get_address_n(self): + """BIP32 path of the default account""" + return self.client.expand_path("m/44'/148'/0'") + + def test_sign_tx_bump_sequence_op(self): + self.setup_mnemonic_nopin_nopassphrase() + + xdr = base64.b64decode("AAAAABXWSL/k028ZbPtXNf/YylTNS4Iz90PyJEnefPMBzbRpAAAAZAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAt//////////wAAAAAAAAAA") + + response = self.client.stellar_sign_transaction(xdr, self.get_address_n(), self.get_network_passphrase()) + assert base64.b64encode(response.signature) == b'UAOL4ZPYIOzEgM66kBrhyNjLR66dNXtuNrmvd3m0/pc8qCSoLmYY4TybS0lHiMtb+LFZESTaxrpErMHz1sZ6DQ==' + + + def test_sign_tx_account_merge_op(self): + self.setup_mnemonic_nopin_nopassphrase() + + xdr = base64.b64decode("AAAAABXWSL/k028ZbPtXNf/YylTNS4Iz90PyJEnefPMBzbRpAAAAZAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAgAAAAAXVVkJGaxhbhDFS6eIZFR28WJICfsQBAaUXvtXKAwwuAAAAAAAAAAAQHNtGkAAABAgjoPRj4sW5o7NAXzYOqPK0uxfPbeKb4Qw48LJiCH/XUZ6YVCiZogePC0Z5ISUlozMh6YO6HoYtuLPbm7jq+eCA==") + + response = self.client.stellar_sign_transaction(xdr, self.get_address_n(), self.get_network_passphrase()) + assert base64.b64encode(response.signature) == b'gjoPRj4sW5o7NAXzYOqPK0uxfPbeKb4Qw48LJiCH/XUZ6YVCiZogePC0Z5ISUlozMh6YO6HoYtuLPbm7jq+eCA=='