|
|
|
@ -22,6 +22,7 @@ from trezorlib.cardano import (
|
|
|
|
|
get_public_key,
|
|
|
|
|
parse_optional_bytes,
|
|
|
|
|
)
|
|
|
|
|
from trezorlib.exceptions import TrezorFailure
|
|
|
|
|
from trezorlib.messages import CardanoAddressType
|
|
|
|
|
from trezorlib.tools import parse_path
|
|
|
|
|
|
|
|
|
@ -45,6 +46,8 @@ pytestmark = [
|
|
|
|
|
"cardano/get_reward_address.json",
|
|
|
|
|
)
|
|
|
|
|
def test_cardano_get_address(client, parameters, result):
|
|
|
|
|
client.init_device(new_session=True, derive_cardano=True)
|
|
|
|
|
|
|
|
|
|
address = get_address(
|
|
|
|
|
client,
|
|
|
|
|
address_parameters=create_address_parameters(
|
|
|
|
@ -76,11 +79,24 @@ def test_cardano_get_address(client, parameters, result):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@parametrize_using_common_fixtures(
|
|
|
|
|
"cardano/get_public_key.json", "cardano/get_public_key.slip39.json"
|
|
|
|
|
"cardano/get_public_key.json",
|
|
|
|
|
"cardano/get_public_key.slip39.json",
|
|
|
|
|
)
|
|
|
|
|
def test_cardano_get_public_key(client, parameters, result):
|
|
|
|
|
client.init_device(new_session=True, derive_cardano=True)
|
|
|
|
|
|
|
|
|
|
key = get_public_key(client, parse_path(parameters["path"]))
|
|
|
|
|
|
|
|
|
|
assert key.node.public_key.hex() == result["public_key"]
|
|
|
|
|
assert key.node.chain_code.hex() == result["chain_code"]
|
|
|
|
|
assert key.xpub == result["public_key"] + result["chain_code"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_bad_session(client):
|
|
|
|
|
client.init_device(new_session=True)
|
|
|
|
|
with pytest.raises(TrezorFailure, match="not enabled"):
|
|
|
|
|
get_public_key(client, parse_path("m/1852'/1815'/0'"))
|
|
|
|
|
|
|
|
|
|
client.init_device(new_session=True, derive_cardano=False)
|
|
|
|
|
with pytest.raises(TrezorFailure, match="not enabled"):
|
|
|
|
|
get_public_key(client, parse_path("m/1852'/1815'/0'"))
|
|
|
|
|