mirror of
https://github.com/stardrophere/InsightRadar.git
synced 2026-06-06 03:07:50 +08:00
optimize+注释
This commit is contained in:
@@ -60,7 +60,13 @@ def hash_verification_code(code: str) -> str:
|
||||
|
||||
|
||||
def verify_verification_code(code: str, expected_hash: str) -> bool:
|
||||
return hmac.compare_digest(hash_verification_code(code), expected_hash)
|
||||
try:
|
||||
# compare against string to avoid type issues with hmac.compare_digest
|
||||
code_hash = str(hash_verification_code(code))
|
||||
expected = str(expected_hash)
|
||||
return hmac.compare_digest(code_hash, expected)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
def _urlsafe_b64encode(raw: bytes) -> str:
|
||||
|
||||
Reference in New Issue
Block a user