From 8eb31d7a05fcdabf0d57ce0183a72818b157e6f4 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 19 Aug 2013 09:28:15 -0300 Subject: Update to new soledad package scheme. --- ...487-split-soledad-into-common-client-and-server | 2 ++ pkg/requirements.pip | 10 +-------- src/leap/mx/mail_receiver.py | 24 ++++++++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 changes/feature_3487-split-soledad-into-common-client-and-server diff --git a/changes/feature_3487-split-soledad-into-common-client-and-server b/changes/feature_3487-split-soledad-into-common-client-and-server new file mode 100644 index 0000000..4698323 --- /dev/null +++ b/changes/feature_3487-split-soledad-into-common-client-and-server @@ -0,0 +1,2 @@ + o Update to new soledad package scheme (common, client and server). Closes + #3487. diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 7ec489d..ea59aaa 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -2,13 +2,5 @@ Twisted>=12.0.2 paisley>=0.3.1 ## XXX change me to whatever you name the package in pypi python-gnupg>=0.3.0 -leap.soledad -leap.soledad_server +leap.soledad.common>=0.3.0 leap.keymanager>=0.2.0 - -############### -# Development # -############### - -#leap.soledad # make this a dep as soon as it is installable from pypi !! --e git://github.com/andrejb/soledad.git@develop#egg=leap.soledad 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)) -- cgit v1.2.3