MrzValidator

Checks a parsed MRZ for check digit, date, and sex observations and returns them.

Reports MrzCheckDigitMismatch, MrzDateNotInCalendar, and MrzInvalidSexValue as validation failures. Reports MrzExpiryDatePast, MrzExpiryDateImplausiblyFar, MrzExpiryDateCenturyNotInferred, MrzExpiryDateAfterNonHarmonizedPassportLimit, MrzNameTruncated, MrzUnknownCountryCode, MrzUnknownDocumentTypeCode, MrzSexCharacterX, and MrzPersonalNumberCheckDigitFiller as warnings. Visa formats have no composite check digit and no optional-data check digit.

Every validate result also carries ValidationResult.checks: one MrzCheckRecord per check in MrzCheck order, so a consumer can tell which checks ran and passed from the ones that failed or did not apply. The failures and warnings are unchanged by that list.

Since

0.1.0

Functions

Link copied to clipboard
fun validate(document: MrzDocument, referenceTime: Instant = Clock.System.now()): ValidationResult

Validates a parsed document and returns its validation failures and warnings.

fun validate(input: String, referenceTime: Instant = Clock.System.now()): ValidationResult

Parses an MRZ string, detecting the format, and returns its validation result.

fun validate(@ObjCName(name = "lines") input: List<String>, referenceTime: Instant = Clock.System.now()): ValidationResult

Parses pre-split MRZ lines, detecting the format, and returns their validation result.

fun validate(input: String, format: MrzFormat, referenceTime: Instant = Clock.System.now()): ValidationResult

Parses an MRZ string as the given format and returns its validation result.

fun validate(@ObjCName(name = "lines") input: List<String>, format: MrzFormat, referenceTime: Instant = Clock.System.now()): ValidationResult

Parses pre-split MRZ lines as the given format and returns their validation result.