Updated filtering rules. Fixes #18.

This commit is contained in:
Mark Qvist 2022-03-15 14:55:47 +01:00
parent 550dfd44cb
commit 3051b6897d
2 changed files with 33 additions and 3 deletions

View file

@ -118,6 +118,9 @@ class Destination:
identity = RNS.Identity()
aspects = aspects+(identity.hexhash,)
if identity != None and self.type == Destination.PLAIN:
raise TypeError("Selected destination type PLAIN cannot hold an identity")
self.identity = identity
self.name = Destination.full_name(app_name, *aspects)
@ -146,6 +149,9 @@ class Destination:
:param app_data: *bytes* containing the app_data.
:param path_response: Internal flag used by :ref:`RNS.Transport<api-transport>`. Ignore.
"""
if self.type != Destination.SINGLE:
raise TypeError("Only SINGLE destination types can be announced")
destination_hash = self.hash
random_hash = RNS.Identity.get_random_hash()[0:5]+int(time.time()).to_bytes(5, "big")