Documentation
¶
Overview ¶
Package valid holds the shared input-validation rules for F5 coefficients and passwords. It deliberately returns booleans and a Reason enum rather than errors: the rule is shared, but each capability presents failures in its own way (the extract package wraps sentinel errors for errors.Is, the embed package reports plain localized messages). Keeping the rule here and the presentation in each package avoids re-coupling the two.
The package depends only on f5core, so importing it pulls in no localization tables, logger, or JPEG codec.
Index ¶
Constants ¶
const ( // CoefficientMin is the minimum valid quantized DCT coefficient value. CoefficientMin = f5core.CoefficientMin // CoefficientMax is the maximum valid quantized DCT coefficient value. CoefficientMax = f5core.CoefficientMax )
Coefficient bounds, re-exported from f5core so callers validating against the JPEG quantized DCT range need not import f5core directly.
Variables ¶
This section is empty.
Functions ¶
func CoefficientsValid ¶
CoefficientsValid reports whether coefficients is non-empty and every value is within [CoefficientMin, CoefficientMax].
func PasswordValid ¶
PasswordValid reports whether password is usable for PRNG seeding, i.e. it is non-empty.
Types ¶
type Reason ¶
type Reason int
Reason classifies why a coefficient slice failed validation. It is an enum so callers can switch over it exhaustively and map each case to their own error type and localized message.
func FirstInvalidReason ¶
FirstInvalidReason reports the first validation problem with coefficients, or OK if the slice is valid. It returns on the first out-of-range value so the common valid case still scans the whole slice exactly once.