fix: add getpass
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user