2222 ServiceDiscoveryException ,
2323)
2424from .logging import logger
25- from .uftp import PayloadMessage
25+ from .uftp import PayloadMessage , SignedMessage
2626
2727_context = XmlContext ()
2828serializer = XmlSerializer (context = _context , config = SerializerConfig (indent = " " ))
@@ -76,7 +76,7 @@ def unseal_message(message: bytes, public_key: str) -> PayloadMessage:
7676 raise SchemaException (str (exc )) from exc
7777
7878
79- def to_xml (message : PayloadMessage ) -> str :
79+ def to_xml (message : PayloadMessage | SignedMessage ) -> str :
8080 """
8181 Serialize the given PayloadMessage into an XML string.
8282 """
@@ -174,7 +174,7 @@ def get_keys(domain, role):
174174 )
175175
176176 # Verify that the string is of the expected length (4 + 44 bytes or 4 + 88 bytes)
177- if not len (result ) in (48 , 92 ):
177+ if len (result ) not in (48 , 92 ):
178178 raise AuthenticationTimeoutException (
179179 f"Could not retrieve public key(s) at { dns_name } : "
180180 f"string '{ result } ' was not of appropriate length (48 or 90 characters)"
@@ -190,7 +190,7 @@ def get_keys(domain, role):
190190 ) from exc
191191
192192 # Now verify that the decoded length is 64
193- if not len (combined_keys ) in (32 , 64 ):
193+ if len (combined_keys ) not in (32 , 64 ):
194194 raise AuthenticationTimeoutException (
195195 f"Could not retrieve public keys at { dns_name } : "
196196 f"decoded base64 data should be 32 or 64 bytes long, "
0 commit comments