@microblink/blinkid-react-native
Version:
A small and powerful ID card scanning library. Powered by Microblink (www.microblink.com).
2,057 lines (1,815 loc) • 93.7 kB
text/typescript
/**
* Settings for the barcode extraction module.
*
* This module manages the detection and data extraction from various 1D and 2D
* barcode formats (such as PDF417, QR codes, and various retail codes).
*
* It can operate as a standalone module or in combination with document capture.
*/
export type BarcodeModuleSettings = {
/*
* If set to true, barcode presence becomes mandatory for the scanned document.
* For [ScanningMode.single], the barcode must be present on the scanned side.
* For [ScanningMode.automatic], the barcode must be present on one of the scanned sides.
*
* In case of a timeout and advancement to the next step in the scanning flow,
* if a barcode is detected on the scanned side but cannot be extracted,
* the presence requirement is considered fulfilled. As a result, barcode extraction
* will no longer be a requirement to complete the scan on next side.
*/
presenceMandatory: boolean;
/*
* Indicates whether the barcode image should be returned in the result.
*
* The DPI setting and the extension factor do not affect returned barcode image.
*/
barcodeImageReturnEnabled: boolean;
/*
* Enables the scanning and processing of Pdf417 barcodes.
*
* The current analyzer model flags a barcode as "present" if either a `PDF417` or a `QR` code is detected.
* Because the model does not distinguish between the two types at this stage, a conflict can occur:
* if `PDF417` is enabled but `QR` is disabled, the analyzer may trigger for a `QR` code, causing the process to hang.
* To prevent this, `pdf417ScanningEnabled` and `qrScanningEnabled` must be enabled together.
*/
pdf417ScanningEnabled: boolean;
/*
* Enables the scanning and processing of QR barcodes.
*
* The current analyzer model flags a barcode as "present" if either a `PDF417` or a `QR` code is detected.
* Because the model does not distinguish between the two types at this stage, a conflict can occur:
* if `PDF417` is enabled but `QR` is disabled, the analyzer may trigger for a `QR` code, causing the process to hang.
*
* To prevent this, `qrScanningEnabled` and `pdf417ScanningEnabled` must be enabled together.
*/
qrScanningEnabled: boolean;
/*
* Enables the scanning and processing of UPC-E barcodes.
*
* This setting can be enabled only if `documentCaptureEnabled` is disabled.
*/
upceScanningEnabled: boolean;
/*
* Enables the scanning and processing of UPC-A barcodes.
*
* This setting can be enabled only if `documentCaptureEnabled` is disabled.
*/
upcaScanningEnabled: boolean;
/*
* Enables the scanning and processing of Code-128 barcodes.
*
* This setting can be enabled only if `documentCaptureEnabled` is disabled.
*/
code128ScanningEnabled: boolean;
/*
* Enables the scanning and processing of Code-39 barcodes.
*
* This setting can be enabled only if `documentCaptureEnabled` is disabled.
*/
code39ScanningEnabled: boolean;
/*
* Enables the scanning and processing of EAN-8 barcodes.
*
* This setting can be enabled only if `documentCaptureEnabled` is disabled.
*/
ean8ScanningEnabled: boolean;
/*
* Enables the scanning and processing of EAN-13 barcodes.
*
* This setting can be enabled only if `documentCaptureEnabled` is disabled.
*/
ean13ScanningEnabled: boolean;
/*
* Enables the scanning and processing of ITF barcodes.
*
* This setting can be enabled only if `documentCaptureEnabled` is disabled.
*/
itfScanningEnabled: boolean;
/*
* Enables the scanning and processing of DataMatrix barcodes.
*
* This setting can be enabled only if `documentCaptureEnabled` is disabled.
*/
dataMatrixScanningEnabled: boolean;
};
/*
* Settings for the document capture module.
*
* This module is responsible for the initial document detection, image extraction
* (such as face and document images), and image quality validation (blur, glare,
* and lighting checks).
*/
export type DocumentCaptureModuleSettings = {
/*
* Indicates whether the input image is already cropped and perspective-corrected.
*
* Requires the input image to consist solely of the cropped document image with perspective correction applied.
* This only applies to images from the DirectAPI method of scanning — with images from the default scanning, the setting will be ignored.
*/
inputImageCropped: boolean;
/*
* Enables the scanning and processing of unsupported document types.
*
* A document is considered unsupported if its classification result is `OTHER`.
*/
unsupportedDocumentsAllowed: boolean;
/*
* Indicates whether the back side scan should be skipped if the document supports only image capture on that side.
*
* Some documents have a back side that is supported but contains no extractable data (no MRZ, Barcode, etc.).
* These sides will be "captured only".
*
* If set to `true` (default), the scanning process will stop after the front side for such documents.
* If set to `false`, the back side will be captured, even though no data extraction is performed.
*/
secondSideWithNoExtractableDataSkipped: boolean;
/*
* Indicates whether only the passport data page should be scanned.
*
* Scan only the data page (page containing `MRZ`) of the passport.
*
* If set to `false`, it will be required to scan the second page of certain passports.
*/
passportDataPageScanOnly: boolean;
/*
* Enables the extraction of the document's face image.
*
* If a face image is present on the document, extraction becomes mandatory if supported.
*
* For supported documents, the requirement for its presence is determined by document rules.
* For unsupported documents, presence is optional.
*/
faceImageExtractionEnabled: boolean;
/*
* If set to `true`, face image presence will be mandatory for the scanned document.
*
* For [ScanningMode.automatic], document side with the face image must be scanned first.
*
* In case of a timeout and advancement to the next step in the scanning flow,
* if a face image is detected on the scanned side but cannot be extracted,
* the presence requirement is considered fulfilled. As a result, face image extraction
* will no longer be required to complete the scan on the next side.
*/
faceImagePresenceMandatory: boolean;
/*
* Indicates whether input images should be returned in the result.
*
* Saves the input images at the moment of data extraction or timeout.
* This significantly increases memory consumption. Scanning performance is not affected.
*/
inputImageReturnEnabled: boolean;
/*
* Indicates whether the cropped document image should be returned in the result.
*
*/
documentImageReturnEnabled: boolean;
/*
* Defines the minimum required margin (in percentage) between the edge of the input image and the document.
*
* This setting is implemented to comply with regulations in certain countries that mandate documents
* to be stored with adequate margins in the image.
*
* Default value is `0.02`.
* The setting is applicable only when using images from `Video` source.
* The setting is ignored if `inputImageCropped == true`.
*
* Allowed minimal value is `0.0` and maximum value is `1.0`.
*/
inputImageMargin?: number;
/*
* The DPI value for the cropped document, face and signature image.
*
* Allowed minimal value is `100` and maximum value is `400`.
*/
dotsPerInch: number;
/*
* The extension factor for the cropped document image. Applicable only to document images.
* Allowed minimal value is `0.0` and maximum value is `1.0`.
*
*/
extensionFactor: number;
/*
* The sensitivity of blur detection in the document image.
*
* Defines the severity of blur detected in the document image.
*
* Low – less sensitive to blur; if something is detected as blur, it is almost certainly actual blur,
* but some amount of blur may not be detected.
*
* High – highly sensitive to blur; it may detect blur even if it only resembles blur.
*
* See {@link SensitivityLevel} for more information
*/
blurSensitivityLevel: SensitivityLevel;
/*
* Indicates whether images with detected blur should be rejected.
*
* If `true`, images with detected blur will be excluded from further processing.
*
* If `false`, images will still be processed and blur status will be reported in the result.
*/
imageWithBlurRejected: boolean;
/*
* The sensitivity of glare detection in the document image.
*
* Low – less sensitive to glare.
* High – highly sensitive to glare.
* See {@link SensitivityLevel} for more information
*/
glareSensitivityLevel: SensitivityLevel;
/*
* Indicates whether images with detected glare should be rejected.
*
* If `true`, images with detected glare will be excluded from further processing.
*
* If `false`, images will still be processed and glare status will be reported in the result.
*/
imageWithGlareRejected: boolean;
/*
* The sensitivity of allowed detected tilt of the document in the image.
*
* Low – less sensitive to tilt.
* High – highly sensitive to tilt.
* See {@link SensitivityLevel} for more information
*/
tiltSensitivityLevel: SensitivityLevel;
/*
* Indicates whether images with poor lighting conditions should be rejected.
*
* Poor lighting conditions are represented as either `tooBright` or `tooDark`.
*
* If `true`, such images will be excluded from further processing.
*/
imageWithPoorLightingRejected: boolean;
/*
* Indicates whether images occluded by a hand should be rejected.
*
* If `true`, occluded images will be excluded from further processing.
*
* This setting is applicable only if `inputImageCropped == false`.
*/
imageWithHandOcclusionRejected: boolean;
};
/*
* Settings for the MRZ (Machine Readable Zone) extraction module.
*
* This module is dedicated to the detection and parsing of machine-readable
* zone typically found on passports, visas, and identity cards.
*/
export type MrzModuleSettings = {
/*
* If set to `true`, MRZ presence becomes mandatory for the scanned document
* regardless of the document rules.
*
* For [ScanningMode.single], the MRZ must be present on the scanned side.
* For [ScanningMode.automatic], the MRZ must be present on one of the scanned sides.
*
* In case of a timeout and advancement to the next step in the scanning flow,
* if an MRZ is detected on the scanned side but cannot be extracted,
* the presence requirement is considered fulfilled. As a result, MRZ extraction
* will no longer be required to complete the scan on the next side.
*/
presenceMandatory: boolean;
};
/*
* Settings for the VIZ (Visual Inspection Zone) extraction module.
*
* This module is responsible for extracting data from the document's
* visual fields.
*
* It supports features such as character validation for increased accuracy,
* signature image extraction, and data aggregation across multiple video frames.
*/
export type VizModuleSettings = {
/*
* If set to true, Viz presence becomes mandatory for the scanned document.
*
* For {@link ScanningMode.single}, the Viz must be present on the scanned side.
* Only the front side of supported documents can be scanned.
*
* For {@link ScanningMode.automatic}, this setting won't affect the default behaviour;
* front side must be scanned first followed by the back side.
*
* In case of a timeout and advancement to the next step in the scanning flow,
* if a Viz was not extracted fully from a front side, we'll proceed to extract Viz
* from the back side, if present.
*/
presenceMandatory: boolean;
/*
* Enables the extraction of the document's signature image if supported.
*
* For supported documents, signature image extraction is determined by document rules.
* For unsupported documents, extraction won't be performed.
*/
signatureImageExtractionEnabled: boolean;
/*
* Indicates whether character validation is enabled.
*
* Allow only results containing expected characters for a given field.
* Each field is validated against a set of rules.
* All fields have to be successfully validated in order to successfully scan a document.
* Setting is used to improve scanning accuracy.
*/
characterValidationEnabled: boolean;
/*
* Indicates whether the aggregation of data from multiple input images is enabled.
*
* Disabling this setting will yield higher-quality captured images, but it may slow down the scanning process due to the additional
* effort required to find the optimal image.
*
* Enabling this setting will simplify the extraction process, but the extracted data will be aggregated from multiple images instead
* of being sourced from a single image.
*
* This only applies to images from `Video` input image source - for images from `Photo` source, setting will be ignored.
*/
resultAggregationEnabled: boolean;
};
/**
* ClassFilter represents the document filter used to determine which documents will be processed.
* Document information (Country, Region, Type) is evaluated with the content set in the filter, and their inclusion or exclusion depends on the defined rules.
* To set the document information, use {@link DocumentFilter}.
* The recognition results of the excluded documents will not be returned.
* If using the standard BlinkID UX, an alert will be displayed that the document will not be scanned.
*
* By default, the ClassFilter is turned off, and all documents will be included.
*/
export type ClassFilter = {
/**
* Document classes that will be explicitly accepted by this filter.
* Only documents belonging to the specified classes will be processed. All other documents will be rejected.
*
* If this list is empty, no restrictions are applied, and documents will be accepted unless explicitly excluded by `excludeDocuments`.
*
* Example usage:
*
* ```
* final classFilter = ClassFilter();
* classFilter.includeDocuments = [
* DocumentFilter.country(Country.Usa),
* DocumentFilter.countryType(Country.Croatia, DocumentType.Id),
* ];
*
*
* ```
*
*
* NOTE: from the example above, the class filter is set to only accept all documents from USA, and Croatian IDs.
* All other documents will be rejected.
*
* Rules can be combined, for example, to set all three properties (Country Region, Type), two (e.g., Country and Type) or just one (e.g, Region).
*
* See {@link DocumentFilter} for setting the combinations.
*/
includeDocuments?: DocumentFilter[];
/**
* Document classes that will be explicitly rejected by this filter.
* Documents belonging to the specified classes will not be processed. Other documents, not included with `excludeDocuments` will be accepted.
*
* If this array is empty, no restrictions are applied, and documents will be excluded only if not present in `includeDocuments`.
*
* Example usage:
*
* ```
* final classFilter = ClassFilter();
* classFilter.excludeDocuments = [
* DocumentFilter.country(Country.Usa),
* DocumentFilter.countryType(Country.Croatia, DocumentType.Id),
* ];
*
*
* ```
*
* NOTE: from the example above, the class filter is set to only exclude all documents from USA, and Croatian IDs.
* All other classes will be accepted.
*
* Rules can be combined, for example, to set all three properties (Country Region, Type), two (e.g., Country and Type) or just one (e.g, Region).
*
* See {@link DocumentFilter} for setting the combinations.
*/
excludeDocuments?: DocumentFilter[];
};
/*
* A resolver that provides custom [RedactionSettings] for a scanned document
* based on its detected class information.
*
* Add the resolver when you need per-document redaction behavior — for example,
* anonymizing different fields depending on the document's country or type. The resolver
* is invoked by the SDK immediately before the scanning result is finalized.
*
* If not added, the SDK will use the default [RedactionSettings] for a given document class.
*/
export type RedactionSettingsResolver = {
/*
* A list of redaction configurations evaluated by the SDK.
*
* Each [RedactionSettings] entry can target specific document classes
* using [RedactionSettings.documentFilter].
*
* During scanning, the SDK selects the first matching configuration
* for the detected document class and applies its redaction rules.
*
* If no matching configuration is found, the default SDK redaction
* behavior is used.
*/
documentRedactionList: RedactionSettings[];
};
/**
* Represents the document filter.
*
* Used with other classes like the {@link ClassFilter}, {@link DocumentRules} and the {@link RedactionSettings}.
*/
export type DocumentFilter = {
/**
* If set, only specified country will pass the filter criteria.
* Otherwise, issuing country will not betaken into account.
*/
country?: Country;
/**
* If set, only specified country will pass the filter criteria.
* Otherwise, issuing region will not be taken into account.
*/
region?: Region;
/**
* If set, only specified type will pass the filter criteria.
* Otherwise, issuing type will not be taken into account.
*/
documentType?: DocumentType;
};
/**
* Represents the detailed field type.
*
*/
export class DetailedFieldType {
/**
* The field type.
*
* See {@link FieldType} for more information.
*/
fieldType: FieldType;
/**
* The alphabet type.
*
* See {@link AlphabetType} for more information.
*/
alphabetType: AlphabetType;
/**
*
* @param fieldType - specifies the {@link FieldType}.
* @param alphabetType - specifies the {@link AlphabetType}.
*
* Both parameters are mandatory.
*/
constructor(fieldType: FieldType, alphabetType: AlphabetType) {
this.fieldType = fieldType;
this.alphabetType = alphabetType;
}
}
/**
* Represents the document redaction settings.
*
*/
export type RedactionSettings = {
/**
* The mode of redaction applied to the document.
*/
mode: RedactionMode;
/**
* Document fields that will be anonymized.
*
*/
fields: FieldType[];
/**
* Document number anonymization settings.
*
*/
documentNumberRedactionSettings?: DocumentNumberRedactionSettings;
/*
* If true, whole Mrz result will be redacted.
*
* Default: `false`
*/
redactMrzResult: boolean;
/*
* If true, whole Barcode result will be redacted.
*
* Default: `false`
*/
redactBarcodeResult: boolean;
/**
* Specified fields will be anonymized if filter conditions are met.
*
*/
documentFilter?: DocumentFilter;
};
/**
* Represents the document number anonymization settings.
*
* Both settings, `prefixDigitsVisible` and `suffixDigitsVisible`, can be modified and set.
*
* By default, `prefixDigitsVisible` and `suffixDigitsVisible` are set to 0.
* This results that no digits within the document number will be visible.
*
* If any parameter is `undefined`, the value of the parameter will be set to `0`.
*/
export type DocumentNumberRedactionSettings = {
/**
* Defines how many digits at the beginning of the document number remain visible after anonymization.
*
*/
prefixDigitsVisible?: number;
/**
* Defines how many digits at the end of the document number remain visible after anonymization.
*
*/
suffixDigitsVisible?: number;
};
/**
* Represents the document class information.
*
*/
export type DocumentClassInfo = {
/**
* The document country.
*
* See {@link Country} for more information.
*/
country?: Country;
/**
* The document region.
*
* See {@link Region} for more information.
*/
region?: Region;
/**
* The type of the scanned document.
*
* See {@link DocumentType} for more information.
*/
documentType?: DocumentType;
/**
* Flag that indicates if the document class information is empty
*
*/
empty?: boolean;
/**
* The name of the country that issued the scanned document.
*
*/
countryName?: string;
/**
* The ISO numeric code of the country that issued the scanned document.
*
*/
isoNumericCountryCode?: string;
/**
* The 2 letter ISO code of the country that issued the scanned document.
*
*/
isoAlpha2CountryCode?: string;
/**
* The 3 letter ISO code of the country that issued the scanned document.
*
*/
isoAlpha3CountryCode?: string;
};
/**
* Represents the result of the data match.
*
*/
export type DataMatchResult = {
/**
* The state of the data match on the whole document.
*
* See {@link DataMatchState} for more information.
*/
overallState?: DataMatchState;
/**
* The data match state of each field.
*
* See {@link DataMatchResultField} for more information.
*/
states?: DataMatchResultField[];
};
/**
* Represents the state of the field in the data match.
*
*/
export type DataMatchResultField = {
/**
* The type of the field.
*
* See {@link DataMatchField} for more information.
*/
field?: DataMatchField;
/**
* The state of the field.
*
* See {@link DataMatchState} for more information.
*/
state?: DataMatchState;
};
/**
* Represents the multi-alphabet string result extracted from the OCR.
*
* The result contains the extracted strings, their locations, and the sides of the extracted strings.
*
*/
export type StringResult = {
/**
* All strings separated by new line
*
*/
value?: string;
/**
* String for field in latin alphabet
*
*/
latin?: string;
/**
* String for field in arabic alphabet
*
*/
arabic?: string;
/**
* String for field in cyrillic alphabet
*
*/
cyrillic?: string;
/**
* String for field in greek alphabet
*
*/
greek?: string;
/**
* Document field location.
*
* See {@link Location} for more information.
*/
location?: Location;
/**
* The document side where the field is located.
*
* See {@link Side} for more information.
*/
side?: Side;
};
/**
* Represents the rectangle location of each document field
*
*/
export type Rectangle = {
/**
* X location
*
*/
x?: number;
/**
* Y location
*
*/
y?: number;
/**
* Rectangle width
*
*/
width?: number;
/**
* Rectangle height.
*
*/
height?: number;
};
/**
* Represents the information about the location of an element within a document or image.
*
*/
export type Location = {
/**
* Rectangle location of the result extracted from the OCR in the latin alphabet.
*
*/
latin?: Rectangle;
/**
* Rectangle location of the result extracted from the OCR in the arabic alphabet.
*
*/
arabic?: Rectangle;
/**
* Rectangle location of the result extracted from the OCR in the cyrillic alphabet.
*
*/
cyrillic?: Rectangle;
/**
* Rectangle location of the result extracted from the OCR in the greek alphabet.
*
*/
greek?: Rectangle;
};
/**
* Scanning side on which the specific result is located.
*
*/
export type Side = {
/**
* Scanning side of the result extracted from the OCR in the latin alphabet.
*
*/
latin?: ScanningSide;
/**
* Scanning side of the result extracted from the OCR in the arabic alphabet.
*
*/
arabic?: ScanningSide;
/**
* Scanning side of the result extracted from the OCR in the cyrillic alphabet.
*
*/
cyrillic?: ScanningSide;
/**
* Scanning side of the result extracted from the OCR in the greek alphabet.
*
*/
greek?: ScanningSide;
};
/**
* Represents the result of the date extraction.
*
* Contains the extracted date, along with additional date information.
*/
export type DateResult<T> = {
/**
* The extracted date information.
*
* See {@link Date} for more information.
*/
date?: Date;
/**
* Original string representation of the date which has been extracted.
*
* Depending of the information source, it can either be of type {@link StringResult} or `string`.
*/
originalString?: T;
/**
* Indicates that date does not appear on the document
* but is filled by our internal domain knowledge.
*/
isFilledByDomainKnowledge?: boolean;
/**
* Indicates whether date was successfully parsed.
*
*/
successfullyParsed?: boolean;
};
/**
* Represents the extracted date.
*
*/
export type Date = {
/**
* Day of the month.
*
* The first day of the month has value 1.
*/
day?: number;
/**
* Month of the year.
*
* The first month of the year has value 1.
*/
month?: number;
/**
* Full year.
*
*/
year?: number;
};
/**
* Represents detailed extracted information about the driver license.
*
*/
export type DriverLicenseDetailedInfo<T> = {
/**
* The restrictions to driving privileges for the United States driver license owner.
*
* Depending of the information source, it can either be of type {@link StringResult} or `String`.
*/
restrictions?: T;
/**
* The additional privileges granted to the US driver license owner.
*
* Depending of the information source, it can either be of type {@link StringResult} or `String`.
*/
endorsements?: T;
/**
* The type of vehicle the driver license owner has privilege to drive.
*
* Depending of the information source, it can either be of type {@link StringResult} or `String`.
*/
vehicleClass?: T;
/**
* The driver license conditions.
*
* Depending of the information source, it can either be of type {@link StringResult} or `String`.
*/
conditions?: T;
/**
* The additional information on vehicle class.
*
* See {@link VehicleClassInfo} for more information.
*/
vehicleClassesInfo?: VehicleClassInfo<T>[];
};
/**
* Represents the information about the vehicle class extraction.
*
*/
export type VehicleClassInfo<T> = {
/**
* The type of driver licence.
*
* Depending of the information source, it can either be of type {@link StringResult} or `string`.
*/
licenceType?: T;
/**
* The type of vehicle the driver license owner has privilege to drive.
*
* Depending of the information source, it can either be of type {@link StringResult} or `String`.
*/
vehicleClass?: T;
/**
* The date since licence is effective.
*
* See {@link DateResult} for more information.
*/
effectiveDate?: DateResult<T>;
/**
* The date of expiry of licence.
*
* See {@link DateResult} for more information.
*/
expiryDate?: DateResult<T>;
};
/**
* Information about the dependent.
*
*/
export type DependentInfo = {
/**
* The date of birth of the dependent.
*
*/
dateOfBirth?: DateResult<StringResult>;
/**
* The sex or gender of the dependent.
*
*/
sex?: StringResult;
/**
* The document number of the dependent.
*
*/
documentNumber?: StringResult;
/**
* The full name of the dependent.
*
*/
fullName?: StringResult;
/**
* Checks if the dependent's information is empty.
*
*/
empty?: boolean;
};
/**
* Represents the result of the image crop transformation with additional details.
*
*/
export type DetailedCroppedImageResult = {
/**
* The cropped image in the Base64 format
*
*/
image?: string;
/**
* The document side that was cropped.
*
*/
side?: ScanningSide;
/**
* The location of the cropped image in the transformed image of the document.
*
*/
location?: Rectangle;
};
/**
* Represents the result of scanning a single side of the document.
*
* Contains the data extracted from the Visual Inspection Zone, Machine Readable Zone,
* barcode, the input image, and the cropped document, face, and signature images.
*/
export type SingleSideScanningResult = {
/**
* The data extracted from the Visual Inspection Zone.
*
*/
viz?: VizResult;
/**
* The data extracted from the Machine Readable Zone.
*
*/
mrz?: MrzResult;
/**
* The data extracted from the barcode.
*
*/
barcode?: BarcodeResult;
/**
* The input image in the Base64 format.
*
*/
inputImage?: string;
/**
* The cropped barcode image in the Base64 format when
* {@link BarcodeModuleSettings.barcodeImageReturnEnabled} is enabled.
*
*/
barcodeImage?: string;
/**
* The cropped document image in the Base64 format.
*
*/
documentImage?: string;
/**
* The cropped face image with additional info.
*
*/
faceImage?: DetailedCroppedImageResult;
/**
* The cropped signature image with additional info.
*
*/
signatureImage?: DetailedCroppedImageResult;
};
/**
* Represents the result of the Visual Inspection Zone of a document.
*
*/
export type VizResult = {
/**
* The first name of the document owner.
*
*/
firstName?: StringResult;
/**
* The last name of the document owner.
*
*/
lastName?: StringResult;
/**
* The full name of the document owner.
*
*/
fullName?: StringResult;
/**
* The additional name information of the document owner.
*
*/
additionalNameInformation?: StringResult;
/**
* The localized name of the document owner.
*
*/
localizedName?: StringResult;
/**
* The fathers name of the document owner.
*
*/
fathersName?: StringResult;
/**
* The mothers name of the document owner.
*
*/
mothersName?: StringResult;
/**
* The address of the document owner.
*
*/
address?: StringResult;
/**
* The additional address information of the document owner.
*
*/
additionalAddressInformation?: StringResult;
/**
* The one more additional address information of the document owner.
*
*/
additionalOptionalAddressInformation?: StringResult;
/**
* The place of birth of the document owner.
*
*/
placeOfBirth?: StringResult;
/**
* The nationality of the document owner.
*
*/
nationality?: StringResult;
/**
* The race of the document owner.
*
*/
race?: StringResult;
/**
* The religion of the document owner.
*
*/
religion?: StringResult;
/**
* The profession of the document owner.
*
*/
profession?: StringResult;
/**
* The marital status of the document owner.
*
*/
maritalStatus?: StringResult;
/**
* The residential status of the document owner.
*
*/
residentialStatus?: StringResult;
/**
* The employer of the document owner.
*
*/
employer?: StringResult;
/**
* The sex of the document owner.
*
*/
sex?: StringResult;
/**
* The sponsor of the document owner.
*
*/
sponsor?: StringResult;
/**
* The blood type of the document owner.
*
*/
bloodType?: StringResult;
/**
* The date of birth of the document owner.
*
*/
dateOfBirth?: DateResult<StringResult>;
/**
* The date of issue of the document.
*
*/
dateOfIssue?: DateResult<StringResult>;
/**
* The date of expiry of the document.
*
*/
dateOfExpiry?: DateResult<StringResult>;
/**
* The date of entry of the document owner.
*
*/
dateOfEntry?: DateResult<StringResult>;
/**
* The locality code of the document owner.
*
*/
localityCode?: StringResult;
/**
* The maiden name of the document owner.
*
*/
maidenName?: StringResult;
/**
* The municipality code of the document owner.
*
*/
municipalityCode?: StringResult;
/**
* The municipality of registration of the document owner.
*
*/
municipalityOfRegistration?: StringResult;
/**
* The polling station code of the document owner.
*
*/
pollingStationCode?: StringResult;
/**
* The registration center code of the document owner.
*
*/
registrationCenterCode?: StringResult;
/**
* The section code of the document owner.
*
*/
sectionCode?: StringResult;
/**
* The state code of the document owner.
*
*/
stateCode?: StringResult;
/**
* The state of the document owner.
*
*/
stateName?: StringResult;
/**
* Determines if date of expiry is permanent.
*
*/
dateOfExpiryPermanent?: boolean;
/**
* The document number.
*
*/
documentNumber?: StringResult;
/**
* The card access number
*/
cardAccessNumber?: StringResult;
/**
* The personal identification number.
*
*/
personalIdNumber?: StringResult;
/**
* The additional number of the document.
*
*/
documentAdditionalNumber?: StringResult;
/**
* The one more additional number of the document.
*
*/
documentOptionalAdditionalNumber?: StringResult;
/**
* The additional personal identification number.
*
*/
additionalPersonalIdNumber?: StringResult;
/**
* The issuing authority of the document.
*
*/
issuingAuthority?: StringResult;
/**
* The visa type of the document.
*
*/
visaType?: StringResult;
/**
* The driver license detailed info.
*
*/
driverLicenseDetailedInfo?: DriverLicenseDetailedInfo<StringResult>;
/**
* The transcription of the document subtype.
*
*/
documentSubtype?: StringResult;
/**
* The remarks on the residence permit.
*
*/
remarks?: StringResult;
/**
* The residence permit type.
*/
residencePermitType?: StringResult;
/**
* The manufacturing year.
*
*/
manufacturingYear?: StringResult;
/**
* The vehicle type.
*
*/
vehicleType?: StringResult;
/**
* The eligibility category.
*
*/
eligibilityCategory?: StringResult;
/**
* The specific document validity.
*
*/
specificDocumentValidity?: StringResult;
/**
* The dependents info.
*
*/
dependentsInfo?: DependentInfo[];
/**
* The vehicle owner.
*
*/
vehicleOwner?: StringResult;
/**
* The country code of the document owner.
*
*/
countryCode?: StringResult;
/**
* The certificate number of the document owner.
*
*/
certificateNumber?: StringResult;
/**
* The national insurance number of the document owner.
*
*/
nationalInsuranceNumber?: StringResult;
/**
* The effective date of the document.
*/
effectiveDate?: DateResult<StringResult>;
/**
* The parents info.
*
* See {@link ParentInfo} for more information.
*/
parentsInfo?: ParentInfo[];
/**
* The husband name of the document owner.
*/
husbandName?: StringResult;
/**
* The legal status of the document owner.
*/
legalStatus?: StringResult;
/**
* The social security status of the document owner.
*/
socialSecurityStatus?: StringResult;
/**
* The work restriction of the document owner.
*/
workRestriction?: StringResult;
};
/**
* Represents the result of the MRZ recognition.
*
*/
export type MrzResult = {
/**
* The entire Machine Readable Zone text from ID.
*
*/
rawMRZString?: string;
/**
* The document code. Document code contains two characters.
* For MRTD the first character shall be A, C or I.
*
* The second character shall be discretion of the issuing State or organization except
* that V shall not be used, and `C` shall not be used after `A` except in the crew member certificate.
*
* On machine-readable passports (MRP) first character shall be `P` to designate an MRP. One additional
* letter may be used, at the discretion of the issuing State or organization, to designate a particular
* MRP.
*
* If the second character position is not used for this purpose, it shall be filled by the filter character.
*/
documentCode?: string;
/**
* Three-letter or two-letter code which indicate the issuing State. Three-letter codes are based
* on Aplha-3 codes for entities specified in ISO 3166-1, with extensions for certain States.
*
* Two-letter codes are based on Aplha-2 codes for entities specified in ISO 3166-1, with extensions for certain States.
*/
issuer?: string;
/**
* The document number.
*
*/
documentNumber?: string;
/**
* The first optional data. Empty string if not available.
*
*/
opt1?: string;
/**
* The second optional data. Empty string if not available.
*
*/
opt2?: string;
/**
* The gender of the document holder.
*
* Gender is specified by use of the single initial.
*/
gender?: string;
/**
* The nationality of the document holder represented by a three-letter or two-letter code.
*
* Three-letter codes are based on Alpha-3 codes for entities specified in ISO 3166-1, with extensions for certain States.
*
* Two-letter codes are based on Aplha-2 codes for entities specified in ISO 3166-1, with extensions for certain States.
*/
nationality?: string;
/**
* The primary indentifier.
*
* If there is more than one component, they are separated with space.
*/
primaryID?: string;
/**
* The secondary identifier.
*
* If there is more than one component, they are separated with space.
*/
secondaryID?: string;
/**
* The full issuer name that is expanded from the three-letter or two-letter code which indicate
* the issuing State.
*
*/
issuerName?: string;
/**
* The full nationality of the document holder, which is expanded from the three-letter or two-letter
* nationality code.
*/
nationalityName?: string;
/**
* Whether the MRZ is verified.
*
* If the MRZ is verified, it means that all check digits are correct.
*/
verified?: boolean;
/**
* The date of birth of the document holder.
*
*/
dateOfBirth?: DateResult<string>;
/**
* The date of expiry of the document.
*
*/
dateOfExpiry?: DateResult<string>;
/**
* The type of the document.
*
*/
documentType?: MRZDocumentType;
/**
* The sanitized first optional data.
*
* Result without additional '<' characters if they exist.
*/
sanitizedOpt1?: string;
/**
* The sanitized second optional data.
*
* Result without additional '<' characters if they exist.
*/
sanitizedOpt2?: string;
/**
* The sanitized nationality.
*
* Result without additional '<' characters if they exist.
*/
sanitizedNationality?: string;
/**
* The sanitized issuer.
*
* Result without additional '<' characters if they exist.
*/
sanitizedIssuer?: string;
/**
* The sanitized document code.
*
* Result without additional '<' characters if they exist.
*/
sanitizedDocumentCode?: string;
/**
* The sanitized document number.
*
* Result without additional '<' characters if they exist.
*/
sanitizedDocumentNumber?: string;
};
/**
* Represents the data extracted from the barcode.
*
*/
export type BarcodeResult = {
/**
* The raw, unparsed barcode data.
*
*/
barcodeData?: BarcodeData;
/**
* The first name of the document owner.
*
*/
firstName?: string;
/**
* The middle name of the document owner.
*
*/
middleName?: string;
/**
* The last name of the document owner.
*
*/
lastName?: string;
/**
* The full name of the document owner.
*
*/
fullName?: string;
/**
* The additional name information of the document owner.
*
*/
additionalNameInformation?: string;
/**
* The address of the document owner.
*
*/
address?: string;
/**
* The place of birth of the document owner.
*
*/
placeOfBirth?: string;
/**
* The nationality of the document owner.
*
*/
nationality?: string;
/**
* The race of the document owner.
*
*/
race?: string;
/**
* The religion of the document owner.
*
*/
religion?: string;
/**
* The profession of the document owner.
*
*/
profession?: string;
/**
* The marital status of the document owner.
*
*/
maritalStatus?: string;
/**
* The residential status of the document owner.
*
*/
residentialStatus?: string;
/**
* The employer of the document owner.
*
*/
employer?: string;
/**
* The sex of the document owner.
*
*/
sex?: string;
/**
* The date of birth of the document owner.
*
*/
dateOfBirth?: DateResult<string>;
/**
* The date of issue of the document.
*
*/
dateOfIssue?: DateResult<string>;
/**
* The date of expiry of the document.
*
*/
dateOfExpiry?: DateResult<string>;
/**
* The document number.
*
*/
documentNumber?: string;
/**
* The personal identification number.
*
*/
personalIdNumber?: string;
/**
* The additional number of the document.
*
*/
documentAdditionalNumber?: string;
/**
* The issuing authority of the document.
*
*/
issuingAuthority?: string;
/**
* The details about the address of the document owner.
*
*/
addressDetailedInfo?: AddressDetailedInfo;
/**
* The driver license detailed info.
*
*/
driverLicenseDetailedInfo?: DriverLicenseDetailedInfo<string>;
/**
* Document specific extended elements that contain all barcode fields in their original form.
*
* Currently this is only filled for AAMVACompliant documents.
*/
extendedElements?: BarcodeExtendedElements;
/**
* Indicates whether the barcode was successfully parsed.
*/
parsed?: boolean;
};
/**
* Represents the raw, unparsed data extracted from a scanned barcode.
*
*/
export type BarcodeData = {
/**
* Type of the scanned barcode.
*
*/
barcodeType?: BarcodeType;
/**
* Raw bytes of the barcode content.
*
*/
rawData?: string;
/**
* String representation of the barcode content.
*
*/
stringData?: string;
/**
* Whether the barcode data is uncertain, i.e. if scanned barcode was incomplete or has parts of it missing.
*
*/
uncertain?: boolean;
};
/**
* Detailed information about the address.
*
*/
export type AddressDetailedInfo = {
/**
* he address street portion of the document owner.
*
*/
street?: string;
/**
* The address postal code portion of the document owner.
*
*/
postalCode?: string;
/**
* The address city portion of the document owner.
*
*/
city?: string;
/**
* The address jurisdiction code portion of the document owner.
*
*/
jurisdiction?: string;
};
/**
* Represents the fields present in the barcode.
* Currently this is only used for AAMVACompliant documents.
*/
export type BarcodeExtendedElements = {
/**
* Mandatory on all AAMVA and Magnetic barcodes.
* On compact barcodes, use kFullAddress.
*
* City portion of the cardholder address.
*/
addressCity?: string;
/**
* Mandatory on all AAMVA and Magnetic barcodes.
* On compact barcodes, use kFullAddress.
*
* State portion of the cardholder address.
*/
addressJurisdictionCode?: string;
/**
* Mandatory on all AAMVA and Magnetic barcodes.
* On compact barcodes, use kFullAddress.
*
* Postal code portion of the cardholder address in the U.S. and Canada.
* If the trailing portion of the postal code in the U.S. is not known, zeros can be used
* to fill the trailing set of numbers up to nine (9) digits.
*/
addressPostalCode?: string;
/**
* Mandatory on all AAMVA and Magnetic barcodes.
* On compact barcodes, use kFullAddress.
*
* Street portion of the cardholder address.
* The place where the registered driver of a vehicle (individual or corporation)
* may be contacted such as a house number, street address, etc.
*/
addressStreet?: string;
/**
* Optional on all AAMVA barcodes.
* On Compact barcodes, use kFullAddress.
*
* Second line of street portion of the cardholder address.
*/
addressStreet2?: string;
/**
* Optional on AAMVA 01. (MMDDCCYY format)
*
* ALTERNATIVE DATES(S) given as date of birth.
*/
akaDateOfBirth?: string;
/**
* Optional on all AAMVA and Compact barcodes.
* Other family name by which the cardholder is known.
*/
akaFamilyName?: string;
/**
* Optional on all AAMVA and Compact barcodes.
*
* Other name by which the cardholder is known. ALTERNATIVE NAME(S) of the individual
* holding the Driver License or ID.
*
* The Name field contains up to four portions, separated with the "," delimiter:
* AKA Last Name (required)
* , (required)
* AKA First Name (required)
* , (required if other name portions follow, otherwise optional)
* AKA Middle Name(s) (optional)
* , (required if other name portions follow, otherwise optional)
* AKA Suffix (optional)
* , (optional)
*
* If the individual has more than one AKA middle name they are separated with space.
*/
akaFullName?: string;
/**
* Optional on all AAMVA and Compact barcodes.
*
* Other given name by which the cardholder is known
*/
akaGivenName?: string;
/**
* Optional on AAMVA 01 barcodes.
*
* ALTERNATIVE MIDDLE NAME(s) or INITIALS of the individual holding the Driver License or ID.
* Hyphenated names acceptable, spaces between names acceptable, but no other
* use of special symbols.
*/
akaMiddleName?: string;
/**
* Optional on AAMVA 01 barcodes.
*
* ALTERNATIVE PREFIX to Driver Name. Freeform as defined by issuing jurisdiction.
*/
akaPrefixName?: string;
/**
* Optional on AAMVA version 01.
*
* Driver "AKA" Social Security Number. FORMAT SAME AS DRIVER SOC SEC NUM. ALTERNATIVE NUMBERS(S) used as SS NUM.
*/
akaSocialSecurityNumber?: string;
/**
* Optional on all AAMVA and Compact barcodes.
*
* Other suffix by which the cardholder is known.
* The Suffix Code Portion, if submitted, can contain only the Suffix Codes
* shown in the following table (e.g., Andrew Johnson, III = JOHNSON@ANDREW@@3RD):
*
* Suffix Meaning or Synonym
* JR Junior
* SR Senior or Esquire 1ST First
* 2ND Second
* 3RD Third
* 4TH Fourth
* 5TH Fifth
* 6TH Sixth
* 7TH Seventh
* 8TH Eighth
* 9TH Ninth
*/
akaSuffixName?: string;
/**
* Optional on AAMVA 02, 03, 04, 05, 06, 07, 08 and Compact barcodes.
*
* A string of letters and/or numbers that identifies when, where, and by whom a driver's
* license/ID card was made. If audit information is not used on the card or the MRT, it
* must be included in the driver record.
*/
auditInformation?: string;
/**
* Optional on AAMVA 04, 05, 06, 07, 08 and Compact barcodes.
*
* DHS required field that indicates date of the most recent version change or
* modification to the visible format of the DL/ID. (MMDDCCYY format)
*/
cardRevisionDate?: string;
/**
* Optional on AAMVA 04, 05, 06, 07, 08 and Compact barcodes.
*
* DHS required field that indicates compliance: "M" = materially compliant,
* "F" = fully compliant, and, "N" = non-compliant.
*/
complianceType?: string;
/**
* Mandatory on AAMVA 02, 03, 04, 05, 06, 07, 08 and Compact barcodes.
*
* Country in which DL/ID is issued. U.S. = USA, Canada = CAN.
*/
countryIdentification?: string;
/**
* Mandatory on all AAMVA, Magnetic and Compact barcodes.
*
* Family name of the cardholder. (Family name is sometimes also called "last name" or "surname.")
* Collect full name for record, print as many characters as possible on portrait side of DL/ID.
*/
customerFamilyName?: string;
/**
* Mandatory on all AAMVA and Compact barcodes.
*
* The number assigned or calculated by the issuing authority.
*/
customerIdNumber?: string;
/**
* Mandatory on all AAMVA, Magnetic and Compact barcodes.
*
* First name of the cardholder.
*/
customerFirstName?: string;
/**
* Mandatory on all AAMVA, Magnetic and Compact barcodes.
*
* Full name of the individual holding the Driver's License or ID.
*
* The Name field contains up to four portions, separated with the "," delimiter:
* Last Name (required)
* , (required)
* First Name (required)
* , (required if other name portions follow, otherwise optional)
* Middle Name(s) (optional)
* , (required if other name portions follow, otherwise optional)
* Suffix (optional)
* , (optional)
*
* If the individual has more than one middle name they are separated with space.
*/
customerFullName?: string;
/**
* Mandatory on AAMVA 04, 05, 06, 07, 08 barcodes.
* Optional on AAMVA 01, 02, 03, Magnetic and Compcat barcodes.
*
* Middle name(s) of the cardholder. In the case of multiple middle names they
* shall be separated by space " ".
*/
customerMiddleName?: string;
/**
* Optional on compact barcodes.
*
* Document discriminator.
*/
dataDiscriminator?: string;
/**
* Mandatory on all AAMVA, Magnetic and Compact barcodes.
*
* Date on which the cardholder was born. (MMDDCCYY format)
*/
dateOfBirth?: string;
/**
* Mandatory on AAMVA 02, 03, 04, 05, 06, 07, 08 and Magnetic barcodes.
* Optional on Compact barcodes.
*
* Number must uniquely identify a particular document issued to that customer
* from others that may have been issued in the past. This number may serve
* multiple purposes of document discrimination, audit info, and/or inventory control.
*/
documentDiscriminator?: string;
/**
* Mandatory on all AAMVA, Magnetic and Compact barcodes.
*
* Date on which the document expires. (MMDDCCYY format)
* If the document is non expiring then "Non expi