mirror of
https://github.com/sunknudsen/privacy-guides.git
synced 2025-02-23 17:43:56 +00:00
94 lines
1.5 KiB
Plaintext
94 lines
1.5 KiB
Plaintext
#!/usr/bin/expect
|
|
|
|
source ./test.exp
|
|
|
|
set secret "foo\nbar"
|
|
set passphrase "asdasd"
|
|
|
|
test_label "Should convert 2-of-3 Shamir Secret Sharing backup to default"
|
|
|
|
source ./tests/helpers/shamir-2-of-3-backup.exp
|
|
|
|
spawn qr-clone.sh --qr-restore-options "--images \"$short_hash_1.jpg,$short_hash_2.jpg\" --shamir-secret-sharing --share-threshold 2"
|
|
|
|
expect {
|
|
-re {Restoring…}
|
|
}
|
|
|
|
expect {
|
|
-re {\[sudo\] password for pi:} {
|
|
test_send "$env(password)\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Please type passphrase and press enter} {
|
|
test_send "$passphrase\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Show secret \(y or n\)\?} {
|
|
test_send "n\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Done}
|
|
}
|
|
|
|
expect {
|
|
-re {Backing up…}
|
|
}
|
|
|
|
expect {
|
|
-re {Format USB flash drive \(y or n\)\?} {
|
|
test_send "n\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Please type passphrase and press enter} {
|
|
test_send "$passphrase\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Please type passphrase and press enter \(again\)} {
|
|
test_send "$passphrase\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Show passphrase \(y or n\)\?} {
|
|
test_send "n\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {SHA512 short hash: .+?([a-f0-9]{8})} {
|
|
set short_hash $expect_out(1,string)
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Show SHA512 hash as QR code \(y or n\)\?} {
|
|
test_send "n\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Done}
|
|
}
|
|
|
|
source ./tests/helpers/restore.exp
|
|
|
|
regsub -all {\033\[[0-9]*m(\017)?} $restored_secret {} restored_secret
|
|
regsub -all {\r} $restored_secret {} restored_secret
|
|
|
|
if { "$restored_secret" != "$secret" } {
|
|
test_failed
|
|
} else {
|
|
test_ok
|
|
}
|