diff options
Diffstat (limited to '')
-rw-r--r-- | synapse/secrets.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/secrets.py b/synapse/secrets.py index fb6d90a3b7..7939db75e7 100644 --- a/synapse/secrets.py +++ b/synapse/secrets.py @@ -26,10 +26,10 @@ if sys.version_info[0:2] >= (3, 6): import secrets class Secrets: - def token_bytes(self, nbytes=32): + def token_bytes(self, nbytes: int = 32) -> bytes: return secrets.token_bytes(nbytes) - def token_hex(self, nbytes=32): + def token_hex(self, nbytes: int = 32) -> str: return secrets.token_hex(nbytes) @@ -38,8 +38,8 @@ else: import os class Secrets: - def token_bytes(self, nbytes=32): + def token_bytes(self, nbytes: int = 32) -> bytes: return os.urandom(nbytes) - def token_hex(self, nbytes=32): + def token_hex(self, nbytes: int = 32) -> str: return binascii.hexlify(self.token_bytes(nbytes)).decode("ascii") |