mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
tests: move enter_all_shares recovery function to common
This commit is contained in:
parent
9e42a73650
commit
41b76f4f31
@ -15,6 +15,8 @@
|
||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||
|
||||
|
||||
from trezorlib.messages import ButtonRequestType as B
|
||||
|
||||
# fmt: off
|
||||
# 1 2 3 4 5 6 7 8 9 10 11 12
|
||||
MNEMONIC12 = "alcohol woman abuse must during monitor noble actual mixed trade anger aisle"
|
||||
@ -23,6 +25,19 @@ MNEMONIC24 = "dignity pass list indicate nasty swamp pool script soccer toe leaf
|
||||
MNEMONIC_ALLALLALL = " ".join(["all"] * 12)
|
||||
# fmt: on
|
||||
|
||||
MNEMONIC_SHAMIR_20_3of6 = [
|
||||
"extra extend academic bishop cricket bundle tofu goat apart victim enlarge program behavior permit course armed jerky faint language modern",
|
||||
"extra extend academic acne away best indicate impact square oasis prospect painting voting guest either argue username racism enemy eclipse",
|
||||
"extra extend academic arcade born dive legal hush gross briefing talent drug much home firefly toxic analysis idea umbrella slice",
|
||||
]
|
||||
MNEMONIC_SHAMIR_20_2of3_2of3_GROUPS = [
|
||||
"gesture negative ceramic leaf device fantasy style ceramic safari keyboard thumb total smug cage plunge aunt favorite lizard intend peanut",
|
||||
"gesture negative acrobat leaf craft sidewalk adorn spider submit bumpy alcohol cards salon making prune decorate smoking image corner method",
|
||||
"gesture negative acrobat lily bishop voting humidity rhyme parcel crunch elephant victim dish mailman triumph agree episode wealthy mayor beam",
|
||||
"gesture negative beard leaf deadline stadium vegan employer armed marathon alien lunar broken edge justice military endorse diet sweater either",
|
||||
"gesture negative beard lily desert belong speak realize explain bolt diet believe response counter medal luck wits glance remove ending",
|
||||
]
|
||||
|
||||
|
||||
class TrezorTest:
|
||||
mnemonic12 = MNEMONIC12
|
||||
@ -64,3 +79,42 @@ def generate_entropy(strength, internal_entropy, external_entropy):
|
||||
raise ValueError("Entropy length mismatch")
|
||||
|
||||
return entropy_stripped
|
||||
|
||||
|
||||
def recovery_enter_shares(debug, shares, groups=False):
|
||||
word_count = len(shares[0].split(" "))
|
||||
|
||||
# Homescreen - proceed to word number selection
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Input word number
|
||||
code = yield
|
||||
assert code == B.MnemonicWordCount
|
||||
debug.input(str(word_count))
|
||||
# Homescreen - proceed to share entry
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Enter shares
|
||||
for index, share in enumerate(shares):
|
||||
if groups and index >= 1:
|
||||
# confirm remaining shares
|
||||
debug.swipe_down()
|
||||
code = yield
|
||||
assert code == B.Other
|
||||
debug.press_yes()
|
||||
|
||||
code = yield
|
||||
assert code == B.MnemonicInput
|
||||
# Enter mnemonic words
|
||||
for word in share.split(" "):
|
||||
debug.input(word)
|
||||
|
||||
if groups:
|
||||
# Confirm share entered
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
||||
# Homescreen - continue
|
||||
# or Homescreen - confirm success
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
@ -19,11 +19,7 @@ import pytest
|
||||
from trezorlib.cardano import get_address
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
SLIP39_MNEMONIC = [
|
||||
"extra extend academic bishop cricket bundle tofu goat apart victim enlarge program behavior permit course armed jerky faint language modern",
|
||||
"extra extend academic acne away best indicate impact square oasis prospect painting voting guest either argue username racism enemy eclipse",
|
||||
"extra extend academic arcade born dive legal hush gross briefing talent drug much home firefly toxic analysis idea umbrella slice",
|
||||
]
|
||||
from .common import MNEMONIC_SHAMIR_20_3of6
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@ -46,7 +42,7 @@ SLIP39_MNEMONIC = [
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.setup_client(mnemonic=SLIP39_MNEMONIC, passphrase=True)
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC_SHAMIR_20_3of6, passphrase=True)
|
||||
def test_cardano_get_address(client, path, expected_address):
|
||||
# enter passphrase
|
||||
assert client.features.passphrase_protection is True
|
||||
|
@ -19,20 +19,13 @@ import pytest
|
||||
from trezorlib.cardano import get_public_key
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
SLIP39_MNEMONIC = [
|
||||
"extra extend academic bishop cricket bundle tofu goat apart victim "
|
||||
"enlarge program behavior permit course armed jerky faint language modern",
|
||||
"extra extend academic acne away best indicate impact square oasis "
|
||||
"prospect painting voting guest either argue username racism enemy eclipse",
|
||||
"extra extend academic arcade born dive legal hush gross briefing "
|
||||
"talent drug much home firefly toxic analysis idea umbrella slice",
|
||||
]
|
||||
from .common import MNEMONIC_SHAMIR_20_3of6
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.cardano
|
||||
@pytest.mark.skip_t1 # T1 support is not planned
|
||||
@pytest.mark.setup_client(mnemonic=SLIP39_MNEMONIC, passphrase=True)
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC_SHAMIR_20_3of6, passphrase=True)
|
||||
@pytest.mark.parametrize(
|
||||
"path,public_key,chain_code",
|
||||
[
|
||||
|
@ -18,11 +18,7 @@ import pytest
|
||||
|
||||
from trezorlib import cardano, messages
|
||||
|
||||
SHARES_20_3of6 = [
|
||||
"extra extend academic bishop cricket bundle tofu goat apart victim enlarge program behavior permit course armed jerky faint language modern",
|
||||
"extra extend academic acne away best indicate impact square oasis prospect painting voting guest either argue username racism enemy eclipse",
|
||||
"extra extend academic arcade born dive legal hush gross briefing talent drug much home firefly toxic analysis idea umbrella slice",
|
||||
]
|
||||
from .common import MNEMONIC_SHAMIR_20_3of6
|
||||
|
||||
PROTOCOL_MAGICS = {"mainnet": 764824073, "testnet": 1097911063}
|
||||
|
||||
@ -113,7 +109,7 @@ VALID_VECTORS = [
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.cardano
|
||||
@pytest.mark.skip_t1 # T1 support is not planned
|
||||
@pytest.mark.setup_client(mnemonic=SHARES_20_3of6, passphrase=True)
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC_SHAMIR_20_3of6, passphrase=True)
|
||||
@pytest.mark.parametrize(
|
||||
"protocol_magic,inputs,outputs,transactions,tx_hash,tx_body", VALID_VECTORS
|
||||
)
|
||||
|
@ -19,56 +19,25 @@ import pytest
|
||||
|
||||
from trezorlib import device, exceptions, messages
|
||||
|
||||
from .common import MNEMONIC_SHAMIR_20_3of6, recovery_enter_shares
|
||||
|
||||
pytestmark = pytest.mark.skip_t1
|
||||
|
||||
SHARES_20_3of6 = [
|
||||
"extra extend academic bishop cricket bundle tofu goat apart victim enlarge program behavior permit course armed jerky faint language modern",
|
||||
"extra extend academic acne away best indicate impact square oasis prospect painting voting guest either argue username racism enemy eclipse",
|
||||
"extra extend academic arcade born dive legal hush gross briefing talent drug much home firefly toxic analysis idea umbrella slice",
|
||||
]
|
||||
|
||||
SHARES_33_2of5 = [
|
||||
MNEMONIC_SHAMIR_33_2of5 = [
|
||||
"hobo romp academic axis august founder knife legal recover alien expect emphasis loan kitchen involve teacher capture rebuild trial numb spider forward ladle lying voter typical security quantity hawk legs idle leaves gasoline",
|
||||
"hobo romp academic agency ancestor industry argue sister scene midst graduate profile numb paid headset airport daisy flame express scene usual welcome quick silent downtown oral critical step remove says rhythm venture aunt",
|
||||
]
|
||||
|
||||
|
||||
VECTORS = (
|
||||
(SHARES_20_3of6, "491b795b80fc21ccdf466c0fbc98c8fc"),
|
||||
(MNEMONIC_SHAMIR_20_3of6, "491b795b80fc21ccdf466c0fbc98c8fc"),
|
||||
(
|
||||
SHARES_33_2of5,
|
||||
MNEMONIC_SHAMIR_33_2of5,
|
||||
"b770e0da1363247652de97a39bdbf2463be087848d709ecbf28e84508e31202a",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def enter_all_shares(debug, shares):
|
||||
word_count = len(shares[0].split(" "))
|
||||
|
||||
# Homescreen - proceed to word number selection
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Input word number
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicWordCount
|
||||
debug.input(str(word_count))
|
||||
# Homescreen - proceed to share entry
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Enter shares
|
||||
for share in shares:
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicInput
|
||||
# Enter mnemonic words
|
||||
for word in share.split(" "):
|
||||
debug.input(word)
|
||||
|
||||
# Homescreen - continue
|
||||
# or Homescreen - confirm success
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
@pytest.mark.parametrize("shares, secret", VECTORS)
|
||||
def test_secret(client, shares, secret):
|
||||
@ -78,7 +47,7 @@ def test_secret(client, shares, secret):
|
||||
yield # Confirm Recovery
|
||||
debug.press_yes()
|
||||
# run recovery flow
|
||||
yield from enter_all_shares(debug, shares)
|
||||
yield from recovery_enter_shares(debug, shares)
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
@ -105,7 +74,7 @@ def test_recover_with_pin_passphrase(client):
|
||||
yield # Enter PIN again
|
||||
debug.input("654")
|
||||
# Proceed with recovery
|
||||
yield from enter_all_shares(debug, SHARES_20_3of6)
|
||||
yield from recovery_enter_shares(debug, MNEMONIC_SHAMIR_20_3of6)
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
@ -150,7 +119,7 @@ def test_noabort(client):
|
||||
debug.press_no()
|
||||
yield # Homescreen - go back to process
|
||||
debug.press_no()
|
||||
yield from enter_all_shares(debug, SHARES_20_3of6)
|
||||
yield from recovery_enter_shares(debug, MNEMONIC_SHAMIR_20_3of6)
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
@ -163,7 +132,7 @@ def test_noabort(client):
|
||||
@pytest.mark.parametrize("nth_word", range(3))
|
||||
def test_wrong_nth_word(client, nth_word):
|
||||
debug = client.debug
|
||||
share = SHARES_20_3of6[0].split(" ")
|
||||
share = MNEMONIC_SHAMIR_20_3of6[0].split(" ")
|
||||
|
||||
def input_flow():
|
||||
yield # Confirm Recovery
|
||||
@ -202,9 +171,9 @@ def test_wrong_nth_word(client, nth_word):
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_same_share(client):
|
||||
debug = client.debug
|
||||
first_share = SHARES_20_3of6[0].split(" ")
|
||||
first_share = MNEMONIC_SHAMIR_20_3of6[0].split(" ")
|
||||
# second share is first 4 words of first
|
||||
second_share = SHARES_20_3of6[0].split(" ")[:4]
|
||||
second_share = MNEMONIC_SHAMIR_20_3of6[0].split(" ")[:4]
|
||||
|
||||
def input_flow():
|
||||
yield # Confirm Recovery
|
||||
|
@ -3,6 +3,8 @@ import pytest
|
||||
from trezorlib import device, messages
|
||||
from trezorlib.exceptions import TrezorFailure
|
||||
|
||||
from .common import recovery_enter_shares
|
||||
|
||||
pytestmark = pytest.mark.skip_t1
|
||||
|
||||
SHARES_20_2of3 = [
|
||||
@ -25,7 +27,7 @@ def test_2of3_dryrun(client):
|
||||
yield # Confirm Dryrun
|
||||
debug.press_yes()
|
||||
# run recovery flow
|
||||
yield from enter_all_shares(debug, SHARES_20_2of3[1:3])
|
||||
yield from recovery_enter_shares(debug, SHARES_20_2of3[1:3])
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
@ -53,7 +55,7 @@ def test_2of3_invalid_seed_dryrun(client):
|
||||
yield # Confirm Dryrun
|
||||
debug.press_yes()
|
||||
# run recovery flow
|
||||
yield from enter_all_shares(debug, INVALID_SHARES_20_2of3)
|
||||
yield from recovery_enter_shares(debug, INVALID_SHARES_20_2of3)
|
||||
|
||||
# test fails because of different seed on device
|
||||
with client, pytest.raises(
|
||||
@ -69,30 +71,3 @@ def test_2of3_invalid_seed_dryrun(client):
|
||||
dry_run=True,
|
||||
type=messages.ResetDeviceBackupType.Slip39_Single_Group,
|
||||
)
|
||||
|
||||
|
||||
def enter_all_shares(debug, shares):
|
||||
word_count = len(shares[0].split(" "))
|
||||
|
||||
# Homescreen - proceed to word number selection
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Input word number
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicWordCount
|
||||
debug.input(str(word_count))
|
||||
# Homescreen - proceed to share entry
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Enter shares
|
||||
for share in shares:
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicInput
|
||||
# Enter mnemonic words
|
||||
for word in share.split(" "):
|
||||
debug.input(word)
|
||||
|
||||
# Homescreen - continue
|
||||
# or Homescreen - confirm success
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
@ -19,53 +19,10 @@ import pytest
|
||||
|
||||
from trezorlib import device, exceptions, messages
|
||||
|
||||
from .common import MNEMONIC_SHAMIR_20_2of3_2of3_GROUPS, recovery_enter_shares
|
||||
|
||||
pytestmark = pytest.mark.skip_t1
|
||||
|
||||
SHARES_20_2of3_2of3_GROUPS = [
|
||||
"gesture negative ceramic leaf device fantasy style ceramic safari keyboard thumb total smug cage plunge aunt favorite lizard intend peanut",
|
||||
"gesture negative acrobat leaf craft sidewalk adorn spider submit bumpy alcohol cards salon making prune decorate smoking image corner method",
|
||||
"gesture negative acrobat lily bishop voting humidity rhyme parcel crunch elephant victim dish mailman triumph agree episode wealthy mayor beam",
|
||||
"gesture negative beard leaf deadline stadium vegan employer armed marathon alien lunar broken edge justice military endorse diet sweater either",
|
||||
"gesture negative beard lily desert belong speak realize explain bolt diet believe response counter medal luck wits glance remove ending",
|
||||
]
|
||||
|
||||
|
||||
def enter_all_shares(debug, shares):
|
||||
word_count = len(shares[0].split(" "))
|
||||
|
||||
# Homescreen - proceed to word number selection
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Input word number
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicWordCount
|
||||
debug.input(str(word_count))
|
||||
# Homescreen - proceed to share entry
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Enter shares
|
||||
for index, share in enumerate(shares):
|
||||
if index >= 1:
|
||||
# confirm remaining shares
|
||||
debug.swipe_down()
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.Other
|
||||
debug.press_yes()
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicInput
|
||||
# Enter mnemonic words
|
||||
for word in share.split(" "):
|
||||
debug.input(word)
|
||||
|
||||
# Confirm share entered
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
||||
# Homescreen - continue
|
||||
# or Homescreen - confirm success
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_recover_no_pin_no_passphrase(client):
|
||||
@ -75,7 +32,9 @@ def test_recover_no_pin_no_passphrase(client):
|
||||
yield # Confirm Recovery
|
||||
debug.press_yes()
|
||||
# Proceed with recovery
|
||||
yield from enter_all_shares(debug, SHARES_20_2of3_2of3_GROUPS)
|
||||
yield from recovery_enter_shares(
|
||||
debug, MNEMONIC_SHAMIR_20_2of3_2of3_GROUPS, groups=True
|
||||
)
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
@ -121,7 +80,9 @@ def test_noabort(client):
|
||||
debug.press_no()
|
||||
yield # Homescreen - go back to process
|
||||
debug.press_no()
|
||||
yield from enter_all_shares(debug, SHARES_20_2of3_2of3_GROUPS)
|
||||
yield from recovery_enter_shares(
|
||||
debug, MNEMONIC_SHAMIR_20_2of3_2of3_GROUPS, groups=True
|
||||
)
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
|
@ -3,15 +3,9 @@ import pytest
|
||||
from trezorlib import device, messages
|
||||
from trezorlib.exceptions import TrezorFailure
|
||||
|
||||
pytestmark = pytest.mark.skip_t1
|
||||
from .common import MNEMONIC_SHAMIR_20_2of3_2of3_GROUPS, recovery_enter_shares
|
||||
|
||||
SHARES_20_2of3_2of3_GROUPS = [
|
||||
"gesture negative ceramic leaf device fantasy style ceramic safari keyboard thumb total smug cage plunge aunt favorite lizard intend peanut",
|
||||
"gesture negative acrobat leaf craft sidewalk adorn spider submit bumpy alcohol cards salon making prune decorate smoking image corner method",
|
||||
"gesture negative acrobat lily bishop voting humidity rhyme parcel crunch elephant victim dish mailman triumph agree episode wealthy mayor beam",
|
||||
"gesture negative beard leaf deadline stadium vegan employer armed marathon alien lunar broken edge justice military endorse diet sweater either",
|
||||
"gesture negative beard lily desert belong speak realize explain bolt diet believe response counter medal luck wits glance remove ending",
|
||||
]
|
||||
pytestmark = pytest.mark.skip_t1
|
||||
|
||||
INVALID_SHARES_20_2of3_2of3_GROUPS = [
|
||||
"chest garlic acrobat leaf diploma thank soul predator grant laundry camera license language likely slim twice amount rich total carve",
|
||||
@ -21,7 +15,9 @@ INVALID_SHARES_20_2of3_2of3_GROUPS = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=SHARES_20_2of3_2of3_GROUPS[1:5], passphrase=False)
|
||||
@pytest.mark.setup_client(
|
||||
mnemonic=MNEMONIC_SHAMIR_20_2of3_2of3_GROUPS[1:5], passphrase=False
|
||||
)
|
||||
def test_2of3_dryrun(client):
|
||||
debug = client.debug
|
||||
|
||||
@ -29,7 +25,9 @@ def test_2of3_dryrun(client):
|
||||
yield # Confirm Dryrun
|
||||
debug.press_yes()
|
||||
# run recovery flow
|
||||
yield from enter_all_shares(debug, SHARES_20_2of3_2of3_GROUPS)
|
||||
yield from recovery_enter_shares(
|
||||
debug, MNEMONIC_SHAMIR_20_2of3_2of3_GROUPS, groups=True
|
||||
)
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
@ -48,7 +46,9 @@ def test_2of3_dryrun(client):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=SHARES_20_2of3_2of3_GROUPS[1:5], passphrase=True)
|
||||
@pytest.mark.setup_client(
|
||||
mnemonic=MNEMONIC_SHAMIR_20_2of3_2of3_GROUPS[1:5], passphrase=True
|
||||
)
|
||||
def test_2of3_invalid_seed_dryrun(client):
|
||||
debug = client.debug
|
||||
|
||||
@ -56,7 +56,9 @@ def test_2of3_invalid_seed_dryrun(client):
|
||||
yield # Confirm Dryrun
|
||||
debug.press_yes()
|
||||
# run recovery flow
|
||||
yield from enter_all_shares(debug, INVALID_SHARES_20_2of3_2of3_GROUPS)
|
||||
yield from recovery_enter_shares(
|
||||
debug, INVALID_SHARES_20_2of3_2of3_GROUPS, groups=True
|
||||
)
|
||||
|
||||
# test fails because of different seed on device
|
||||
with client, pytest.raises(
|
||||
@ -71,40 +73,3 @@ def test_2of3_invalid_seed_dryrun(client):
|
||||
language="english",
|
||||
dry_run=True,
|
||||
)
|
||||
|
||||
|
||||
def enter_all_shares(debug, shares):
|
||||
word_count = len(shares[0].split(" "))
|
||||
|
||||
# Homescreen - proceed to word number selection
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Input word number
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicWordCount
|
||||
debug.input(str(word_count))
|
||||
# Homescreen - proceed to share entry
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Enter shares
|
||||
for index, share in enumerate(shares):
|
||||
if index >= 1:
|
||||
# confirm remaining shares
|
||||
debug.swipe_down()
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.Other
|
||||
debug.press_yes()
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicInput
|
||||
# Enter mnemonic words
|
||||
for word in share.split(" "):
|
||||
debug.input(word)
|
||||
|
||||
# Confirm share entered
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
||||
# Homescreen - continue
|
||||
# or Homescreen - confirm success
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
@ -19,15 +19,10 @@ import pytest
|
||||
|
||||
from trezorlib import btc
|
||||
|
||||
from .common import MNEMONIC_SHAMIR_20_3of6
|
||||
|
||||
@pytest.mark.setup_client(
|
||||
mnemonic=(
|
||||
"extra extend academic bishop cricket bundle tofu goat apart victim enlarge program behavior permit course armed jerky faint language modern",
|
||||
"extra extend academic acne away best indicate impact square oasis prospect painting voting guest either argue username racism enemy eclipse",
|
||||
"extra extend academic arcade born dive legal hush gross briefing talent drug much home firefly toxic analysis idea umbrella slice",
|
||||
),
|
||||
passphrase=True,
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC_SHAMIR_20_3of6, passphrase=True)
|
||||
@pytest.mark.skip_t1
|
||||
def test_3of6_passphrase(client):
|
||||
"""
|
||||
|
@ -4,6 +4,8 @@ from trezorlib import btc, device, messages
|
||||
from trezorlib.messages import ButtonRequestType as B, ResetDeviceBackupType
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from .common import recovery_enter_shares
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
@ -155,7 +157,7 @@ def recover(client, shares):
|
||||
yield # Confirm Recovery
|
||||
debug.press_yes()
|
||||
# run recovery flow
|
||||
yield from enter_all_shares(debug, shares)
|
||||
yield from recovery_enter_shares(debug, shares)
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
@ -167,31 +169,3 @@ def recover(client, shares):
|
||||
assert ret == messages.Success(message="Device recovered")
|
||||
assert client.features.pin_protection is False
|
||||
assert client.features.passphrase_protection is False
|
||||
|
||||
|
||||
# TODO: let's merge this with test_msg_recoverydevice_shamir.py
|
||||
def enter_all_shares(debug, shares):
|
||||
word_count = len(shares[0].split(" "))
|
||||
|
||||
# Homescreen - proceed to word number selection
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Input word number
|
||||
code = yield
|
||||
assert code == B.MnemonicWordCount
|
||||
debug.input(str(word_count))
|
||||
# Homescreen - proceed to share entry
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Enter shares
|
||||
for share in shares:
|
||||
code = yield
|
||||
assert code == B.MnemonicInput
|
||||
# Enter mnemonic words
|
||||
for word in share.split(" "):
|
||||
debug.input(word)
|
||||
|
||||
# Homescreen - continue
|
||||
# or Homescreen - confirm success
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
@ -4,6 +4,8 @@ from trezorlib import btc, device, messages
|
||||
from trezorlib.messages import ButtonRequestType as B, ResetDeviceBackupType
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from .common import recovery_enter_shares
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
@ -235,7 +237,7 @@ def recover(client, shares):
|
||||
yield # Confirm Recovery
|
||||
debug.press_yes()
|
||||
# run recovery flow
|
||||
yield from enter_all_shares(debug, shares)
|
||||
yield from recovery_enter_shares(debug, shares, groups=True)
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
@ -247,41 +249,3 @@ def recover(client, shares):
|
||||
assert ret == messages.Success(message="Device recovered")
|
||||
assert client.features.pin_protection is False
|
||||
assert client.features.passphrase_protection is False
|
||||
|
||||
|
||||
# TODO: let's merge this with test_msg_recoverydevice_supershamir.py
|
||||
def enter_all_shares(debug, shares):
|
||||
word_count = len(shares[0].split(" "))
|
||||
|
||||
# Homescreen - proceed to word number selection
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Input word number
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicWordCount
|
||||
debug.input(str(word_count))
|
||||
# Homescreen - proceed to share entry
|
||||
yield
|
||||
debug.press_yes()
|
||||
# Enter shares
|
||||
for index, share in enumerate(shares):
|
||||
if index >= 1:
|
||||
# confirm remaining shares
|
||||
debug.swipe_down()
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.Other
|
||||
debug.press_yes()
|
||||
code = yield
|
||||
assert code == messages.ButtonRequestType.MnemonicInput
|
||||
# Enter mnemonic words
|
||||
for word in share.split(" "):
|
||||
debug.input(word)
|
||||
|
||||
# Confirm share entered
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
||||
# Homescreen - continue
|
||||
# or Homescreen - confirm success
|
||||
yield
|
||||
debug.press_yes()
|
||||
|
Loading…
Reference in New Issue
Block a user