]> git.datanom.net - securemail.git/blobdiff - user.py
Make backwards compatible with nacl 1.0.x
[securemail.git] / user.py
diff --git a/user.py b/user.py
index fd3d39724e34770b1a0551a5b8797688789f9619..64673c7c7ce58f5484d271cb7f85c9f5623221c3 100644 (file)
--- a/user.py
+++ b/user.py
@@ -21,7 +21,6 @@ import pickle
 from db import DBInterface as DBI
 from cryptonize import Cryptonize
 from nacl.public import PublicKey
-from nacl import __version__ as NACL_VERSION
 
 class NoSuchUser(Exception):
     pass
@@ -38,13 +37,7 @@ class User:
 
     def store(self, key):
         crypto = Cryptonize()
-        if NACL_VERSION < "1.1.0":
-            from nacl.utils import random
-            from nacl.public import SecretBox
-            nonce = random(SecretBox.NONCE_SIZE)
-            cipher = crypto.symmetric_encrypt(key, pickle.dumps(self), nonce)
-        else:
-            cipher = crypto.symmetric_encrypt(key, pickle.dumps(self))
+        cipher = crypto.symmetric_encrypt(key, pickle.dumps(self))
         DBI.store_user(crypto.generate_hash(key), cipher)
 
     def load(self, key):
This page took 0.034765 seconds and 5 git commands to generate.