Skip to content

Commit 361c1cc

Browse files
committed
fix: better imports
1 parent 0a48b8b commit 361c1cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fastapi_simple_security/_security_secret.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""Secret dependency.
22
"""
33
import os
4+
import secrets
45
import uuid
56
import warnings
6-
from secrets import compare_digest
77
from typing import Optional
88

99
from fastapi import Security
@@ -71,7 +71,7 @@ async def secret_based_security(header_param: Optional[str] = Security(secret_he
7171
)
7272

7373
# We simply return True if the given secret-key has the right value
74-
if not compare_digest(header_param, secret.value):
74+
if not secrets.compare_digest(header_param, secret.value):
7575
raise HTTPException(
7676
status_code=HTTP_403_FORBIDDEN,
7777
detail="Wrong secret key. If not set through environment variable \

0 commit comments

Comments
 (0)