Improved encrypted paper backup guide

Added secret confirmation, BIP39 test and word split features
This commit is contained in:
Sun Knudsen 2021-02-25 14:03:38 -05:00
parent 838469b946
commit 04419bc75b
No known key found for this signature in database
GPG key ID: 1FA767862BBD1305
9 changed files with 2147 additions and 8 deletions

35
how-to-create-encrypted-paper-backup/qr-restore.sh Normal file → Executable file
View file

@ -1,11 +1,28 @@
#! /bin/bash
set -e
positional=()
while [[ $# -gt 0 ]]; do
argument="$1"
case $argument in
--split-words)
split_words=true
shift
;;
*)
positional+=("$1")
shift
;;
esac
done
set -- "${positional[@]}"
bold=$(tput bold)
red=$(tput setaf 1)
normal=$(tput sgr0)
set -e
printf "%s\n" "Scan QR code…"
data=""
@ -37,7 +54,17 @@ read -r answer
if [ "$answer" = "y" ]; then
secret=$(echo -e "$encrypted_secret" | gpg --decrypt)
gpg-connect-agent reloadagent /bye > /dev/null 2>&1
printf "Secret: $bold%s$normal\n" "$secret"
if [ "$split_words" = true ]; then
printf "%s" "Secret: "
array=($secret)
for i in ${!array[@]}; do
position=$(($i + 1))
printf "%s" "$position.$bold${array[$i]}$normal "
done
printf "\n"
else
printf "Secret: $bold%s$normal\n" "$secret"
fi
fi
printf "%s\n" "Done"
printf "%s\n" "Done"