13 lines
418 B
Python
13 lines
418 B
Python
"""API key auth for Memory System API."""
|
|
from __future__ import annotations
|
|
|
|
from fastapi import Header, HTTPException, status
|
|
|
|
from .config import get_config
|
|
|
|
|
|
def verify_api_key(x_api_key: str | None = Header(default=None)) -> None:
|
|
expected = get_config().server.api_key
|
|
if expected and x_api_key != expected:
|
|
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid API key")
|