validateOTPBorderWidth function
Validates border width within configured bounds.
Implementation
double validateOTPBorderWidth(
double? width, {
double defaultValue = 1.5,
bool? enableSecurity,
}) {
final shouldValidate = enableSecurity ?? OTPSecurityConfig.enforceValidation;
if (width == null) return defaultValue;
if (!shouldValidate) return width;
if (width < 0) {
if (OTPSecurityConfig.enableSecurityLogging) {
debugPrint('[SAC OTP Security] Border width $width is negative, using 0');
}
return 0;
}
if (width > OTPSecurityConfig.maxBorderWidth) {
if (OTPSecurityConfig.enableSecurityLogging) {
debugPrint(
'[SAC OTP Security] Border width $width above max ${OTPSecurityConfig.maxBorderWidth}',
);
}
return OTPSecurityConfig.maxBorderWidth;
}
return width;
}