[tor-commits] [stem/master] Fork IntroductionPointV3 class

atagar at torproject.org atagar at torproject.org
Sun Nov 17 23:40:39 UTC 2019


commit f550f7a2b5b2a385b6970e07374b8f2b32f648f8
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Oct 19 12:54:43 2019 -0700

    Fork IntroductionPointV3 class
    
    I'm unsure exactly how we'd care to constitute our IntroductionPointV3 class.
    Likely it will be a hybrid of what we had and the revisions. Simply forking the
    class to start with so I can better understand the operative bits of the new
    variant.
---
 stem/descriptor/hidden_service.py         | 20 ++++++++++++++++++--
 test/unit/descriptor/hidden_service_v3.py |  4 ++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/stem/descriptor/hidden_service.py b/stem/descriptor/hidden_service.py
index 8ecc0eb7..cfa20d09 100644
--- a/stem/descriptor/hidden_service.py
+++ b/stem/descriptor/hidden_service.py
@@ -144,7 +144,23 @@ class IntroductionPoints(collections.namedtuple('IntroductionPoints', INTRODUCTI
   """
 
 
-class IntroductionPointV3(object):
+class IntroductionPointV3(collections.namedtuple('IntroductionPointV3', ['link_specifiers', 'onion_key', 'auth_key', 'enc_key', 'enc_key_cert', 'legacy_key', 'legacy_key_cert'])):
+  """
+  Introduction point for a v3 hidden service.
+
+  .. versionadded:: 1.8.0
+
+  :var list link_specifiers: :class:`~stem.client.datatype.LinkSpecifier` where this service is reachable
+  :var str onion_key: ntor introduction point public key
+  :var str auth_key: cross-certifier of the signing key
+  :var str enc_key: introduction request encryption key
+  :var str enc_key_cert: cross-certifier of the signing key by the encryption key
+  :var str legacy_key: legacy introduction point RSA public key
+  :var str legacy_key_cert: cross-certifier of the signing key by the legacy key
+  """
+
+
+class AlternateIntroductionPointV3(object):
   """
   Introduction point for a v3 hidden service.
 
@@ -459,7 +475,7 @@ def _parse_v3_introduction_points(descriptor, entries):
       legacy_key_cert = entry['legacy-key-cert'][0][2] if 'legacy-key-cert' in entry else None
 
       introduction_points.append(
-        IntroductionPointV3(
+        AlternateIntroductionPointV3(
           link_specifiers = link_specifiers,
           onion_key = onion_key,
           auth_key_cert = auth_key_cert,
diff --git a/test/unit/descriptor/hidden_service_v3.py b/test/unit/descriptor/hidden_service_v3.py
index 3c91a482..7e87668d 100644
--- a/test/unit/descriptor/hidden_service_v3.py
+++ b/test/unit/descriptor/hidden_service_v3.py
@@ -14,7 +14,7 @@ import stem.prereq
 from stem.descriptor.hidden_service import (
   CHECKSUM_CONSTANT,
   REQUIRED_V3_FIELDS,
-  IntroductionPointV3,
+  AlternateIntroductionPointV3,
   HiddenServiceDescriptorV3,
   OuterLayer,
   InnerLayer,
@@ -99,7 +99,7 @@ def _helper_get_intro():
   enc_privkey = X25519PrivateKey.generate()
   enc_pubkey = enc_privkey.public_key()
 
-  return IntroductionPointV3(link_specifiers, onion_key=onion_pubkey, enc_key=enc_pubkey, auth_key=auth_pubkey)
+  return AlternateIntroductionPointV3(link_specifiers, onion_key=onion_pubkey, enc_key=enc_pubkey, auth_key=auth_pubkey)
 
 
 class TestHiddenServiceDescriptorV3(unittest.TestCase):





More information about the tor-commits mailing list