Change arg types of constant_time_compare to typing.AnyStr (utils.security)

This commit is contained in:
jesopo 2019-02-12 11:59:55 +00:00
parent ce23442f4b
commit 01a7c05687

View file

@ -22,7 +22,5 @@ def ssl_wrap(sock: socket.socket, cert: str=None, key: str=None,
return context.wrap_socket(sock, server_side=server_side, return context.wrap_socket(sock, server_side=server_side,
server_hostname=hostname) server_hostname=hostname)
def constant_time_compare( def constant_time_compare(a: typing.AnyStr, b: typing.AnyStr) -> bool:
a: typing.Union[str, bytes],
b: typing.Union[str, bytes]) -> bool:
return hmac.compare_digest(a, b) return hmac.compare_digest(a, b)