funga

Signer and keystore daemon and library for cryptocurrency software development
Log | Files | Refs | README | LICENSE

commit 07bdbe9999ad0ade3ec01d86608cbde982891fe3
parent 4d064240f92d5a50ff10361899a77b4aedaaddd8
Author: nolash <dev@holbrook.no>
Date:   Fri, 25 Dec 2020 12:34:05 +0100

Handle string and binary in signer backend

Diffstat:
Mcrypto_dev_signer/eth/signer/defaultsigner.py | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/crypto_dev_signer/eth/signer/defaultsigner.py b/crypto_dev_signer/eth/signer/defaultsigner.py @@ -44,6 +44,12 @@ class ReferenceSigner(Signer): #msg = b'\x19Ethereum Signed Message:\n{}{}'.format(len(message), message) k = keys.PrivateKey(self.keyGetter.get(address, password)) #z = keys.ecdsa_sign(message_hash=g, private_key=k) - z = k.sign_msg(message.encode('utf-8')) + z = None + if type(message).__name__ == 'str': + z = k.sign_msg(message.encode('utf-8')) + elif type(message).__name__ == 'bytes': + z = k.sign_msg(message) + else: + raise ValueError('message must be type str or bytes, received {}'.format(type(message).__name__)) return z