[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Standardize on calling it pynacl



commit 478be70b817c4e74cb322caf1af4b7501d43c954
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Mon Feb 27 16:20:18 2017 -0800

    Standardize on calling it pynacl
    
    Is it called nacl? PyNaCl? Seems the answer is 'both'. Settling on the name
    folks can google to get the installation instructions.
---
 stem/descriptor/certificate.py       | 8 ++++----
 stem/descriptor/server_descriptor.py | 2 +-
 stem/prereq.py                       | 6 +++---
 test/unit/descriptor/certificate.py  | 4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/stem/descriptor/certificate.py b/stem/descriptor/certificate.py
index c298e99..8904b58 100644
--- a/stem/descriptor/certificate.py
+++ b/stem/descriptor/certificate.py
@@ -157,8 +157,8 @@ class Ed25519KeyCertificate(Certificate):
         raise ValueError('Expired Ed25519KeyCertificate')
 
   def verify_descriptor_signature(self, descriptor, signature):
-    if not stem.prereq._is_nacl_available():
-      raise ValueError('Certificate validation requires the nacl module')
+    if not stem.prereq._is_pynacl_available():
+      raise ValueError('Certificate validation requires the pynacl module')
 
     import nacl.signing
     from nacl.exceptions import BadSignatureError
@@ -177,8 +177,8 @@ class Ed25519KeyCertificate(Certificate):
       raise ValueError('Descriptor Ed25519 certificate signature invalid')
 
   def _verify_signature(self):
-    if not stem.prereq._is_nacl_available():
-      raise ValueError('Certificate validation requires the nacl module')
+    if not stem.prereq._is_pynacl_available():
+      raise ValueError('Certificate validation requires the pynacl module')
 
     import nacl.signing
     from nacl.exceptions import BadSignatureError
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index 84148d2..a695966 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -766,7 +766,7 @@ class RelayDescriptor(ServerDescriptor):
           if onion_key_crosscert_digest != self.onion_key_crosscert_digest():
             raise ValueError('Decrypted onion-key-crosscert digest does not match local digest (calculated: %s, local: %s)' % (onion_key_crosscert_digest, self.onion_key_crosscert_digest()))
 
-      if stem.prereq._is_nacl_available() and self.ed25519_certificate:
+      if stem.prereq._is_pynacl_available() and self.ed25519_certificate:
         self.certificate = _parse_certificate(_bytes_for_block(self.ed25519_certificate), self.ed25519_master_key, validate)
 
         if self.certificate.identity_key != self.ed25519_master_key:
diff --git a/stem/prereq.py b/stem/prereq.py
index 9f265e6..e3d0051 100644
--- a/stem/prereq.py
+++ b/stem/prereq.py
@@ -27,7 +27,7 @@ except ImportError:
   from stem.util.lru_cache import lru_cache
 
 CRYPTO_UNAVAILABLE = "Unable to import the cryptography module. Because of this we'll be unable to verify descriptor signature integrity. You can get cryptography from: https://pypi.python.org/pypi/cryptography";
-NACL_UNAVAILABLE = "Unable to import the pynacl module. Because of this we'll be unable to verify descriptor ed25519 certificate integrity. You can get pynacl from https://github.com/pyca/pynacl/";
+PYNACL_UNAVAILABLE = "Unable to import the pynacl module. Because of this we'll be unable to verify descriptor ed25519 certificate integrity. You can get pynacl from https://pypi.python.org/pypi/PyNaCl/";
 
 
 def check_requirements():
@@ -150,7 +150,7 @@ def is_mock_available():
 
 
 @lru_cache()
-def _is_nacl_available():
+def _is_pynacl_available():
   """
   Checks if the pynacl functions we use are available. This is used for
   verifying ed25519 certificates in relay descriptor signatures.
@@ -165,5 +165,5 @@ def _is_nacl_available():
     from nacl import signing
     return True
   except ImportError:
-    log.log_once('stem.prereq._is_nacl_available', log.INFO, NACL_UNAVAILABLE)
+    log.log_once('stem.prereq._is_pynacl_available', log.INFO, PYNACL_UNAVAILABLE)
     return False
diff --git a/test/unit/descriptor/certificate.py b/test/unit/descriptor/certificate.py
index 160b320..61f6068 100644
--- a/test/unit/descriptor/certificate.py
+++ b/test/unit/descriptor/certificate.py
@@ -87,8 +87,8 @@ class TestCertificate(unittest.TestCase):
      )
 
   def test_certificate_with_invalid_signature(self):
-    if not stem.prereq._is_nacl_available():
-      test.runner.skip(self, '(require nacl module)')
+    if not stem.prereq._is_pynacl_available():
+      test.runner.skip(self, '(require pynacl module)')
       return
 
     import nacl.signing



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits