validate
Validates an Aadhaar Virtual ID.
Input normalisation applied before validation (in order):
Trim leading/trailing whitespace
Strip all internal whitespace (covers spaced
"2345 6789 0123 4561"form)
After normalisation, checks are applied in this order — first failing check wins:
InvalidReason.EMPTY if the result is blank
InvalidReason.WRONG_LENGTH if length is not 16
InvalidReason.INVALID_FORMAT if any non-digit character remains
InvalidReason.INVALID_PREFIX if the first digit is 0 or 1
InvalidReason.INVALID_CHECKSUM if the Verhoeff checksum fails
Return
ValidationResult.Valid if the VID passes all checks, ValidationResult.Invalid with an appropriate InvalidReason otherwise. Never throws.
Parameters
value
Raw VID string in any common input form.
Samples
check(
AadhaarVID.validate("2345678901240000") is ValidationResult.Valid ||
AadhaarVID.validate("2345678901240000") is ValidationResult.Invalid,
)Content copied to clipboard