Newer
Older
# Copyright (c) 2019 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
from briar_wrapper.api_thread import ApiThread
from briar_wrapper.constants import BRIAR_AUTH_TOKEN, BRIAR_DB
from briar_wrapper.models.socket_listener import SocketListener
self._api_thread = ApiThread(self, headless_jar)
def login(self, password, callback):
startup_thread = Thread(target=self._api_thread.login,
args=(password,), daemon=True)
def register(self, credentials, callback):
if len(credentials) != 2:
raise Exception("Can't process credentials")
self._start_and_watch(callback)
startup_thread = Thread(target=self._api_thread.register,
args=(credentials,), daemon=True)
self._api_thread.start()
self._api_thread.watch(callback)
def on_successful_startup(self, callback):
self._load_auth_token()
self.socket_listener = SocketListener(self)
callback(True)
raise Exception("Can't load authentication token")
with open(BRIAR_AUTH_TOKEN, 'r') as file: