mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
compressed_pk -> user_id and logs id on bootstrap
This commit is contained in:
@@ -47,18 +47,18 @@ class WTClient:
|
|||||||
@plugin.init()
|
@plugin.init()
|
||||||
def init(options, configuration, plugin):
|
def init(options, configuration, plugin):
|
||||||
try:
|
try:
|
||||||
|
user_sk, user_id = generate_keys(DATA_DIR)
|
||||||
plugin.log("Generating a new key pair for the watchtower client. Keys stored at {}".format(DATA_DIR))
|
plugin.log("Generating a new key pair for the watchtower client. Keys stored at {}".format(DATA_DIR))
|
||||||
cli_sk, compressed_cli_pk = generate_keys(DATA_DIR)
|
|
||||||
|
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
plugin.log("A key file for the watchtower client already exists. Loading it")
|
plugin.log("A key file for the watchtower client already exists. Loading it")
|
||||||
cli_sk, compressed_cli_pk = load_keys(DATA_DIR)
|
user_sk, user_id = load_keys(DATA_DIR)
|
||||||
|
|
||||||
plugin.log("Plugin watchtower client initialized")
|
plugin.log("Plugin watchtower client initialized. User id = {}".format(user_id))
|
||||||
config_loader = ConfigLoader(DATA_DIR, CONF_FILE_NAME, DEFAULT_CONF, {})
|
config_loader = ConfigLoader(DATA_DIR, CONF_FILE_NAME, DEFAULT_CONF, {})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
plugin.wt_client = WTClient(cli_sk, compressed_cli_pk, config_loader.build_config())
|
plugin.wt_client = WTClient(user_sk, user_id, config_loader.build_config())
|
||||||
except plyvel.IOError:
|
except plyvel.IOError:
|
||||||
plugin.log("Cannot load towers db. Resource temporarily unavailable")
|
plugin.log("Cannot load towers db. Resource temporarily unavailable")
|
||||||
# TODO: Check how to make the plugin stop
|
# TODO: Check how to make the plugin stop
|
||||||
|
|||||||
Reference in New Issue
Block a user