summary refs log tree commit diff
path: root/synapse/secrets.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-03-24 06:49:01 -0400
committerGitHub <noreply@github.com>2021-03-24 06:49:01 -0400
commitaf387cf52ac4641e7d5ade75d3483b0c41d05ebf (patch)
treed384b1fc0bfa9932fed7cbebfa184e4087982986 /synapse/secrets.py
parentAdd a type hints for service notices to the HomeServer object. (#9675) (diff)
downloadsynapse-af387cf52ac4641e7d5ade75d3483b0c41d05ebf.tar.xz
Add type hints to misc. files. (#9676)
Diffstat (limited to 'synapse/secrets.py')
-rw-r--r--synapse/secrets.py8
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")