summary refs log tree commit diff
path: root/synapse/secrets.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/secrets.py')
-rw-r--r--synapse/secrets.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/secrets.py b/synapse/secrets.py
index 5f43f81eb0..ff86950a54 100644
--- a/synapse/secrets.py
+++ b/synapse/secrets.py
@@ -25,8 +25,12 @@ import sys
 if sys.version_info[0:2] >= (3, 6):
     import secrets
 
-    def Secrets():
-        return secrets
+    class Secrets:
+        def token_bytes(self, nbytes=32):
+            return secrets.token_bytes(nbytes)
+
+        def token_hex(self, nbytes=32):
+            return secrets.token_hex(nbytes)
 
 
 else: