2019-09-19 07:37:23 +00:00
|
|
|
# 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
|
|
|
|
|
2022-01-31 12:25:30 +00:00
|
|
|
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
|
|
|
|
2020-05-13 09:36:03 +00:00
|
|
|
from ..common import (
|
|
|
|
MNEMONIC_SLIP39_ADVANCED_20,
|
|
|
|
MNEMONIC_SLIP39_ADVANCED_33,
|
2020-05-22 10:22:06 +00:00
|
|
|
get_test_address,
|
2020-05-13 09:36:03 +00:00
|
|
|
)
|
2019-09-19 07:37:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_ADVANCED_20, passphrase=True)
|
2024-03-11 15:20:08 +00:00
|
|
|
@pytest.mark.skip_t1b1
|
2022-01-31 12:25:30 +00:00
|
|
|
def test_128bit_passphrase(client: Client):
|
2019-09-19 07:37:23 +00:00
|
|
|
"""
|
|
|
|
BIP32 Root Key for passphrase TREZOR:
|
2020-05-13 09:36:03 +00:00
|
|
|
provided by Andrew, address calculated via https://iancoleman.io/bip39/
|
2019-09-19 07:37:23 +00:00
|
|
|
xprv9s21ZrQH143K3dzDLfeY3cMp23u5vDeFYftu5RPYZPucKc99mNEddU4w99GxdgUGcSfMpVDxhnR1XpJzZNXRN1m6xNgnzFS5MwMP6QyBRKV
|
|
|
|
"""
|
|
|
|
assert client.features.passphrase_protection is True
|
2020-02-12 14:38:18 +00:00
|
|
|
client.use_passphrase("TREZOR")
|
2020-05-22 10:22:06 +00:00
|
|
|
address = get_test_address(client)
|
2020-05-13 09:36:03 +00:00
|
|
|
assert address == "mkKDUMRR1CcK8eLAzCZAjKnNbCquPoWPxN"
|
2020-08-25 14:28:32 +00:00
|
|
|
|
2019-09-19 07:37:23 +00:00
|
|
|
client.clear_session()
|
2020-02-12 14:38:18 +00:00
|
|
|
client.use_passphrase("ROZERT")
|
2020-05-22 10:22:06 +00:00
|
|
|
address_compare = get_test_address(client)
|
2019-09-19 07:37:23 +00:00
|
|
|
assert address != address_compare
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_ADVANCED_33, passphrase=True)
|
2024-03-11 15:20:08 +00:00
|
|
|
@pytest.mark.skip_t1b1
|
2022-01-31 12:25:30 +00:00
|
|
|
def test_256bit_passphrase(client: Client):
|
2019-09-19 07:37:23 +00:00
|
|
|
"""
|
|
|
|
BIP32 Root Key for passphrase TREZOR:
|
2020-05-13 09:36:03 +00:00
|
|
|
provided by Andrew, address calculated via https://iancoleman.io/bip39/
|
2019-09-19 07:37:23 +00:00
|
|
|
xprv9s21ZrQH143K2UspC9FRPfQC9NcDB4HPkx1XG9UEtuceYtpcCZ6ypNZWdgfxQ9dAFVeD1F4Zg4roY7nZm2LB7THPD6kaCege3M7EuS8v85c
|
|
|
|
"""
|
|
|
|
assert client.features.passphrase_protection is True
|
2020-02-12 14:38:18 +00:00
|
|
|
client.use_passphrase("TREZOR")
|
2020-05-22 10:22:06 +00:00
|
|
|
address = get_test_address(client)
|
2020-05-13 09:36:03 +00:00
|
|
|
assert address == "mxVtGxUJ898WLzPMmy6PT1FDHD1GUCWGm7"
|
2020-08-25 14:28:32 +00:00
|
|
|
|
2019-09-19 07:37:23 +00:00
|
|
|
client.clear_session()
|
2020-02-12 14:38:18 +00:00
|
|
|
client.use_passphrase("ROZERT")
|
2020-05-22 10:22:06 +00:00
|
|
|
address_compare = get_test_address(client)
|
2019-09-19 07:37:23 +00:00
|
|
|
assert address != address_compare
|