diff --git a/CHANGELOG b/CHANGELOG index 20d2dc3..4c0b8e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +- 0.0.19 + * Passphrase file option to unlock keyfile for CLI tooling +- 0.0.18 + * Upgrade hexathon skipping buggy compact hex method - 0.0.17 * Add loglevel environment variable - 0.0.16 diff --git a/chainlib/cli/arg.py b/chainlib/cli/arg.py index 37ab6cf..7d71bf8 100644 --- a/chainlib/cli/arg.py +++ b/chainlib/cli/arg.py @@ -166,6 +166,7 @@ class ArgumentParser(argparse.ArgumentParser): self.add_argument('--seq', action='store_true', help='Use sequential rpc ids') if arg_flags & Flag.KEY_FILE: self.add_argument('-y', '--key-file', dest='y', type=str, help='Keystore file to use for signing or address') + self.add_argument('--passphrase-file', dest='passphrase_file', type=str, help='File containing passphrase for keystore') if arg_flags & Flag.SEND: self.add_argument('-s', '--send', dest='s', action='store_true', help='Send to network') if arg_flags & Flag.RAW: diff --git a/chainlib/cli/config.py b/chainlib/cli/config.py index 2fd2356..e63b632 100644 --- a/chainlib/cli/config.py +++ b/chainlib/cli/config.py @@ -3,6 +3,7 @@ import logging import os import sys import re +import stat # external imports import confini @@ -213,7 +214,14 @@ class Config(confini.Config): args_override['CHAIN_SPEC'] = getattr(args, 'i') if arg_flags & Flag.KEY_FILE: args_override['WALLET_KEY_FILE'] = getattr(args, 'y') - + fp = getattr(args, 'passphrase_file') + if fp != None: + st = os.stat(fp) + if stat.S_IMODE(st.st_mode) & (stat.S_IRWXO | stat.S_IRWXG) > 0: + logg.warning('others than owner have access on password file') + f = open(fp, 'r') + args_override['WALLET_PASSPHRASE'] = f.read() + f.close() config.dict_override(args_override, 'cli args') if arg_flags & Flag.PROVIDER: diff --git a/setup.cfg b/setup.cfg index 9619b72..e7828ff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ name=chainlib license=WTFPL2 author_email=dev@holbrook.no description=Generic blockchain access library and tooling -version=0.0.18 +version=0.0.19 url=https://gitlab.com/chaintools/chainlib author=Louis Holbrook