commit 531119df58f4512afbdb3c71a14b0c40684f641f Author: Damian Johnson atagar@torproject.org Date: Sat Feb 8 13:21:35 2020 -0800
Drop deprecated microdescriptor identifiers
Microdescriptor identifiers can appear multiple times so these attributes were replaced with a hash. --- stem/descriptor/microdescriptor.py | 15 +-------------- test/unit/descriptor/microdescriptor.py | 6 ------ 2 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/stem/descriptor/microdescriptor.py b/stem/descriptor/microdescriptor.py index 17d06d90..f8ee58e8 100644 --- a/stem/descriptor/microdescriptor.py +++ b/stem/descriptor/microdescriptor.py @@ -172,8 +172,6 @@ def _parse_id_line(descriptor, entries): if key_type in identities: raise ValueError("There can only be one 'id' line per a key type, but '%s' appeared multiple times" % key_type)
- descriptor.identifier_type = key_type - descriptor.identifier = key_value identities[key_type] = key_value else: raise ValueError("'id' lines should contain both the key type and digest: id %s" % entry) @@ -206,19 +204,10 @@ class Microdescriptor(Descriptor): (:trac:`11743`) :var dict protocols: mapping of protocols to their supported versions
- :var str identifier: base64 encoded identity digest (**deprecated**, use - identifiers instead) - :var str identifier_type: identity digest key type (**deprecated**, use - identifiers instead) - **\*** attribute is required when we're parsed with validation
- .. versionchanged:: 1.1.0 - Added the identifier and identifier_type attributes. - .. versionchanged:: 1.5.0 - Added the identifiers attribute, and deprecated identifier and - identifier_type since the field can now appear multiple times. + Added the identifiers attribute.
.. versionchanged:: 1.6.0 Added the protocols attribute. @@ -240,8 +229,6 @@ class Microdescriptor(Descriptor): 'family': ([], _parse_family_line), 'exit_policy': (stem.exit_policy.MicroExitPolicy('reject 1-65535'), _parse_p_line), 'exit_policy_v6': (None, _parse_p6_line), - 'identifier_type': (None, _parse_id_line), # deprecated in favor of identifiers - 'identifier': (None, _parse_id_line), # deprecated in favor of identifiers 'identifiers': ({}, _parse_id_line), 'protocols': ({}, _parse_pr_line), } diff --git a/test/unit/descriptor/microdescriptor.py b/test/unit/descriptor/microdescriptor.py index f8e03a12..8d2c07e7 100644 --- a/test/unit/descriptor/microdescriptor.py +++ b/test/unit/descriptor/microdescriptor.py @@ -95,8 +95,6 @@ class TestMicrodescriptor(unittest.TestCase): self.assertEqual(stem.exit_policy.MicroExitPolicy('reject 1-65535'), desc.exit_policy) self.assertEqual(None, desc.exit_policy_v6) self.assertEqual({}, desc.identifiers) - self.assertEqual(None, desc.identifier_type) - self.assertEqual(None, desc.identifier) self.assertEqual({}, desc.protocols) self.assertEqual([], desc.get_unrecognized_lines())
@@ -184,8 +182,6 @@ class TestMicrodescriptor(unittest.TestCase):
desc = Microdescriptor.create({'id': 'rsa1024 Cd47okjCHD83YGzThGBDptXs9Z4'}) self.assertEqual({'rsa1024': 'Cd47okjCHD83YGzThGBDptXs9Z4'}, desc.identifiers) - self.assertEqual('rsa1024', desc.identifier_type) - self.assertEqual('Cd47okjCHD83YGzThGBDptXs9Z4', desc.identifier)
# check when there's multiple key types
@@ -197,8 +193,6 @@ class TestMicrodescriptor(unittest.TestCase):
desc = Microdescriptor(desc_text, validate = True) self.assertEqual({'rsa1024': 'Cd47okjCHD83YGzThGBDptXs9Z4', 'ed25519': '50f6ddbecdc848dcc6b818b14d1'}, desc.identifiers) - self.assertEqual('ed25519', desc.identifier_type) - self.assertEqual('50f6ddbecdc848dcc6b818b14d1', desc.identifier)
# check when there's conflicting keys
tor-commits@lists.torproject.org