validate
Validates a parsed document and returns its validation failures and warnings.
Reads the field text from document.rawLines and the printed check digits from document.commonFields.checkDigits. Reports MrzExpiryDatePast only when the expiry date is strictly earlier than the reference date, and MrzExpiryDateImplausiblyFar when it is more than 10 years after it. Both compare UTC dates. Reports MrzExpiryDateCenturyNotInferred instead when the expiry parts are digits that form a real date but neither the 2000s nor the 1900s puts the year from 10 years before to 50 years after the reference year, so there is no expiry date to compare. For a TD3 document whose document code starts with P and whose second character is not a letter of the Part 4 table (P, E, D, O, R, T, S, L, M; U is also left out, the designated code for single sheet documents), the filler < included, also reports MrzExpiryDateAfterNonHarmonizedPassportLimit when the computed expiry date is on or after 2038-01-01 (ICAO Doc 9303 Part 4, section 4.4); never when the expiry century is unknown.
If document.rawLines cannot be read as the document's format, no check runs and structuralFailure says why: MrzInvalidLength when the line count or a line length does not fit the format (empty rawLines included), or MrzCharacterSetViolation for the first character outside A-Z, 0-9, and <. A document from MrzParser always passes.
Return
the validation failures and warnings, or the reason rawLines could not be read in structuralFailure.
Parameters
the document to check.
the instant that sets the date checks. Defaults to the current time.
Parses an MRZ string, detecting the format, and returns its validation result.
Runs MrzParser.parse and reports what the parser attached to the result. If the parse fails, structuralFailure holds the parse error and validationFailures and warnings are empty.
Return
the validation failures and warnings, or the parse error in structuralFailure.
Parameters
the MRZ text.
the instant that sets the date checks. Defaults to the current time.
Parses pre-split MRZ lines, detecting the format, and returns their validation result.
Reports the same as validate with a string.
Return
the validation failures and warnings, or the parse error in structuralFailure.
Parameters
the MRZ lines, one element per line.
the instant that sets the date checks. Defaults to the current time.
Parses an MRZ string as the given format and returns its validation result.
Runs the format-specific parser. A line count or line length that does not fit format gives MrzInvalidLength in structuralFailure, not MrzFormatNotDetected.
Return
the validation failures and warnings, or the parse error in structuralFailure.
Parameters
the MRZ text.
the format to read input as.
the instant that sets the date checks. Defaults to the current time.
Parses pre-split MRZ lines as the given format and returns their validation result.
Reports the same as validate with a string and a format.
Return
the validation failures and warnings, or the parse error in structuralFailure.
Parameters
the MRZ lines, one element per line.
the format to read input as.
the instant that sets the date checks. Defaults to the current time.