From 4c09a546a4b4ffb26e3d027432e08393219156f4 Mon Sep 17 00:00:00 2001 From: Phistr90 Date: Wed, 15 Jan 2020 18:37:41 +0100 Subject: [PATCH] use getpass to avoid echoing the password input --- deposit.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deposit.py b/deposit.py index da41c6f..2b22ad0 100644 --- a/deposit.py +++ b/deposit.py @@ -24,7 +24,7 @@ bls_priv_to_pub, ) from utils.crypto import SHA256 - +import getpass def get_args(): parser = ArgumentParser(description='🦄 : the validator deposit assistant') @@ -58,12 +58,12 @@ def calculate_credentials(mnemonic: str, password: str, num_validators: int) -> def save_keystores(credentials: List[Dict[str, Union[int, str]]], folder: str='./', save_withdrawal_keys: bool=False): def save_credentials(cred_type: 'str'): - password = input('Enter the password that secures your %s keys.' % cred_type) - confirm_password = input('Type your password again to confirm.') + password = getpass.getpass(prompt='Enter the password that secures your %s keys.' % cred_type) + confirm_password = getpass.getpass(prompt='Type your password again to confirm.') while password != confirm_password: print("\n Your passwords didn't match, please try again.\n") - password = input('Enter the password that secures your %s keys.' % cred_type) - confirm_password = input('Type your password again to confirm.') + password = getpass.getpass(prompt='Enter the password that secures your %s keys.' % cred_type) + confirm_password = getpass.getpass(prompt='Type your password again to confirm.') for credential in credentials: keystore = ScryptKeystore.encrypt(secret=int(credential['%s_sk' % cred_type]).to_bytes(32, 'big'), password=password, path=str(credential['%s_path' % cred_type]))