diff options
author | Kali Kaneko <kali@leap.se> | 2013-08-01 12:37:03 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-08-02 11:31:58 +0200 |
commit | f93a875c8ab29010791ee8e5699fcebf7d821cb4 (patch) | |
tree | 917b54fbb8c8d9b751de5c70f57e2533a13d3efd /soledad | |
parent | cd7c79b41ae0a68029bdf2256c377474549e292d (diff) |
use dbwrapper for sqlcipher
Diffstat (limited to 'soledad')
-rw-r--r-- | soledad/src/leap/soledad/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/soledad/src/leap/soledad/__init__.py b/soledad/src/leap/soledad/__init__.py index cc491096..00ac21f8 100644 --- a/soledad/src/leap/soledad/__init__.py +++ b/soledad/src/leap/soledad/__init__.py @@ -428,7 +428,9 @@ class Soledad(object): secret[salt_start:salt_end], # the salt buflen=32, # we need a key with 256 bits (32 bytes) ) - self._db = sqlcipher_open( + + # Instantiate a thread-safe wrapper + self._db = SQLCipherWrapper( self._local_db_path, binascii.b2a_hex(key), # sqlcipher only accepts the hex version create=True, @@ -442,13 +444,14 @@ class Soledad(object): """ if hasattr(self, '_db') and isinstance( self._db, - SQLCipherDatabase): + SQLCipherWrapper): self._db.close() def __del__(self): """ Make sure local database is closed when object is destroyed. """ + # Watch out! We have no guarantees that this is properly called. self.close() # |