summaryrefslogtreecommitdiff
path: root/src/leap/soledad/backends
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-06-03 17:10:15 -0300
committerdrebs <drebs@leap.se>2013-06-05 12:43:06 -0300
commitf4561f3462d8a265f11811d65c4b50db1dd61b45 (patch)
treee2080dfba740eb860b4b079e65a6a63f2d30771b /src/leap/soledad/backends
parent3462abf72b9057855fe7e1b92b12f04bdbd67537 (diff)
Remove strict dependency on leap.common.
* Encapsulate leap_assert and leap_assert_type so Soledad works without them. * Remove dependency on leap.common.files.mkdir_p(). * Encapsulate signaling. * Add changes file.
Diffstat (limited to 'src/leap/soledad/backends')
-rw-r--r--src/leap/soledad/backends/leap_backend.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/leap/soledad/backends/leap_backend.py b/src/leap/soledad/backends/leap_backend.py
index 18c64f97..4d92db37 100644
--- a/src/leap/soledad/backends/leap_backend.py
+++ b/src/leap/soledad/backends/leap_backend.py
@@ -33,11 +33,11 @@ from u1db.errors import BrokenSyncStream
from u1db.remote.http_target import HTTPSyncTarget
+from leap.soledad import soledad_assert
from leap.soledad.crypto import (
EncryptionMethods,
UnknownEncryptionMethod,
)
-from leap.common.check import leap_assert
from leap.soledad.auth import TokenBasedAuth
@@ -165,7 +165,7 @@ def encrypt_doc(crypto, doc):
content.
@rtype: str
"""
- leap_assert(doc.is_tombstone() is False)
+ soledad_assert(doc.is_tombstone() is False)
# encrypt content using AES-256 CTR mode
iv, ciphertext = crypto.encrypt_sym(
doc.get_json(),
@@ -218,12 +218,12 @@ def decrypt_doc(crypto, doc):
@return: The JSON serialization of the decrypted content.
@rtype: str
"""
- leap_assert(doc.is_tombstone() is False)
- leap_assert(ENC_JSON_KEY in doc.content)
- leap_assert(ENC_SCHEME_KEY in doc.content)
- leap_assert(ENC_METHOD_KEY in doc.content)
- leap_assert(MAC_KEY in doc.content)
- leap_assert(MAC_METHOD_KEY in doc.content)
+ soledad_assert(doc.is_tombstone() is False)
+ soledad_assert(ENC_JSON_KEY in doc.content)
+ soledad_assert(ENC_SCHEME_KEY in doc.content)
+ soledad_assert(ENC_METHOD_KEY in doc.content)
+ soledad_assert(MAC_KEY in doc.content)
+ soledad_assert(MAC_METHOD_KEY in doc.content)
# verify MAC
ciphertext = binascii.a2b_hex( # content is stored as hex.
doc.content[ENC_JSON_KEY])
@@ -239,7 +239,7 @@ def decrypt_doc(crypto, doc):
if enc_scheme == EncryptionSchemes.SYMKEY:
enc_method = doc.content[ENC_METHOD_KEY]
if enc_method == EncryptionMethods.AES_256_CTR:
- leap_assert(ENC_IV_KEY in doc.content)
+ soledad_assert(ENC_IV_KEY in doc.content)
plainjson = crypto.decrypt_sym(
ciphertext,
crypto.doc_passphrase(doc.doc_id),