commit 176cf237ff58d39bddc6817ba0b2174218252ecf
parent afc0f4a8e9b204c2d7fd9cf7dfe0195db655d42d
Author: lash <dev@holbrook.no>
Date: Fri, 16 Dec 2022 11:45:15 +0000
Add passphrase file argument to keyfile cli command
Diffstat:
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,3 +1,5 @@
+* 0.6.4
+ - Add passphrase file option to keyfile cli command
* 0.6.3
- Change license to AGPL3 and copyright waived to public domain
* 0.6.2
diff --git a/README b/README
diff --git a/funga/eth/runnable/keyfile.py b/funga/eth/runnable/keyfile.py
@@ -5,6 +5,7 @@ import sys
import json
import argparse
import getpass
+import stat
# external impors
import coincurve
@@ -30,6 +31,7 @@ logg = logging.getLogger()
argparser = argparse.ArgumentParser()
argparser.add_argument('-d', '--decrypt', dest='d', type=str, help='decrypt file')
argparser.add_argument('--private-key', dest='private_key', action='store_true', help='output private key instead of address')
+argparser.add_argument('--passphrase-file', dest='passphrase_file', type=str, help='Keystore file to use for signing or address')
argparser.add_argument('-0', dest='nonl', action='store_true', help='no newline at end of output')
argparser.add_argument('-z', action='store_true', help='zero-length password')
argparser.add_argument('-k', type=str, help='load key from file')
@@ -56,8 +58,19 @@ def main():
global pk_hex
passphrase = os.environ.get('WALLET_PASSPHRASE', os.environ.get('PASSPHRASE'))
+
if args.z:
passphrase = ''
+ else:
+ 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')
+ passphrase = f.read()
+ f.close()
+
r = None
if mode == 'decrypt':
if passphrase == None:
diff --git a/setup.py b/setup.py
@@ -33,7 +33,7 @@ f.close()
setup(
name="funga-eth",
- version="0.6.3",
+ version="0.6.4",
description="Ethereum implementation of the funga keystore and signer",
author="Louis Holbrook",
author_email="dev@holbrook.no",