mirror of
https://github.com/sunknudsen/privacy-guides.git
synced 2025-02-23 01:03:59 +00:00
Polished encrypted paper backup guide
This commit is contained in:
parent
a2d7276e14
commit
3d5cea224b
@ -136,7 +136,7 @@ qr-backup.sh
|
||||
|
||||
### Restore encrypted paper backup
|
||||
|
||||
> Heads-up: use `--split-words` to split secret into word list.
|
||||
> Heads-up: use `--word-list` to split secret into word list.
|
||||
|
||||
```shell
|
||||
qr-restore.sh
|
||||
|
@ -89,7 +89,7 @@ if [ "$bip39" = true ]; then
|
||||
words=($secret)
|
||||
for word in ${words[@]}; do
|
||||
if ! exists $word; then
|
||||
printf "$red%s$normal\n" "Invalid word $bold$word$normal"
|
||||
printf "$red%s $bold%s$normal\n" "Invalid word" "$word"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@ -102,8 +102,8 @@ encrypted_secret_hash=$(echo -n "$encrypted_secret" | openssl dgst -sha512 | sed
|
||||
encrypted_secret_short_hash=$(echo -n "$encrypted_secret_hash" | head -c 8)
|
||||
|
||||
printf "%s\n" "$encrypted_secret"
|
||||
printf "SHA512 hash: $bold%s$normal\n" "$encrypted_secret_hash"
|
||||
printf "SHA512 short hash: $bold%s$normal\n" "$encrypted_secret_short_hash"
|
||||
printf "%s: $bold%s$normal\n" "SHA512 hash" "$encrypted_secret_hash"
|
||||
printf "%s: $bold%s$normal\n" "SHA512 short hash" "$encrypted_secret_short_hash"
|
||||
|
||||
echo -n "$encrypted_secret" | qr --error-correction=H > "$tmp/secret.png"
|
||||
|
||||
|
Binary file not shown.
@ -2,6 +2,8 @@
|
||||
|
||||
set -e
|
||||
|
||||
tput reset
|
||||
|
||||
printf "%s\n" "Restoring…"
|
||||
. qr-restore.sh
|
||||
|
||||
|
Binary file not shown.
@ -6,8 +6,8 @@ positional=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
argument="$1"
|
||||
case $argument in
|
||||
--split-words)
|
||||
split_words=true
|
||||
--word-list)
|
||||
word_list=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
@ -23,6 +23,8 @@ bold=$(tput bold)
|
||||
red=$(tput setaf 1)
|
||||
normal=$(tput sgr0)
|
||||
|
||||
tput reset
|
||||
|
||||
printf "%s\n" "Scan QR code…"
|
||||
|
||||
data=""
|
||||
@ -45,8 +47,8 @@ encrypted_secret_hash=$(echo -n "$encrypted_secret" | openssl dgst -sha512 | sed
|
||||
encrypted_secret_short_hash=$(echo -n "$encrypted_secret_hash" | head -c 8)
|
||||
|
||||
printf "%s\n" "$encrypted_secret"
|
||||
printf "SHA512 hash: $bold%s$normal\n" "$encrypted_secret_hash"
|
||||
printf "SHA512 short hash: $bold%s$normal\n" "$encrypted_secret_short_hash"
|
||||
printf "%s: $bold%s$normal\n" "SHA512 hash" "$encrypted_secret_hash"
|
||||
printf "%s: $bold%s$normal\n" "SHA512 short hash" "$encrypted_secret_short_hash"
|
||||
|
||||
printf "$bold$red%s$normal\n" "Show secret? (y or n)? "
|
||||
|
||||
@ -54,12 +56,12 @@ read -r answer
|
||||
if [ "$answer" = "y" ]; then
|
||||
secret=$(echo -e "$encrypted_secret" | gpg --decrypt)
|
||||
gpg-connect-agent reloadagent /bye > /dev/null 2>&1
|
||||
if [ "$split_words" = true ]; then
|
||||
if [ "$word_list" = true ]; then
|
||||
printf "%s" "Secret: "
|
||||
array=($secret)
|
||||
for i in ${!array[@]}; do
|
||||
position=$(($i + 1))
|
||||
printf "%s" "$position.$bold${array[$i]}$normal "
|
||||
printf "%d. $bold%s$normal " "$position" "${array[$i]}"
|
||||
done
|
||||
printf "\n"
|
||||
else
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user