fix: add getpass
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-03-14 15:48:36 +03:00
parent 67f947a9af
commit 47a9b259ae
7 changed files with 78 additions and 14 deletions

View File

@@ -1,17 +1,19 @@
# standard imports
import stat
import os
from getpass import getpass
import logging
import os
import stat
# external imports
from funga.eth.keystore.dict import DictKeystore
from funga.eth.signer import EIP155Signer
from chainlib.eth.cli import Rpc
from chainlib.cli import Wallet
from chainlib.eth.cli import Rpc
# local imports
from cic.keystore import KeystoreDirectory
logg = logging.getLogger(__name__)
@@ -22,7 +24,8 @@ class EthKeystoreDirectory(DictKeystore, KeystoreDirectory):
"""
def get_passphrase():
return getpass('Enter passphrase: ')
def parse_adapter(config, signer_hint):
"""Determine and instantiate signer and rpc from configuration.
@@ -44,7 +47,7 @@ def parse_adapter(config, signer_hint):
if stat.S_ISDIR(st.st_mode):
logg.debug("signer hint is directory")
keystore = EthKeystoreDirectory()
keystore.process_dir(signer_hint)
keystore.process_dir(signer_hint, password_retriever=get_passphrase)
w = Wallet(EIP155Signer, keystore=keystore)
signer = EIP155Signer(keystore)
@@ -63,6 +66,6 @@ def list_keys(config, signer_hint):
if stat.S_ISDIR(st.st_mode):
logg.debug("signer hint is directory")
keystore = EthKeystoreDirectory()
keystore.process_dir(signer_hint, default_password=config.get('WALLET_PASSPHRASE', ''))
keystore.process_dir(signer_hint, default_password=config.get('WALLET_PASSPHRASE', ''), password_retriever=get_passphrase)
return keystore.list()
return keystore.list()