diff options
author | drebs <drebs@leap.se> | 2013-08-19 09:28:15 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-08-19 09:41:28 -0300 |
commit | 8eb31d7a05fcdabf0d57ce0183a72818b157e6f4 (patch) | |
tree | 22417798b976be6b9f5b8a195147ebd159ac7ffb /src/leap/mx/mail_receiver.py | |
parent | 5ae019af6e29697dd43700c614e06298d719ff96 (diff) |
Update to new soledad package scheme.
Diffstat (limited to 'src/leap/mx/mail_receiver.py')
-rw-r--r-- | src/leap/mx/mail_receiver.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/leap/mx/mail_receiver.py b/src/leap/mx/mail_receiver.py index a830fa1..b5852ba 100644 --- a/src/leap/mx/mail_receiver.py +++ b/src/leap/mx/mail_receiver.py @@ -31,9 +31,13 @@ from twisted.application.service import Service from twisted.internet import inotify 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 @@ -42,6 +46,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 @@ -116,9 +122,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 @@ -129,9 +135,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)) |