From bc38ce62c3b5dda228943a1b8d20a75dd59ff20b Mon Sep 17 00:00:00 2001 From: Henrik Soerensen Date: Sat, 16 Mar 2024 16:28:08 -0600 Subject: [PATCH] Use KMD for wallet creation (#31) --- install.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 6876602..fa54785 100755 --- a/install.sh +++ b/install.sh @@ -7,6 +7,8 @@ headless_install=0 is_root=0 skip_account_setup=0 migrate_host_based_setup=0 +kmd_token="" +wallet_password="" bold=$(tput bold) normal=$(tput sgr0) @@ -229,12 +231,43 @@ catchup_node() { display_banner "Caught up with the network!" } +ask_for_password() { + local password + local password_repeat + while true; do + # shellcheck disable=SC2162 + read -sp "Password: " password + echo + # shellcheck disable=SC2162 + read -sp "Repeat password: " password_repeat + echo + if [[ ${password} == "${password_repeat}" ]]; then + wallet_password=${password} + break + else + # shellcheck disable=SC2028 + echo -e "\n" + echo "Passwords do not match. Please try again." + fi + done +} + create_wallet() { if [[ $(execute_docker_command "goal wallet list | wc -l") -eq 1 ]]; then echo "Let's create a new wallet for you. Please provide a password for security." - echo "Seeing the wallet's mnemonic is optional. Any Voi will be linked with the account we'll create or import after wallet creation." - execute_interactive_docker_command "goal wallet new voi" + get_kmd_token + + ask_for_password + +read -r -d '' json_data <