validateOTPSpacing function
Validates spacing between pins.
Implementation
double validateOTPSpacing(
double? spacing, {
required double defaultValue,
bool? enableSecurity,
}) {
final shouldValidate = enableSecurity ?? OTPSecurityConfig.enforceValidation;
if (spacing == null) return defaultValue;
if (!shouldValidate) return spacing;
if (spacing < 0) {
if (OTPSecurityConfig.enableSecurityLogging) {
debugPrint('[SAC OTP Security] Spacing $spacing is negative, using 0');
}
return 0;
}
if (spacing > OTPSecurityConfig.maxSpacing) {
if (OTPSecurityConfig.enableSecurityLogging) {
debugPrint(
'[SAC OTP Security] Spacing $spacing above max ${OTPSecurityConfig.maxSpacing}',
);
}
return OTPSecurityConfig.maxSpacing;
}
return spacing;
}