isSensitiveKey static method

bool isSensitiveKey(
  1. String key
)

判断字段名是否为敏感字段(大小写、下划线、短横线不敏感)

Implementation

static bool isSensitiveKey(String key) {
  final normalized = _normalize(key);
  if (_sensitiveKeys.contains(normalized)) {
    return true;
  }
  return normalized.endsWith('token') ||
      normalized.endsWith('secret') ||
      normalized.endsWith('password') ||
      normalized.endsWith('apikey') ||
      normalized.endsWith('credential') ||
      normalized.endsWith('auth') ||
      normalized.endsWith('email') ||
      normalized.endsWith('phone') ||
      normalized.endsWith('phonenumber') ||
      normalized.endsWith('mobile') ||
      normalized.endsWith('mobilenumber') ||
      normalized.endsWith('idcard') ||
      normalized.endsWith('idnumber');
}