fix(api-clients): fallback api-key hashing without argon2; show site/module parent display names

This commit is contained in:
Chris
2026-03-31 20:35:04 +08:00
parent 3fe5ce4ce7
commit 556fc8d5cb

View File

@@ -14,7 +14,11 @@ pwd_context = CryptContext(schemes=["argon2", "bcrypt"], deprecated="auto")
def hash_api_key(plain_key: str) -> str:
try:
return pwd_context.hash(plain_key)
except Exception:
# Fallback for environments missing argon2 backend.
return f"sha256:{hashlib.sha256(plain_key.encode('utf-8')).hexdigest()}"
def _verify_api_key(plain_key: str, stored_hash: str) -> bool: