parent
f8b9cda05d
commit
2c20016cfa
@ -0,0 +1,50 @@
|
||||
{
|
||||
"setup": {
|
||||
"mnemonic": "very improve such purity recipe deer giggle shuffle bamboo sorry galaxy damp confirm note easy pause coast purse often hint west angle spare north",
|
||||
"passphrase": ""
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"name": "ledger-derivation",
|
||||
"parameters": {
|
||||
"derivation_type": "LEDGER",
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"address_type": "base",
|
||||
"staking_path": "m/1852'/1815'/0'/2/0",
|
||||
"network_id": 1,
|
||||
"protocol_magic": 764824073
|
||||
},
|
||||
"result": {
|
||||
"expected_address": "addr1q8afdsv8q9hr4z8qljl3qz3rvm048g8j506j6umrpg63nytg4txp8fd25x5lnmkdh5p9wudkh4llu4dxyc3jyjef0gwqa5dzfd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "icarus-derivation",
|
||||
"parameters": {
|
||||
"derivation_type": "ICARUS",
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"address_type": "base",
|
||||
"staking_path": "m/1852'/1815'/0'/2/0",
|
||||
"network_id": 1,
|
||||
"protocol_magic": 764824073
|
||||
},
|
||||
"result": {
|
||||
"expected_address": "addr1q996av5n0379tp8yllaxtgj3ffntmlrsl9sah237h65x6yt76a24dxtkgy59n8tvk00jf5dwfp8cz50g0uheuzfddcnqxp4njq"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "icarus-trezor-derivation",
|
||||
"parameters": {
|
||||
"derivation_type": "ICARUS_TREZOR",
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"address_type": "base",
|
||||
"staking_path": "m/1852'/1815'/0'/2/0",
|
||||
"network_id": 1,
|
||||
"protocol_magic": 764824073
|
||||
},
|
||||
"result": {
|
||||
"expected_address": "addr1q8g9th06vccxzl96nr905al0vgg2t0fqfxrxmv7ecye3x2e66sl9kvzd905ad5natzd5wghy2w3a9lm0y7u7c5sv0c2snql3c4"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
{
|
||||
"setup": {
|
||||
"mnemonic": "very improve such purity recipe deer giggle shuffle bamboo sorry galaxy damp confirm note easy pause coast purse often hint west angle spare north",
|
||||
"passphrase": ""
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"name": "ledger-derivation",
|
||||
"parameters": {
|
||||
"path": "m/1852'/1815'/0'",
|
||||
"derivation_type": "LEDGER"
|
||||
},
|
||||
"result": {
|
||||
"public_key": "09a48c3390586bf1b5141e141fd2045b54f0a100af4254abb9bcf124eb82b078",
|
||||
"chain_code": "abb4f1731e9bb4151fb8bbe4a63c64b84a6e6193ef2b97edd4176136d55c235f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "icarus-derivation",
|
||||
"parameters": {
|
||||
"path": "m/1852'/1815'/0'",
|
||||
"derivation_type": "ICARUS"
|
||||
},
|
||||
"result": {
|
||||
"public_key": "8946b80aaa2ab0839276ca373d0b7845803ae39e452ac2469986bf8b360b217f",
|
||||
"chain_code": "85e096c7789c5aa29012633044750b1a79ab5ac2eb7189c91113e8ffbadd550f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "icarus-trezor-derivation",
|
||||
"parameters": {
|
||||
"path": "m/1852'/1815'/0'",
|
||||
"derivation_type": "ICARUS_TREZOR"
|
||||
},
|
||||
"result": {
|
||||
"public_key": "8a97a956fadbc79e09a867ed1e829af4f66a34903c9194de44c87262dfe19111",
|
||||
"chain_code": "dd97903ff01f4fcb6375c8252b31a59d9b170c1b61f5786304dc676270f44a90"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
# This file is part of the Trezor project.
|
||||
#
|
||||
# Copyright (C) 2012-2019 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>.
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib.cardano import get_public_key
|
||||
from trezorlib.exceptions import TrezorFailure
|
||||
from trezorlib.messages import CardanoDerivationType as D
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import MNEMONIC_SLIP39_BASIC_20_3of6
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.cardano,
|
||||
pytest.mark.skip_t1,
|
||||
]
|
||||
|
||||
ADDRESS_N = parse_path("m/1852'/1815'/0'")
|
||||
|
||||
|
||||
def test_bad_session(client):
|
||||
client.init_device(new_session=True)
|
||||
with pytest.raises(TrezorFailure, match="not enabled"):
|
||||
get_public_key(client, ADDRESS_N, derivation_type=D.ICARUS)
|
||||
|
||||
client.init_device(new_session=True, derive_cardano=False)
|
||||
with pytest.raises(TrezorFailure, match="not enabled"):
|
||||
get_public_key(client, ADDRESS_N, derivation_type=D.ICARUS)
|
||||
|
||||
|
||||
def test_ledger_available_always(client):
|
||||
client.init_device(new_session=True, derive_cardano=False)
|
||||
get_public_key(client, ADDRESS_N, derivation_type=D.LEDGER)
|
||||
|
||||
client.init_device(new_session=True, derive_cardano=True)
|
||||
get_public_key(client, ADDRESS_N, derivation_type=D.LEDGER)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_BASIC_20_3of6)
|
||||
@pytest.mark.parametrize("derivation_type", D) # try ALL derivation types
|
||||
def test_derivation_irrelevant_on_slip39(client, derivation_type):
|
||||
client.init_device(new_session=True, derive_cardano=False)
|
||||
pubkey = get_public_key(client, ADDRESS_N, derivation_type=D.ICARUS)
|
||||
test_pubkey = get_public_key(client, ADDRESS_N, derivation_type=derivation_type)
|
||||
assert pubkey == test_pubkey
|
Loading…
Reference in new issue