diff --git a/crypto_dev_signer/encoding.py b/crypto_dev_signer/encoding.py index 58ab353..4166f03 100644 --- a/crypto_dev_signer/encoding.py +++ b/crypto_dev_signer/encoding.py @@ -12,10 +12,7 @@ from hexathon import ( logg = logging.getLogger(__name__) -def private_key_to_address(pk, result_format='hex'): - pubk = coincurve.PublicKey.from_secret(pk.secret) - logg.debug('secret {} '.format(pk.secret.hex())) - pubk_bytes = pubk.format(compressed=False) +def public_key_bytes_to_address(pubk_bytes, result_format='hex'): h = sha3.keccak_256() logg.debug('public key bytes {}'.format(pubk_bytes.hex())) h.update(pubk_bytes[1:]) @@ -27,6 +24,17 @@ def private_key_to_address(pk, result_format='hex'): raise ValueError('invalid result format "{}"'.format(result_format)) +def public_key_to_address(pubk, result_format='hex'): + pubk_bytes = pubk.format(compressed=False) + return public_key_bytes_to_address(pubk_bytes, result_format='hex') + + +def private_key_to_address(pk, result_format='hex'): + pubk = coincurve.PublicKey.from_secret(pk.secret) + logg.debug('secret {} '.format(pk.secret.hex())) + return public_key_to_address(pubk, result_format) + + def is_address(address_hex): try: address_hex = strip_0x(address_hex) diff --git a/crypto_dev_signer/keystore/postgres.py b/crypto_dev_signer/keystore/reference.py similarity index 100% rename from crypto_dev_signer/keystore/postgres.py rename to crypto_dev_signer/keystore/reference.py diff --git a/crypto_dev_signer/runnable/signer.py b/crypto_dev_signer/runnable/signer.py index 5bb0d29..d62cfd2 100755 --- a/crypto_dev_signer/runnable/signer.py +++ b/crypto_dev_signer/runnable/signer.py @@ -16,7 +16,7 @@ from jsonrpc.exceptions import * # local imports from crypto_dev_signer.eth.signer import ReferenceSigner from crypto_dev_signer.eth.transaction import EIP155Transaction -from crypto_dev_signer.keystore import ReferenceKeystore +from crypto_dev_signer.keystore.reference import ReferenceKeystore from crypto_dev_signer.error import UnknownAccountError logging.basicConfig(level=logging.WARNING) diff --git a/requirements.txt b/requirements.txt index fe01b7f..6a7153f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,4 @@ confini~=0.3.6a3 sqlalchemy==1.3.20 coincurve==15.0.0 pycrypto==2.6.1 -hexathon==0.0.1a4 +hexathon~=0.0.1a5 diff --git a/setup.py b/setup.py index 7e4a0b8..fec41da 100644 --- a/setup.py +++ b/setup.py @@ -24,18 +24,18 @@ f.close() setup( name="crypto-dev-signer", - version="0.4.14a4", + version="0.4.14a8", description="A signer and keystore daemon and library for cryptocurrency software development", author="Louis Holbrook", author_email="dev@holbrook.no", packages=[ 'crypto_dev_signer.eth.signer', - 'crypto_dev_signer.eth.web3ext', - 'crypto_dev_signer.eth.helper', + #'crypto_dev_signer.eth.web3ext', + #'crypto_dev_signer.eth.helper', 'crypto_dev_signer.eth', 'crypto_dev_signer.keystore', 'crypto_dev_signer.runnable', - 'crypto_dev_signer.helper', + #'crypto_dev_signer.helper', 'crypto_dev_signer', ], install_requires=requirements,