Passphrase file in wallet key file

This commit is contained in:
lash 2022-02-20 18:27:00 +00:00
parent d3f6d1138d
commit d24fea2d4f
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 15 additions and 2 deletions

View File

@ -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 - 0.0.17
* Add loglevel environment variable * Add loglevel environment variable
- 0.0.16 - 0.0.16

View File

@ -166,6 +166,7 @@ class ArgumentParser(argparse.ArgumentParser):
self.add_argument('--seq', action='store_true', help='Use sequential rpc ids') self.add_argument('--seq', action='store_true', help='Use sequential rpc ids')
if arg_flags & Flag.KEY_FILE: 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('-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: if arg_flags & Flag.SEND:
self.add_argument('-s', '--send', dest='s', action='store_true', help='Send to network') self.add_argument('-s', '--send', dest='s', action='store_true', help='Send to network')
if arg_flags & Flag.RAW: if arg_flags & Flag.RAW:

View File

@ -3,6 +3,7 @@ import logging
import os import os
import sys import sys
import re import re
import stat
# external imports # external imports
import confini import confini
@ -213,7 +214,14 @@ class Config(confini.Config):
args_override['CHAIN_SPEC'] = getattr(args, 'i') args_override['CHAIN_SPEC'] = getattr(args, 'i')
if arg_flags & Flag.KEY_FILE: if arg_flags & Flag.KEY_FILE:
args_override['WALLET_KEY_FILE'] = getattr(args, 'y') 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') config.dict_override(args_override, 'cli args')
if arg_flags & Flag.PROVIDER: if arg_flags & Flag.PROVIDER:

View File

@ -3,7 +3,7 @@ name=chainlib
license=WTFPL2 license=WTFPL2
author_email=dev@holbrook.no author_email=dev@holbrook.no
description=Generic blockchain access library and tooling description=Generic blockchain access library and tooling
version=0.0.18 version=0.0.19
url=https://gitlab.com/chaintools/chainlib url=https://gitlab.com/chaintools/chainlib
author=Louis Holbrook author=Louis Holbrook