commit a54627801a6bf82b6cc7c8adc7b10f3817dceee9
parent 6542fd9e2c814e9da2a3ffa3f4ba299945da8aa0
Author: nolash <dev@holbrook.no>
Date: Sat, 19 Sep 2020 14:26:32 +0200
Merge remote-tracking branch 'nolash/master' into lash/table-when-not-exist
Diffstat:
6 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,7 +1,8 @@
* 0.1.1
- Create key table only if not exist
* 0.1.0
- - Add web3 ext middleware capturing signer requests
+ - 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
diff --git 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
diff --git 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)
diff --git 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,
diff --git 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',
)