1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
from __future__ import absolute_import
from pixelated.config import credentials
from leap.common.events import server as events_server
import pixelated.bitmask_libraries.certs as certs
from pixelated.bitmask_libraries.session import open_leap_session
def initialize_leap(leap_provider_cert,
leap_provider_cert_fingerprint,
credentials_file,
organization_mode,
leap_home):
init_monkeypatches()
provider, user, password = credentials.read(organization_mode, credentials_file)
init_leap_cert(leap_provider_cert, leap_provider_cert_fingerprint)
events_server.ensure_server(port=8090)
leap_session = create_leap_session(provider, user, password, leap_home)
leap_session.start_background_jobs()
return leap_session
def create_leap_session(provider, username, password, leap_home):
leap_session = open_leap_session(username,
password,
provider,
leap_home)
leap_session.soledad_session.soledad.sync(defer_decryption=False)
leap_session.nicknym.generate_openpgp_key()
return leap_session
def init_leap_cert(leap_provider_cert, leap_provider_cert_fingerprint):
if leap_provider_cert_fingerprint is None:
certs.LEAP_CERT = leap_provider_cert or True
certs.LEAP_FINGERPRINT = None
else:
certs.LEAP_FINGERPRINT = leap_provider_cert_fingerprint
certs.LEAP_CERT = False
def init_monkeypatches():
import pixelated.extensions.protobuf_socket
import pixelated.extensions.sqlcipher_wal
import pixelated.extensions.esmtp_sender_factory
import pixelated.extensions.incoming_decrypt_header
import pixelated.extensions.soledad_sync_exception
import pixelated.extensions.keymanager_fetch_key
import pixelated.extensions.requests_urllib3
import pixelated.extensions.shared_db
|