Add missing param in middleware for sign

This commit is contained in:
nolash 2020-12-25 12:53:16 +01:00
parent 07bdbe9999
commit 0afacff6c6
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
5 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,5 @@
- 0.4.10
- Add bytes and string handling in inner signer backend
* 0.4.9 * 0.4.9
- Accept string message format for message signing - Accept string message format for message signing
* 0.4.8 * 0.4.8

View File

@ -46,8 +46,10 @@ class ReferenceSigner(Signer):
#z = keys.ecdsa_sign(message_hash=g, private_key=k) #z = keys.ecdsa_sign(message_hash=g, private_key=k)
z = None z = None
if type(message).__name__ == 'str': if type(message).__name__ == 'str':
logg.debug('signing message in "str" format: {}'.format(message))
z = k.sign_msg(message.encode('utf-8')) z = k.sign_msg(message.encode('utf-8'))
elif type(message).__name__ == 'bytes': elif type(message).__name__ == 'bytes':
logg.debug('signing message in "bytes" format: {}'.format(message.hex()))
z = k.sign_msg(message) z = k.sign_msg(message)
else: else:
raise ValueError('message must be type str or bytes, received {}'.format(type(message).__name__)) raise ValueError('message must be type str or bytes, received {}'.format(type(message).__name__))

View File

@ -99,7 +99,7 @@ class PlatformMiddleware:
s = socket.socket(family=socket.AF_UNIX, type=socket.SOCK_STREAM, proto=0) s = socket.socket(family=socket.AF_UNIX, type=socket.SOCK_STREAM, proto=0)
ipc_provider_workaround = s.connect(self.ipcaddr) ipc_provider_workaround = s.connect(self.ipcaddr)
logg.info('redirecting method {} params {} original params {}'.format(method, params, suspect_params)) 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) j = json.dumps(o)
logg.debug('send {}'.format(j)) logg.debug('send {}'.format(j))
s.send(j.encode('utf-8')) s.send(j.encode('utf-8'))

View File

@ -24,7 +24,7 @@ f.close()
setup( setup(
name="crypto-dev-signer", name="crypto-dev-signer",
version="0.4.9", version="0.4.10",
description="A signer and keystore daemon and library for cryptocurrency software development", description="A signer and keystore daemon and library for cryptocurrency software development",
author="Louis Holbrook", author="Louis Holbrook",
author_email="dev@holbrook.no", author_email="dev@holbrook.no",

View File

@ -90,6 +90,7 @@ class TestSign(unittest.TestCase):
def test_sign_message(self): def test_sign_message(self):
s = ReferenceSigner(self.pk_getter) s = ReferenceSigner(self.pk_getter)
z = s.signEthereumMessage(tx_ints['from'], 'foo') z = s.signEthereumMessage(tx_ints['from'], 'foo')
z = s.signEthereumMessage(tx_ints['from'], b'foo')
if __name__ == '__main__': if __name__ == '__main__':