diff options
author | drebs <drebs@leap.se> | 2012-12-13 13:29:17 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2012-12-13 13:29:17 -0200 |
commit | 19ee861b5c5dca236800ffcb944b4299561d841d (patch) | |
tree | a5320e3e81748e7ba2e7e794bf6fe8f7989d23d7 /src | |
parent | a14d5ae150c52c3419764443409b7d146c43cb09 (diff) |
Change name of cyphertext field to something more meaningful.
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/soledad/backends/leap.py | 6 | ||||
-rw-r--r-- | src/leap/soledad/tests/test_couch.py (renamed from src/leap/soledad/tests/test_couchdb.py) | 0 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/leap/soledad/backends/leap.py b/src/leap/soledad/backends/leap.py index ce00c8f3..c113f5c2 100644 --- a/src/leap/soledad/backends/leap.py +++ b/src/leap/soledad/backends/leap.py @@ -43,13 +43,13 @@ class LeapDocument(Document): self._default_key, always_trust = True) # TODO: always trust? - return json.dumps({'cyphertext' : str(cyphertext)}) + return json.dumps({'_encrypted_json' : str(cyphertext)}) def set_encrypted_json(self, encrypted_json): """ Set document's content based on encrypted version of json string. """ - cyphertext = json.loads(encrypted_json)['cyphertext'] + cyphertext = json.loads(encrypted_json)['_encrypted_json'] plaintext = str(self._gpg.decrypt(cyphertext)) return self.set_json(plaintext) @@ -97,6 +97,7 @@ class LeapSyncTarget(HTTPSyncTarget): raise BrokenSyncStream line, comma = utils.check_and_strip_comma(entry) entry = json.loads(line) + # decrypt after receiving from server. doc = LeapDocument(entry['id'], entry['rev'], encrypted_json=entry['content']) return_doc_cb(doc, entry['gen'], entry['trans_id']) @@ -142,6 +143,7 @@ class LeapSyncTarget(HTTPSyncTarget): ensure=ensure_callback is not None) comma = ',' for doc, gen, trans_id in docs_by_generations: + # encrypt before sending to server. size += prepare(id=doc.doc_id, rev=doc.rev, content=doc.get_encrypted_json(), gen=gen, trans_id=trans_id) diff --git a/src/leap/soledad/tests/test_couchdb.py b/src/leap/soledad/tests/test_couch.py index 4468ae04..4468ae04 100644 --- a/src/leap/soledad/tests/test_couchdb.py +++ b/src/leap/soledad/tests/test_couch.py |