funga-eth

Ethereum implementation of the funga keystore and signer
Log | Files | Refs | README | LICENSE

commit 30c82b9cd1ea912ff872e699509a8fcac094405a
parent 903f65936e66f3dae23e04b07d1ff434fbe1015c
Author: lash <dev@holbrook.no>
Date:   Mon, 24 Jan 2022 12:04:21 +0000

Add message signer cli

Diffstat:
MCHANGELOG | 2++
Afunga/eth/runnable/msg.py | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Msetup.py | 3++-
3 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,3 +1,5 @@ +* 0.5.4 + - Add message signer cli * 0.5.3 - Upgrade RLP to 3.0.0 (eliminates really annoying cytoolz warning on stdout) --- diff --git a/funga/eth/runnable/msg.py b/funga/eth/runnable/msg.py @@ -0,0 +1,49 @@ +# standard imports +import os +import logging +import sys +import json +import argparse +import getpass + +# external impors +import coincurve +from hexathon import strip_0x + +# local imports +from funga.error import DecryptError +from funga.eth.keystore.dict import DictKeystore +from funga.eth.signer import EIP155Signer + + +logging.basicConfig(level=logging.WARNING) +logg = logging.getLogger() + +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('msg', type=str, help='Message to sign') +args = argparser.parse_args() + +if args.v: + logg.setLevel(logging.DEBUG) + + +def main(): + passphrase = os.environ.get('WALLET_PASSPHRASE', os.environ.get('PASSPHRASE')) + if args.z: + passphrase = '' + if passphrase == None: + passphrase = getpass.getpass('decryption phrase: ') + + keystore = DictKeystore() + address = keystore.import_keystore_file(args.f, password=passphrase) + + signer = EIP155Signer(keystore) + sig = signer.sign_ethereum_message(address, args.msg.encode('utf-8').hex(), password=passphrase) + sys.stdout.write(sig.hex()) + + +if __name__ == '__main__': + main() diff --git a/setup.py b/setup.py @@ -33,7 +33,7 @@ f.close() setup( name="funga-eth", - version="0.5.3", + version="0.5.4b1", description="Ethereum implementation of the funga keystore and signer", author="Louis Holbrook", author_email="dev@holbrook.no", @@ -55,6 +55,7 @@ setup( 'console_scripts': [ 'funga-ethd=funga.eth.runnable.signer:main', 'eth-keyfile=funga.eth.runnable.keyfile:main', + 'eth-sign-msg=funga.eth.runnable.msg:main', ], }, url='https://gitlab.com/chaintool/funga-eth',