summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/leap/mx/mail_receiver.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/leap/mx/mail_receiver.py b/src/leap/mx/mail_receiver.py
index ff2caa9..77e7cf4 100644
--- a/src/leap/mx/mail_receiver.py
+++ b/src/leap/mx/mail_receiver.py
@@ -32,9 +32,13 @@ from twisted.internet import inotify
from twisted.internet.defer import DeferredList
from twisted.python import filepath, log
-from leap.soledad.document import SoledadDocument
-from leap.soledad.target import EncryptionSchemes
-from leap.soledad_server.couch import CouchDatabase
+from leap.soledad.common.document import SoledadDocument
+from leap.soledad.common.crypto import (
+ EncryptionSchemes,
+ ENC_JSON_KEY,
+ ENC_SCHEME_KEY,
+)
+from leap.soledad.common.couch import CouchDatabase
from leap.keymanager import openpgp
@@ -43,6 +47,8 @@ class MailReceiver(Service):
Service that monitors incoming email and processes it
"""
+ INCOMING_KEY = 'incoming'
+
def __init__(self, mail_couch_url, users_cdb, directories):
"""
Constructor
@@ -119,9 +125,9 @@ class MailReceiver(Service):
if pubkey is None or len(pubkey) == 0:
doc.content = {
- "incoming": True,
- "_enc_scheme": EncryptionSchemes.NONE,
- "_enc_json": json.dumps(data)
+ self.INCOMING_KEY: True,
+ ENC_SCHEME_KEY: EncryptionSchemes.NONE,
+ ENC_JSON_KEY: json.dumps(data)
}
return uuid, doc
@@ -132,9 +138,9 @@ class MailReceiver(Service):
openpgp_key = openpgp._build_key_from_gpg(address, key, pubkey)
doc.content = {
- "incoming": True,
- "_enc_scheme": EncryptionSchemes.PUBKEY,
- "_enc_json": str(gpg.encrypt(
+ self.INCOMING_KEY: True,
+ ENC_SCHEME_KEY: EncryptionSchemes.PUBKEY,
+ ENC_JSON_KEY: str(gpg.encrypt(
json.dumps(data),
openpgp_key.fingerprint,
symmetric=False))