commit 0afacff6c65d40cd801880610fce0630f3b2ed19
parent 07bdbe9999ad0ade3ec01d86608cbde982891fe3
Author: nolash <dev@holbrook.no>
Date: Fri, 25 Dec 2020 12:53:16 +0100
Add missing param in middleware for sign
Diffstat:
5 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,3 +1,5 @@
+- 0.4.10
+ - Add bytes and string handling in inner signer backend
* 0.4.9
- Accept string message format for message signing
* 0.4.8
diff --git a/crypto_dev_signer/eth/signer/defaultsigner.py b/crypto_dev_signer/eth/signer/defaultsigner.py
@@ -46,8 +46,10 @@ class ReferenceSigner(Signer):
#z = keys.ecdsa_sign(message_hash=g, private_key=k)
z = None
if type(message).__name__ == 'str':
+ logg.debug('signing message in "str" format: {}'.format(message))
z = k.sign_msg(message.encode('utf-8'))
elif type(message).__name__ == 'bytes':
+ logg.debug('signing message in "bytes" format: {}'.format(message.hex()))
z = k.sign_msg(message)
else:
raise ValueError('message must be type str or bytes, received {}'.format(type(message).__name__))
diff --git a/crypto_dev_signer/eth/web3ext/middleware.py b/crypto_dev_signer/eth/web3ext/middleware.py
@@ -99,7 +99,7 @@ class PlatformMiddleware:
s = socket.socket(family=socket.AF_UNIX, type=socket.SOCK_STREAM, proto=0)
ipc_provider_workaround = s.connect(self.ipcaddr)
logg.info('redirecting method {} params {} original paramsĀ {}'.format(method, params, suspect_params))
- o = jsonrpc_request(method, params[0])
+ o = jsonrpc_request(method, params[0], params[1])
j = json.dumps(o)
logg.debug('send {}'.format(j))
s.send(j.encode('utf-8'))
diff --git a/setup.py b/setup.py
@@ -24,7 +24,7 @@ f.close()
setup(
name="crypto-dev-signer",
- version="0.4.9",
+ version="0.4.10",
description="A signer and keystore daemon and library for cryptocurrency software development",
author="Louis Holbrook",
author_email="dev@holbrook.no",
diff --git a/test/test_sign.py b/test/test_sign.py
@@ -90,6 +90,7 @@ class TestSign(unittest.TestCase):
def test_sign_message(self):
s = ReferenceSigner(self.pk_getter)
z = s.signEthereumMessage(tx_ints['from'], 'foo')
+ z = s.signEthereumMessage(tx_ints['from'], b'foo')
if __name__ == '__main__':