isCredentialPath function

bool isCredentialPath(
  1. String path
)

Whether path names a credential file.

Pure string classification — no file system access.

Implementation

bool isCredentialPath(String path) {
  if (path.isEmpty) return false;
  final normalized = path.replaceAll('\\', '/').toLowerCase();
  final base = normalized.split('/').last;
  if (base == '.env' || base.startsWith('.env.')) return true;
  if (_credentialBaseNames.contains(base)) return true;
  if (base.endsWith('.pem')) return true;
  return normalized.contains('.aws/credentials') ||
      normalized.contains('.ssh/config') ||
      normalized.contains('.docker/config.json');
}