Adds basic register logic

- Adds register endpoint in the API
- Adds the Gatekeeper to keep track of registered user and allow/reject access
- Adds registration errors
- Updates API unit tests
- Refactors some methods of the API to reduce code replication
This commit is contained in:
Sergi Delgado Segura
2020-03-25 12:14:12 +01:00
parent dd53ad68fb
commit 519caec29a
5 changed files with 113 additions and 26 deletions

View File

@@ -10,6 +10,7 @@ from teos.watcher import Watcher
from teos.tools import bitcoin_cli
from teos.inspector import Inspector
from teos.responder import Responder
from teos.gatekeeper import Gatekeeper
from teos.chain_monitor import ChainMonitor
from test.teos.unit.conftest import (
@@ -55,7 +56,9 @@ def run_api(db_manager, carrier, block_processor):
watcher.awake()
chain_monitor.monitor_chain()
api_thread = Thread(target=API(Inspector(block_processor, config.get("MIN_TO_SELF_DELAY")), watcher).start)
api_thread = Thread(
target=API(Inspector(block_processor, config.get("MIN_TO_SELF_DELAY")), watcher, Gatekeeper()).start
)
api_thread.daemon = True
api_thread.start()