validateApiKeyToken function

Future<bool> validateApiKeyToken(
  1. String value
)

Validates the provided API key or token. Returns true if the API key or token is valid, otherwise throws an exception.

Implementation

Future<bool> validateApiKeyToken(String value) async {
  // Ensure alphanumeric and exactly 64 characters
  if (!RegExp(r'^[a-zA-Z0-9]{64}$').hasMatch(value)) {
    throw Exception('Invalid API key or token.');
  }
  return true;
}