lack of Type Hinting for sign and verify functions, lp:1782596

This commit is contained in:
Thomas Ward
2018-10-27 20:56:05 -04:00
committed by Scott Kitterman
parent a1ca321fa5
commit 4142cd1bd0
+4
View File
@@ -1184,6 +1184,7 @@ def sign(message, selector, domain, privkey, identity=None,
canonicalize=(b'relaxed', b'simple'), canonicalize=(b'relaxed', b'simple'),
signature_algorithm=b'rsa-sha256', signature_algorithm=b'rsa-sha256',
include_headers=None, length=False, logger=None): include_headers=None, length=False, logger=None):
# type: (bytes, bytes, bytes, bytes, bytes, tuple, bytes, list, bool, any) -> bytes
"""Sign an RFC822 message and return the DKIM-Signature header line. """Sign an RFC822 message and return the DKIM-Signature header line.
@param message: an RFC822 formatted message (with either \\n or \\r\\n line endings) @param message: an RFC822 formatted message (with either \\n or \\r\\n line endings)
@param selector: the DKIM selector value for the signature @param selector: the DKIM selector value for the signature
@@ -1209,6 +1210,7 @@ def verify(message, logger=None, dnsfunc=get_txt, minkey=1024):
@param logger: a logger to which debug info will be written (default None) @param logger: a logger to which debug info will be written (default None)
@return: True if signature verifies or False otherwise @return: True if signature verifies or False otherwise
""" """
# type: (bytes, any, function, int) -> bool
d = DKIM(message,logger=logger,minkey=minkey) d = DKIM(message,logger=logger,minkey=minkey)
try: try:
return d.verify(dnsfunc=dnsfunc) return d.verify(dnsfunc=dnsfunc)
@@ -1226,6 +1228,7 @@ def arc_sign(message, selector, domain, privkey,
srv_id, signature_algorithm=b'rsa-sha256', srv_id, signature_algorithm=b'rsa-sha256',
include_headers=None, timestamp=None, include_headers=None, timestamp=None,
logger=None, standardize=False): logger=None, standardize=False):
# type: (bytes, bytes, bytes, bytes, bytes, bytes, list, any, any, bool) -> list
"""Sign an RFC822 message and return the ARC set header lines for the next instance """Sign an RFC822 message and return the ARC set header lines for the next instance
@param message: an RFC822 formatted message (with either \\n or \\r\\n line endings) @param message: an RFC822 formatted message (with either \\n or \\r\\n line endings)
@param selector: the DKIM selector value for the signature @param selector: the DKIM selector value for the signature
@@ -1247,6 +1250,7 @@ def arc_sign(message, selector, domain, privkey,
def arc_verify(message, logger=None, dnsfunc=get_txt, minkey=1024): def arc_verify(message, logger=None, dnsfunc=get_txt, minkey=1024):
# type: (bytes, any, function, int) -> tuple
"""Verify the ARC chain on an RFC822 formatted message. """Verify the ARC chain on an RFC822 formatted message.
@param message: an RFC822 formatted message (with either \\n or \\r\\n line endings) @param message: an RFC822 formatted message (with either \\n or \\r\\n line endings)
@param logger: a logger to which debug info will be written (default None) @param logger: a logger to which debug info will be written (default None)