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

[tor-commits] [stem/master] Don't require additional arguments to make descriptor



commit fd583b244665f7c0b11c7284cab5b68b69b28fe8
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Oct 12 13:04:00 2019 -0700

    Don't require additional arguments to make descriptor
    
    These additional requirements broke an existing test. Not quite sure what
    we'll do for this long term, but for the moment simply reverting to our
    prior behavior so the test passes...
    
            ======================================================================
            ERROR: test_invalid_lifetime
            ----------------------------------------------------------------------
            Traceback (most recent call last):
            File "/home/atagar/Desktop/stem/test/unit/descriptor/hidden_service_v3.py", line 191, in test_invalid_lifetime
            expect_invalid_attr(self, {'descriptor-lifetime': test_value}, 'lifetime')
            File "/home/atagar/Desktop/stem/test/unit/descriptor/__init__.py", line 41, in base_expect_invalid_attr
            return base_expect_invalid_attr_for_text(cls, default_attr, default_value, test, cls.content(desc_attrs), attr, expected_value)
            File "/home/atagar/Desktop/stem/stem/descriptor/hidden_service.py", line 978, in content
              raise ValueError('Need to provide a private ed25519 identity key to create a descriptor')
            ValueError: Need to provide a private ed25519 identity key to create a descriptor
---
 stem/descriptor/hidden_service.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/stem/descriptor/hidden_service.py b/stem/descriptor/hidden_service.py
index b6116358..ba21c360 100644
--- a/stem/descriptor/hidden_service.py
+++ b/stem/descriptor/hidden_service.py
@@ -969,6 +969,20 @@ class HiddenServiceDescriptorV3(BaseHiddenServiceDescriptor):
     if sign:
       raise NotImplementedError('Signing of %s not implemented' % cls.__name__)
 
+    # TODO: When these additional arguments are not present simply constructing
+    # a descriptor that looks reasonable. This might not be the fallback we use
+    # later on.
+
+    if not ed25519_private_identity_key or not intro_points or not blinding_param:
+      return _descriptor_content(attr, exclude, (
+        ('hs-descriptor', '3'),
+        ('descriptor-lifetime', '180'),
+        ('descriptor-signing-key-cert', _random_crypto_blob('ED25519 CERT')),
+        ('revision-counter', '15'),
+        ('superencrypted', _random_crypto_blob('MESSAGE')),
+        ('signature', 'wdc7ffr+dPZJ/mIQ1l4WYqNABcmsm6SHW/NL3M3wG7bjjqOJWoPR5TimUXxH52n5Zk0Gc7hl/hz3YYmAx5MvAg'),
+      ), ())
+
     # We need an private identity key for the onion service to create its
     # descriptor. We could make a new one on the spot, but we also need to
     # return it to the caller, otherwise the caller will have no way to decode



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