maskCpf static method
Masks a CPF for logging, keeping only the middle digits
(***.456.789-**), as expected by the Brazilian data protection law.
Returns an empty string when cpf does not hold 11 digits, so a malformed
value never leaks in full through a log line.
Implementation
static String maskCpf(String? cpf) {
final digits = _digitsOnly(cpf);
if (digits == null || digits.length != 11) return '';
return '***.${digits.substring(3, 6)}.${digits.substring(6, 9)}-**';
}