def mask_secret(value: str) -> str: if not value: return "" return "*" * max(4, len(value) - 4) + value[-4:]