We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a48b8b commit 361c1ccCopy full SHA for 361c1cc
fastapi_simple_security/_security_secret.py
@@ -1,9 +1,9 @@
1
"""Secret dependency.
2
"""
3
import os
4
+import secrets
5
import uuid
6
import warnings
-from secrets import compare_digest
7
from typing import Optional
8
9
from fastapi import Security
@@ -71,7 +71,7 @@ async def secret_based_security(header_param: Optional[str] = Security(secret_he
71
)
72
73
# We simply return True if the given secret-key has the right value
74
- if not compare_digest(header_param, secret.value):
+ if not secrets.compare_digest(header_param, secret.value):
75
raise HTTPException(
76
status_code=HTTP_403_FORBIDDEN,
77
detail="Wrong secret key. If not set through environment variable \
0 commit comments