forked from chaintool/funga-eth
Allow binary msg sign in cli tool
This commit is contained in:
parent
a534f8ca1e
commit
05435268bf
@ -1,3 +1,5 @@
|
|||||||
|
* 0.6.2
|
||||||
|
- Enable signing of binary message
|
||||||
* 0.6.1
|
* 0.6.1
|
||||||
- Avoid padding of addresses missing one nibble
|
- Avoid padding of addresses missing one nibble
|
||||||
* 0.6.0
|
* 0.6.0
|
||||||
|
@ -24,6 +24,7 @@ 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('-z', action='store_true', help='zero-length password')
|
||||||
argparser.add_argument('-v', action='store_true', help='be verbose')
|
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('-0', dest='nonl', action='store_true', help='no newline at end of output')
|
||||||
|
argparser.add_argument('-b', '--binary', dest='binary', action='store_true', help='parse input as binary hex')
|
||||||
argparser.add_argument('msg', type=str, help='Message to sign')
|
argparser.add_argument('msg', type=str, help='Message to sign')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
@ -42,7 +43,14 @@ def main():
|
|||||||
address = keystore.import_keystore_file(args.f, password=passphrase)
|
address = keystore.import_keystore_file(args.f, password=passphrase)
|
||||||
|
|
||||||
signer = EIP155Signer(keystore)
|
signer = EIP155Signer(keystore)
|
||||||
sig = signer.sign_ethereum_message(address, args.msg.encode('utf-8').hex(), password=passphrase)
|
|
||||||
|
msg = None
|
||||||
|
if args.binary:
|
||||||
|
hx = strip_0x(args.msg, pad=True)
|
||||||
|
msg = bytes.fromhex(hx)
|
||||||
|
else:
|
||||||
|
msg = args.msg.encode('utf-8').hex()
|
||||||
|
sig = signer.sign_ethereum_message(address, msg, password=passphrase)
|
||||||
|
|
||||||
r = sig.hex()
|
r = sig.hex()
|
||||||
if not args.nonl:
|
if not args.nonl:
|
||||||
|
2
setup.py
2
setup.py
@ -33,7 +33,7 @@ f.close()
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="funga-eth",
|
name="funga-eth",
|
||||||
version="0.6.1",
|
version="0.6.2",
|
||||||
description="Ethereum implementation of the funga keystore and signer",
|
description="Ethereum implementation of the funga keystore and signer",
|
||||||
author="Louis Holbrook",
|
author="Louis Holbrook",
|
||||||
author_email="dev@holbrook.no",
|
author_email="dev@holbrook.no",
|
||||||
|
Loading…
Reference in New Issue
Block a user