Implemented create-seed feature

This commit is contained in:
Sun Knudsen 2021-03-06 14:37:53 -05:00
parent 495177bd9b
commit 09667692cd
No known key found for this signature in database
GPG Key ID: 1FA767862BBD1305
2 changed files with 14 additions and 2 deletions

View File

@ -11,10 +11,15 @@ while [[ $# -gt 0 ]]; do
"Usage: qr-backup.sh [options]" \
"" \
"Options:" \
" --bip39 test secret against BIP39 word list" \
" -h, --help display help for command"
" --create-seed create random 24-word BIP39 seed phrase" \
" --bip39 test secret against BIP39 word list" \
" -h, --help display help for command"
exit 0
;;
--create-seed)
create_seed=true
shift
;;
--bip39)
bip39=true
shift
@ -65,6 +70,13 @@ if ! mount | grep $usb > /dev/null; then
sudo mount $dev $usb -o uid=pi,gid=pi
fi
if [ "$create_seed" = true ]; then
printf "%s\n" "Creating random 24-word BIP39 seed phrase…"
secret=$(cat "$basedir/bip39.txt" | shuf --head-count 24 --random-source=/dev/urandom --repeat | tr "\n" " ")
echo $secret
sleep 1
fi
if [ -z "$secret" ]; then
tput sc
printf "%s\n" "Type secret and press enter"