summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-21 15:34:16 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-21 15:34:16 -0300
commit1693ace3c984d23c70374bd461660a2bd2ae1a66 (patch)
tree54ae0e3dc45ec380c42f7c1278b78ef40155bfd5 /src/leap
parent42741614d8a68033c0cc28273a3279fc09e22f85 (diff)
parent8eb31d7a05fcdabf0d57ce0183a72818b157e6f4 (diff)
Merge remote-tracking branch 'drebs/feature/3487-split-soledad-into-common-client-and-server' into develop
Conflicts: src/leap/mx/mail_receiver.py
Diffstat (limited to 'src/leap')
-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))