@@ -1532,16 +1532,17 @@ def test_hsmtool_checkhsm_with_passphrase(node_factory):
1532
1532
hsmtool = HsmTool (node_factory .directory , "checkhsm" , hsm_path )
1533
1533
master_fd , slave_fd = os .openpty ()
1534
1534
hsmtool .start (stdin = slave_fd )
1535
- hsmtool .wait_for_log (r"Enter hsm_secret password:" ) # Unlock file
1535
+ hsmtool .wait_for_log (r"Enter hsm_secret password:" ) # Decrypt file
1536
1536
write_all (master_fd , "secret_passphrase\n " .encode ("utf-8" ))
1537
- hsmtool .wait_for_log (r"Enter your passphrase:" ) # Verification passphrase
1537
+ hsmtool .wait_for_log (r"Enter your passphrase:" ) # Backup verification
1538
1538
write_all (master_fd , "secret_passphrase\n " .encode ("utf-8" ))
1539
1539
hsmtool .wait_for_log (r"Introduce your BIP39 word list" )
1540
1540
write_all (master_fd , "ritual idle hat sunny universe pluck key alpha wing cake have wedding\n " .encode ("utf-8" ))
1541
1541
assert hsmtool .proc .wait (WAIT_TIMEOUT ) == 0
1542
1542
hsmtool .is_in_log (r"OK" )
1543
1543
1544
1544
1545
+
1545
1546
def test_hsmtool_checkhsm_no_passphrase (node_factory ):
1546
1547
"""Test checkhsm with mnemonic that has no passphrase"""
1547
1548
l1 = node_factory .get_node (start = False )
@@ -2059,8 +2060,6 @@ def test_hsmtool_makerune(node_factory):
2059
2060
hsmtool = HsmTool (node_factory .directory , "generatehsm" , hsm_path )
2060
2061
master_fd , slave_fd = os .openpty ()
2061
2062
hsmtool .start (stdin = slave_fd )
2062
- hsmtool .wait_for_log (r"Select your language:" )
2063
- write_all (master_fd , "0\n " .encode ("utf-8" ))
2064
2063
hsmtool .wait_for_log (r"Introduce your BIP39 word list" )
2065
2064
write_all (master_fd , "ritual idle hat sunny universe pluck key alpha wing "
2066
2065
"cake have wedding\n " .encode ("utf-8" ))
@@ -2069,8 +2068,14 @@ def test_hsmtool_makerune(node_factory):
2069
2068
assert hsmtool .proc .wait (WAIT_TIMEOUT ) == 0
2070
2069
hsmtool .is_in_log (r"New hsm_secret file created" )
2071
2070
2072
- cmd_line = ["tools/hsmtool" , "makerune" , hsm_path ]
2073
- out = subprocess .check_output (cmd_line ).decode ("utf8" ).split ("\n " )[0 ]
2071
+ # Test makerune with the passphrase
2072
+ hsmtool = HsmTool (node_factory .directory , "makerune" , hsm_path )
2073
+ master_fd , slave_fd = os .openpty ()
2074
+ hsmtool .start (stdin = slave_fd )
2075
+ hsmtool .wait_for_log (r"Enter hsm_secret password:" )
2076
+ write_all (master_fd , "This is actually not a passphrase\n " .encode ("utf-8" ))
2077
+ assert hsmtool .proc .wait (WAIT_TIMEOUT ) == 0
2078
+ out = hsmtool .logs .split ("\n " )[- 2 ] # Get the rune output (last line before empty line)
2074
2079
2075
2080
l1 .start ()
2076
2081
0 commit comments