commit c3033e9572fa8fbfe4220ecff448394ccab16b09
parent d50489f0ba01d927bf16465e3add64bb1029027a
Author: lash <dev@holbrook.no>
Date: Tue, 25 Jan 2022 11:11:55 +0000
Add no-newline option for output
Diffstat:
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,5 +1,7 @@
* 0.5.4
- Add message signer cli
+ - Add pbkdf2 support
+ - Add -0 flag for omitting newline on output
* 0.5.3
- Upgrade RLP to 3.0.0 (eliminates really annoying cytoolz warning on stdout)
---
diff --git a/funga/eth/runnable/keyfile.py b/funga/eth/runnable/keyfile.py
@@ -30,6 +30,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('-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')
argparser.add_argument('-v', action='store_true', help='be verbose')
@@ -79,10 +80,12 @@ def main():
else:
pk_bytes = os.urandom(32)
pk = coincurve.PrivateKey(secret=pk_bytes)
- o = to_dict(pk_bytes, passphrase)
+ o = to_dict(pk_bytes, passphrase=passphrase)
r = json.dumps(o)
- print(r)
+ if not args.nonl:
+ r += "\n"
+ sys.stdout.write(r)
if __name__ == '__main__':
diff --git a/funga/eth/runnable/msg.py b/funga/eth/runnable/msg.py
@@ -23,6 +23,7 @@ argparser = argparse.ArgumentParser()
argparser.add_argument('-f', type=str, help='Keyfile to use for signing')
argparser.add_argument('-z', action='store_true', help='zero-length password')
argparser.add_argument('-v', action='store_true', help='be verbose')
+argparser.add_argument('-0', dest='nonl', action='store_true', help='no newline at end of output')
argparser.add_argument('msg', type=str, help='Message to sign')
args = argparser.parse_args()
@@ -42,7 +43,11 @@ def main():
signer = EIP155Signer(keystore)
sig = signer.sign_ethereum_message(address, args.msg.encode('utf-8').hex(), password=passphrase)
- sys.stdout.write(sig.hex())
+
+ r = sig.hex()
+ if not args.nonl:
+ r += "\n"
+ sys.stdout.write(r)
if __name__ == '__main__':
diff --git a/setup.py b/setup.py
@@ -33,7 +33,7 @@ f.close()
setup(
name="funga-eth",
- version="0.5.4b1",
+ version="0.5.4b2",
description="Ethereum implementation of the funga keystore and signer",
author="Louis Holbrook",
author_email="dev@holbrook.no",