rehabilitate socket server

This commit is contained in:
nolash 2021-10-15 22:40:22 +02:00
parent 7f113d1cdc
commit 760ff71632
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
8 changed files with 17 additions and 14 deletions

View File

@ -1 +1 @@
include *requirements*
include *requirements* funga/eth/data/config/**

0
README Normal file
View File

View File

@ -5,7 +5,7 @@ import socket
import stat
# local imports
from crypto_dev_signer.error import SignerError
from funga.error import SignerError
from .handle import SignRequestHandler
logg = logging.getLogger(__name__)

View File

@ -140,7 +140,6 @@ def from_dict(o, passphrase=''):
pk = m(ciphertext_bytes, decryption_key[:16], iv)
except AssertionError as e:
raise DecryptError('could not decrypt keyfile: {}'.format(e))
logg.debug('bar')
return pk

View File

@ -12,14 +12,16 @@ import confini
from jsonrpc.exceptions import *
# local imports
from crypto_dev_signer.eth.signer import ReferenceSigner
from crypto_dev_signer.keystore.reference import ReferenceKeystore
from crypto_dev_signer.cli.handle import SignRequestHandler
from funga.eth.signer import EIP155Signer
from funga.eth.keystore.sql import SQLKeystore
from funga.eth.cli.handle import SignRequestHandler
logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger()
config_dir = '.'
script_dir = os.path.dirname(os.path.realpath(__file__))
data_dir = os.path.join(script_dir, '..', 'data')
config_dir = os.path.join(data_dir, 'config')
db = None
signer = None
@ -27,6 +29,7 @@ session = None
chainId = 8995
socket_path = '/run/crypto-dev-signer/jsonrpc.ipc'
argparser = argparse.ArgumentParser()
argparser.add_argument('-c', type=str, default=config_dir, help='config file')
argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration')
@ -85,8 +88,8 @@ def main():
kw = {
'symmetric_key': secret,
}
SignRequestHandler.keystore = ReferenceKeystore(dsn, **kw)
SignRequestHandler.signer = ReferenceSigner(SignRequestHandler.keystore)
SignRequestHandler.keystore = SQLKeystore(dsn, **kw)
SignRequestHandler.signer = EIP155Signer(SignRequestHandler.keystore)
arg = None
try:
@ -97,19 +100,19 @@ def main():
if socket_url.scheme != '':
scheme = socket_url.scheme
if re.match(re_tcp, socket_url.scheme):
from crypto_dev_signer.cli.socket import start_server_tcp
from funga.eth.cli.socket import start_server_tcp
socket_spec = socket_url.netloc.split(':')
host = socket_spec[0]
port = int(socket_spec[1])
start_server_tcp((host, port))
elif re.match(re_http, socket_url.scheme):
from crypto_dev_signer.cli.http import start_server_http
from funga.eth.cli.http import start_server_http
socket_spec = socket_url.netloc.split(':')
host = socket_spec[0]
port = int(socket_spec[1])
start_server_http((host, port))
else:
from crypto_dev_signer.cli.socket import start_server_unix
from funga.eth.cli.socket import start_server_unix
start_server_unix(socket_url.path)
sys.exit(0)

View File

@ -1,6 +1,6 @@
from setuptools import setup
f = open('README.md', 'r')
f = open('README', 'r')
long_description = f.read()
f.close()
@ -33,7 +33,7 @@ f.close()
setup(
name="funga-eth",
version="0.5.1a1",
version="0.5.1a2",
description="Ethereum implementation of the funga keystore and signer",
author="Louis Holbrook",
author_email="dev@holbrook.no",
@ -58,4 +58,5 @@ setup(
],
},
url='https://gitlab.com/chaintool/funga-eth',
include_package_data=True,
)