getAuthHeaders method

Map<String, String> getAuthHeaders({
  1. String? jwtToken,
})

Get authentication headers for API requests Uses native core for secure header generation when possible

Implementation

Map<String, String> getAuthHeaders({String? jwtToken}) {
  // Determine key type based on current API key
  final keyType = _currentApiKey == null ? 'admin' : 'developer';

  // Use JWT token if provided, otherwise fall back to API key
  final authToken = jwtToken ?? _currentApiKey ?? '';

  return {
    'Authorization': 'Bearer $authToken',
    'Content-Type': 'application/json',
    'User-Agent': 'OnairosFlutter/1.0.0',
    'X-SDK-Version': '4.0.6',
    'X-API-Key-Type': keyType,
    'X-Timestamp': DateTime.now().toIso8601String(),
    'X-Environment': _environment ?? 'production',
  };
}