From 9d120dcd2cff137c6421d87c1679446546c07b79 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 24 Feb 2020 11:46:37 +0000 Subject: [PATCH] fix security.py typehints --- src/utils/security.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/security.py b/src/utils/security.py index 14f92aa0..ae1da81c 100644 --- a/src/utils/security.py +++ b/src/utils/security.py @@ -26,9 +26,9 @@ def constant_time_compare(a: typing.AnyStr, b: typing.AnyStr) -> bool: return hmac.compare_digest(a, b) import scrypt -def password(byte_n: int=32): +def password(byte_n: int=32) -> str: return binascii.hexlify(os.urandom(byte_n)).decode("utf8") -def salt(byte_n: int=64) -> bytes: +def salt(byte_n: int=64) -> str: return base64.b64encode(os.urandom(byte_n)).decode("utf8") def hash(given_salt: str, data: str): return base64.b64encode(scrypt.hash(data, given_salt)).decode("utf8")