From e28ab1b082a9712d38551c6099d6379e70894c61 Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 8 Aug 2020 12:07:39 +0200 Subject: [PATCH 1/4] Add metadata license, url --- CHANGELOG | 3 +++ LICENSE => LICENSE.txt | 0 setup.py | 2 ++ 3 files changed, 5 insertions(+) rename LICENSE => LICENSE.txt (100%) diff --git a/CHANGELOG b/CHANGELOG index e4f4b2e..44931a9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +* 0.1.0 + - Package wrap with setup.py + - Fix hex prefix bug in tx serialization * 0.0.1 - Introduce signer, transaction, keystore packages - Add test for keystore and signer diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/setup.py b/setup.py index efb789d..e6c2038 100644 --- a/setup.py +++ b/setup.py @@ -17,4 +17,6 @@ setup( scripts = [ 'scripts/crypto-dev-daemon', ], + data_files = [('', ['LICENSE.txt'])], + url='https://gitlab.com/nolash/crypto-dev-signer', ) From e685b2ec5303326aab06b61e0591220621822989 Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 8 Aug 2020 12:11:02 +0200 Subject: [PATCH 2/4] update README --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7707859..d299d2e 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,17 @@ This package is written because at the time no good solution seemed to exist for Two scripts are currently available: -### `server.py` +### `crypto-dev-daemon.py` -An Unix socket IPC server implementing the `web3.eth.personal` namespace of the web3 `json-rpc` "standard." +An Unix socket IPC server implementing the following web3 json-rpc methods: + +* web3.eth.personal.newAccount +* web3.eth.personal.signTransaction +* web3.eth.signTransaction ### `web3_middleware.py` -Demonstrates use of the IPC server as middleware for handling calls to the `personal_*` methods. +Demonstrates use of the IPC server as middleware for handling calls to the web3 json-rpc methods provided by the daemon. ### Classes @@ -45,7 +49,9 @@ The classes and packages provided are: ## VERSION -This software is 0.0.1 alpha state and very brittle. +This software is in alpha state and very brittle. + +Current version is 0.1.0 ## LICENSE From a75cf62ff0b4cc011c55847e8ee816f97a644fcb Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 8 Aug 2020 12:27:05 +0200 Subject: [PATCH 3/4] Add feedback on missing secret --- scripts/crypto-dev-daemon | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/crypto-dev-daemon b/scripts/crypto-dev-daemon index 5f79456..73b3ea7 100755 --- a/scripts/crypto-dev-daemon +++ b/scripts/crypto-dev-daemon @@ -20,6 +20,14 @@ signer = None chainId = 8995 +class MissingSecretError(BaseException): + + def __init__(self, message): + super(MissingSecretError, self).__init__(message) + + pass + + def personal_new_account(p): password = p if p.__class__.__name__ != 'str': @@ -134,7 +142,12 @@ def start_server(): def init(): global db, signer - secret_hex = os.environ.get('SIGNER_SECRET') + secret_hex = '' + try: + secret_hex = os.environ['SIGNER_SECRET'] + except KeyError as e: + raise MissingSecretError('please set the SIGNER_SECRET environment variable to a valid hex value') + secret = bytes.fromhex(secret_hex) kw = { 'symmetric_key': secret, From b553341a301249f5c26141b06c7482d95547fc6b Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 8 Aug 2020 14:14:48 +0200 Subject: [PATCH 4/4] Add comments --- crypto_dev_signer/eth/web3ext/middleware.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crypto_dev_signer/eth/web3ext/middleware.py b/crypto_dev_signer/eth/web3ext/middleware.py index a58f3e6..aa47423 100644 --- a/crypto_dev_signer/eth/web3ext/middleware.py +++ b/crypto_dev_signer/eth/web3ext/middleware.py @@ -55,9 +55,9 @@ class PlatformMiddleware: if self.re_personal.match(method) != None: params = PlatformMiddleware._translate_params(suspect_params) - # multiple providers is broken in web3.py 5.12.0 + # multiple providers is removed in web3.py 5.12.0 # https://github.com/ethereum/web3.py/issues/1701 - # hack workaround + # thus we need a workaround to use the same web3 instance s = socket.socket(family=socket.AF_UNIX, type=socket.SOCK_STREAM, proto=0) ipc_provider_workaround = s.connect(self.ipcaddr) @@ -74,6 +74,7 @@ class PlatformMiddleware: #return str(json.dumps(jr)) return jr + # TODO: DRY elif method == 'eth_signTransaction': params = PlatformMiddleware._translate_params(suspect_params) s = socket.socket(family=socket.AF_UNIX, type=socket.SOCK_STREAM, proto=0)