pub fn validate_api_key(provided_key: &str) -> Result<(), Status>Expand description
Validates the provided API key against the expected API key from environment.
This function compares the provided API key with the value of the API_KEY
environment variable. It’s used by both gRPC and REST authentication mechanisms.
§Arguments
provided_key- The API key provided by the client
§Returns
Ok(())- If the provided key matches the expected key
§Errors
Returns tonic::Status if:
API_KEYis not set (INTERNAL),- the provided key does not match (
UNAUTHENTICATED).
§Environment Variables
API_KEY- The expected API key value (must be set)