feat(admin): add api client management UI and backend CRUD/rotate endpoints

This commit is contained in:
Chris
2026-03-30 23:28:27 +08:00
parent 75f9f28588
commit 3fe5ce4ce7
3 changed files with 185 additions and 0 deletions

View File

@@ -13,6 +13,10 @@ from app.models.api_client import ApiClient
pwd_context = CryptContext(schemes=["argon2", "bcrypt"], deprecated="auto")
def hash_api_key(plain_key: str) -> str:
return pwd_context.hash(plain_key)
def _verify_api_key(plain_key: str, stored_hash: str) -> bool:
# Support sha256:<hex> for bootstrap, and bcrypt/argon2 for production.
if stored_hash.startswith("sha256:"):