UNPKG

blinkid-cordova

Version:

A small and powerful ID card scanning library

1,653 lines (1,455 loc) 195 kB
/** * cordova is available under *either* the terms of the modified BSD license *or* the * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. * * Copyright (c) Matt Kane 2010 * Copyright (c) 2011, IBM Corporation */ var exec = require("cordova/exec"); /** * Constructor. * * @returns {BlinkID} */ function BlinkID() { }; /** * successCallback: callback that will be invoked on successful scan * errorCallback: callback that will be invoked on error * overlaySettings: settings for desired camera overlay * recognizerCollection: {RecognizerCollection} containing recognizers to use for scanning * licenses: object containing: * - base64 license keys for iOS and Android * - optioanl parameter 'licensee' when license for multiple apps is used * - optional flag 'showTrialLicenseKeyWarning' which indicates * whether warning for trial license key will be shown, in format * { * ios: 'base64iOSLicense', * android: 'base64AndroidLicense', * licensee: String, * showTrialLicenseKeyWarning: Boolean * } */ BlinkID.prototype.scanWithCamera = function (successCallback, errorCallback, overlaySettings, recognizerCollection, licenses) { if (errorCallback == null) { errorCallback = function () { }; } if (typeof errorCallback != "function") { console.log("BlinkIDScanner.scanWithCamera failure: failure parameter not a function"); throw new Error("BlinkIDScanner.scanWithCamera failure: failure parameter not a function"); return; } if (typeof successCallback != "function") { console.log("BlinkIDScanner.scanWithCamera failure: success callback parameter must be a function"); throw new Error("BlinkIDScanner.scanWithCamera failure: success callback parameter must be a function"); return; } // first invalidate old results for (var i = 0; i < recognizerCollection.recognizerArray[i].length; ++i ) { recognizerCollection.recognizerArray[i].result = null; } exec( function internalCallback(scanningResult) { var cancelled = scanningResult.cancelled; if (cancelled) { successCallback(true); } else { var results = scanningResult.resultList; if (results.length != recognizerCollection.recognizerArray.length) { console.log("INTERNAL ERROR: native plugin returned wrong number of results!"); throw new Error("INTERNAL ERROR: native plugin returned wrong number of results!"); errorCallback(new Error("INTERNAL ERROR: native plugin returned wrong number of results!")); } else { for (var i = 0; i < results.length; ++i) { // native plugin must ensure types match recognizerCollection.recognizerArray[i].result = recognizerCollection.recognizerArray[i].createResultFromNative(results[i]); } successCallback(false); } } }, errorCallback, 'BlinkIDScanner', 'scanWithCamera', [overlaySettings, recognizerCollection, licenses]); }; /** * successCallback: callback that will be invoked on successful scan * errorCallback: callback that will be invoked on error * recognizerCollection: {RecognizerCollection} containing recognizers to use for scanning * frontImage: the Base64 format string that represents the front image of the document that will be used for processing with DirectAPI * backImage: the Base64 format string that represents the back image of the document that will be used for processing with DirectAPI * - This parameter is optional for the BlinkIdSingleSideRecognizer. Pass 'null' or an empty string "" for this parameter in this case * licenses: object containing: * - base64 license keys for iOS and Android * - optioanl parameter 'licensee' when license for multiple apps is used * - optional flag 'showTrialLicenseKeyWarning' which indicates * whether warning for trial license key will be shown, in format * { * ios: 'base64iOSLicense', * android: 'base64AndroidLicense', * licensee: String, * showTrialLicenseKeyWarning: Boolean * } */ BlinkID.prototype.scanWithDirectApi = function (successCallback, errorCallback, recognizerCollection, frontImage, backImage, licenses) { if (errorCallback == null) { errorCallback = function () { }; } if (typeof errorCallback != "function") { console.log("BlinkIDScanner.scanWithDirectApi failure: failure parameter not a function"); throw new Error("BlinkIDScanner.scanWithDirectApi failure: failure parameter not a function"); return; } if (typeof successCallback != "function") { console.log("BlinkIDScanner.scanWithDirectApi failure: success callback parameter must be a function"); throw new Error("BlinkIDScanner.scanWithDirectApi failure: success callback parameter must be a function"); return; } // first invalidate old results for (var i = 0; i < recognizerCollection.recognizerArray[i].length; ++i ) { recognizerCollection.recognizerArray[i].result = null; } exec( function internalCallback(scanningResult) { var cancelled = scanningResult.cancelled; if (cancelled) { successCallback(true); } else { var results = scanningResult.resultList; if (results.length != recognizerCollection.recognizerArray.length) { console.log("INTERNAL ERROR: native plugin returned wrong number of results!"); throw new Error("INTERNAL ERROR: native plugin returned wrong number of results!"); errorCallback(new Error("INTERNAL ERROR: native plugin returned wrong number of results!")); } else { for (var i = 0; i < results.length; ++i) { // native plugin must ensure types match recognizerCollection.recognizerArray[i].result = recognizerCollection.recognizerArray[i].createResultFromNative(results[i]); } successCallback(false); } } }, errorCallback, 'BlinkIDScanner', 'scanWithDirectApi', [recognizerCollection, frontImage, backImage, licenses]); }; // COMMON CLASSES /** * Base class for all recognizers. * Recognizer is object that performs recognition of image * and updates its result with data extracted from the image. */ function Recognizer(recognizerType) { /** Type of recognizer */ this.recognizerType = recognizerType; /** Recognizer's result */ this.result = null; } /** * Possible states of the Recognizer's result */ var RecognizerResultState = Object.freeze( { /** Recognizer result is empty */ empty : 0, /** Recognizer result contains some values, but is incomplete or it contains all values, but some are not uncertain */ uncertain : 1, /** Recognizer resul contains all required values */ valid : 2 } ); /** * Possible states of the Recognizer's result */ BlinkID.prototype.RecognizerResultState = RecognizerResultState; /** * Base class for all recognizer's result objects. * Recoginzer result contains data extracted from the image. */ function RecognizerResult(resultState) { /** State of the result. It is always one of the values represented by BlinkIDScanner.RecognizerResultState enum */ this.resultState = resultState; } /** * Represents a collection of recognizer objects. * @param recognizerArray Array of recognizer objects that will be used for recognition. Must not be empty! */ function RecognizerCollection(recognizerArray) { /** Array of recognizer objects that will be used for recognition */ this.recognizerArray = recognizerArray; /** * Whether or not it is allowed for multiple recognizers to process the same image. * If not, then first recognizer that will be successful in processing the image will * end the processing chain and other recognizers will not get the chance to process * that image. */ this.allowMultipleResults = false; /** Number of miliseconds after first non-empty result becomes available to end scanning with a timeout */ this.milisecondsBeforeTimeout = 0; if (!(this.recognizerArray.constructor === Array)) { throw new Error("recognizerArray must be array of Recognizer objects!"); } // ensure every element in array is Recognizer for (var i = 0; i < this.recognizerArray.length; ++i) { if (!(this.recognizerArray[i] instanceof Recognizer )) { throw new Error( "Each element in recognizerArray must be instance of Recognizer" ); } } } BlinkID.prototype.RecognizerCollection = RecognizerCollection; /** * Represents a date extracted from image. */ function Date(nativeDate) { /** day in month */ this.day = nativeDate.day; /** month in year */ this.month = nativeDate.month; /** year */ this.year = nativeDate.year; /** original date string */ this.originalDateStringResult = nativeDate.originalDateStringResult; /** isFilledByDomainKnowledge */ this.isFilledByDomainKnowledge = nativeDate.isFilledByDomainKnowledge; } BlinkID.prototype.Date = Date; /** * Represents a point in image */ function Point(nativePoint) { /** x coordinate of the point */ this.x = nativePoint.x; /** y coordinate of the point */ this.y = nativePoint.y; } BlinkID.prototype.Point = Point; /** * Represents a quadrilateral location in the image */ function Quadrilateral(nativeQuad) { /** upper left point of the quadrilateral */ this.upperLeft = new Point(nativeQuad.upperLeft); /** upper right point of the quadrilateral */ this.upperRight = new Point(nativeQuad.upperRight); /** lower left point of the quadrilateral */ this.lowerLeft = new Point(nativeQuad.lowerLeft); /** lower right point of the quadrilateral */ this.lowerRight = new Point(nativeQuad.lowerRight); } BlinkID.prototype.Quadrilateral = Quadrilateral; /** * Possible types of Machine Readable Travel Documents (MRTDs). */ BlinkID.prototype.MrtdDocumentType = Object.freeze( { /** Unknown document type */ Unknown : 0, /** Identity card */ IdentityCard : 1, /** Passport */ Passport : 2, /** Visa */ Visa : 3, /** US Green Card */ GreenCard : 4, /** Malaysian PASS type IMM13P */ MalaysianPassIMM13P : 5, /** Border Crossing Card */ BorderCrossingCard: 6 } ); /** * Possible types of documents scanned with IdBarcodeRecognizer. */ BlinkID.prototype.IdBarcodeDocumentType = Object.freeze( { /** No document was scanned */ None: 0, /** AAMVACompliant document was scanned */ AAMVACompliant: 1, /** Argentina ID document was scanned */ ArgentinaID: 2, /** ArgentinaAlienID document was scanned */ ArgentinaAlienID: 3, /** Argentina driver license document was scanned */ ArgentinaDL: 4, /** Colombia ID document was scanned */ ColombiaID: 5, /** Colombia driver license document was scanned */ ColombiaDL: 6, /** NigeriaVoter ID document was scanned */ NigeriaVoterID: 7, /** Nigeria driver license document was scanned */ NigeriaDL: 8, /** Panama ID document was scanned */ PanamaID: 9, /** SouthAfrica ID document was scanned */ SouthAfricaID: 10 } ); /** * Defines possible color statuses determined from scanned image scanned with BlinkID or BlinkID MultiSide Recognizer */ BlinkID.prototype.DocumentImageColorStatus = Object.freeze( { /** Determining image color status was not performed */ NotAvailable: 0, /** Black-and-white image scanned */ BlackAndWhite: 1, /** Color image scanned */ Color: 2 } ); /** * Defines possible states of Moire pattern detection. */ BlinkID.prototype.ImageAnalysisDetectionStatus = Object.freeze( { /** Detection of Moire patterns was not performed. */ NotAvailable: 0, /** Moire pattern not detected on input image. */ NotDetected: 1, /** Moire pattern detected on input image. */ Detected: 2 } ); /** * AlphabetType represents all of the alphabet types that BlinkID supports extracting. * */ var AlphabetType = Object.freeze( { /** The Latin alphabet type. */ Latin: 0, /** The Arabic alphabet type. */ Arabic: 1, /** The Cyrillic alphabet type. */ Cyrillic: 2, /** The Greek alphabet type. */ Greek: 3 } ); /** * AlphabetType represents all of the alphabet types that BlinkID supports extracting. * */ BlinkID.prototype.AlphabetType = AlphabetType; /** * Define level of anonymization performed on recognizer result. */ var AnonymizationMode = Object.freeze( { /** Anonymization will not be performed. */ None: 0, /** FullDocumentImage is anonymized with black boxes covering sensitive data. */ ImageOnly: 1, /** Result fields containing sensitive data are removed from result. */ ResultFieldsOnly: 2, /** This mode is combination of ImageOnly and ResultFieldsOnly modes. */ FullResult: 3 } ); /** * Define level of anonymization performed on recognizer result. */ BlinkID.prototype.AnonymizationMode = AnonymizationMode; /** * Detailed information about the recognition process. */ BlinkID.prototype.ProcessingStatus = Object.freeze( { /** Recognition was successful. */ Success: 0, /** Detection of the document failed. */ DetectionFailed: 1, /** Preprocessing of the input image has failed. */ ImagePreprocessingFailed: 2, /** Recognizer has inconsistent results. */ StabilityTestFailed: 3, /** Wrong side of the document has been scanned. */ ScanningWrongSide: 4, /** Identification of the fields present on the document has failed. */ FieldIdentificationFailed: 5, /** Mandatory field for the specific document is missing. */ MandatoryFieldMissing: 6, /** Result contains invalid characters in some of the fields. */ InvalidCharactersFound: 7, /** Failed to return a requested image. */ ImageReturnFailed: 8, /** Reading or parsing of the barcode has failed. */ BarcodeRecognitionFailed: 9, /** Parsing of the MRZ has failed. */ MrzParsingFailed: 10, /** Document class has been filtered out. */ ClassFiltered: 11, /** Document currently not supported by the recognizer. */ UnsupportedClass: 12, /** License for the detected document is missing. */ UnsupportedByLicense: 13, /** Front side recognition has completed successfully, and recognizer is waiting for the other side to be scanned. */ AwaitingOtherSide: 14, /** Side not scanned. */ NotScanned: 15, /** Detection of the barcode failed. */ BarcodeDetectionFailed: 16 } ); BlinkID.prototype.RecognitionMode = Object.freeze( { /** No recognition performed. */ None: 0, /** Recognition of mrz document (does not include visa and passport) */ MrzId: 1, /** Recognition of visa mrz. */ MrzVisa: 2, /** Recognition of passport mrz. */ MrzPassport: 3, /** Recognition of documents that have face photo on the front. */ PhotoId: 4, /** Detailed document recognition. */ FullRecognition: 5, /** Recognition of barcode document. */ BarcodeId: 6 } ); /** * Defines possible document card rotation positions */ BlinkID.prototype.CardRotation = Object.freeze( { /** Zero degrees */ Zero: 0, /** Clockwise 90 degrees */ Clockwise90: 1, /** Counter clockwise 90 degrees */ CounterClockwise90: 2, /** Upside down */ UpsideDown: 3, /** Card rotation was not performed */ None: 4 } ); /** * Defines possible card orientations */ BlinkID.prototype.CardOrientation = Object.freeze( { /** Horizontal card orientation*/ Horizontal: 0, /** Vertical card orientation*/ Vertical: 1, /** Detection was not performed */ NotAvailable: 2, } ); /** * Defines possible strictness levels for blur are glare detection. */ var StrictnessLevel = Object.freeze( { /** The most strict level for blur are glare detection. */ Strict: 0, /** The default strictness level for blur are glare detection. */ Normal: 1, /** The least strict level for blur are glare detection. */ Relaxed: 2, } ); /** * Defines possible strictness levels for blur are glare detection. */ BlinkID.prototype.StrictnessLevel = StrictnessLevel; /** * Defines possible color and moire statuses determined from scanned image. */ function ImageAnalysisResult(nativeImageAnalysisResult) { /** The color status determined from scanned image. */ this.documentImageColorStatus = nativeImageAnalysisResult.documentImageColorStatus; /** The Moire pattern detection status determined from the scanned image. */ this.documentImageMoireStatus = nativeImageAnalysisResult.documentImageMoireStatus; /** Face detection status determined from the scanned image. */ this.faceDetectionStatus = nativeImageAnalysisResult.faceDetectionStatus; /** Mrz detection status determined from the scanned image. */ this.mrzDetectionStatus = nativeImageAnalysisResult.mrzDetectionStatus; /** Barcode detection status determined from the scanned image. */ this.barcodeDetectionStatus = nativeImageAnalysisResult.barcodeDetectionStatus; /** Orientation determined from the scanned image. */ this.cardOrientation = nativeImageAnalysisResult.cardOrientation; /** Document card rotation positions */ this.cardRotation = nativeImageAnalysisResult.cardRotation; /** RealID detection status determined from the scanned image. */ this.realIdDetectionStatus = nativeImageAnalysisResult.realIdDetectionStatus; /** Indicates if blur was detected on the scanned image. */ this.blurDetected = nativeImageAnalysisResult.blurDetected; /** Indicates if glare was detected on the scanned image. */ this.glareDetected = nativeImageAnalysisResult.glareDetected; } /** * Represents data extracted from the Driver's license. */ function DriverLicenseDetailedInfo(nativeDriverLicenseDetailedInfo) { /** Restrictions to driving privileges for the driver license owner. */ this.restrictions = nativeDriverLicenseDetailedInfo.restrictions; /** Additional privileges granted to the driver license owner. */ this.endorsements = nativeDriverLicenseDetailedInfo.endorsements; /** The type of vehicle the driver license owner has privilege to drive. */ this.vehicleClass = nativeDriverLicenseDetailedInfo.vehicleClass; /** The driver license conditions. */ this.conditions = nativeDriverLicenseDetailedInfo.conditions; /** The additional information on vehicle class. */ this.vehicleClassesInfo = nativeDriverLicenseDetailedInfo.vehicleClassesInfo != null ? new DriverLicenseDetailedInfo(nativeBarcodeResult.driverLicenseDetailedInfo) : null; } /** * The additional information on vehicle class. */ function VehicleClassInfo(nativeVehicleClassesInfo) { /** The type of vehicle the driver license owner has privilege to drive. */ this.vehicleClass = nativeVehicleClassesInfo.vehicleClass; /** The type of driver licence. */ this.licenceType = nativeVehicleClassesInfo.licenceType; /** The date since licence is effective. */ this.effectiveDate = nativeVehicleClassesInfo.effectiveDate; /** The date of expiry of licence. */ this.expiryDate = nativeVehicleClassesInfo.expiryDate; } /** * Defines possible the document country from ClassInfo scanned with BlinkID or BlinkID MultiSide Recognizer */ BlinkID.prototype.Country = Object.freeze( { None: 0, Albania: 1, Algeria: 2, Argentina: 3, Australia: 4, Austria: 5, Azerbaijan: 6, Bahrain: 7, Bangladesh: 8, Belgium: 9, BosniaAndHerzegovina: 10, Brunei: 11, Bulgaria: 12, Cambodia: 13, Canada: 14, Chile: 15, Colombia: 16, CostaRica: 17, Croatia: 18, Cyprus: 19, Czechia: 20, Denmark: 21, DominicanRepublic: 22, Egypt: 23, Estonia: 24, Finland: 25, France: 26, Georgia: 27, Germany: 28, Ghana: 29, Greece: 30, Guatemala: 31, HongKong: 32, Hungary: 33, India: 34, Indonesia: 35, Ireland: 36, Israel: 37, Italy: 38, Jordan: 39, Kazakhstan: 40, Kenya: 41, Kosovo: 42, Kuwait: 43, Latvia: 44, Lithuania: 45, Malaysia: 46, Maldives: 47, Malta: 48, Mauritius: 49, Mexico: 50, Morocco: 51, Netherlands: 52, NewZealand: 53, Nigeria: 54, Pakistan: 55, Panama: 56, Paraguay: 57, Philippines: 58, Poland: 59, Portugal: 60, PuertoRico: 61, Qatar: 62, Romania: 63, Russia: 64, SaudiArabia: 65, Serbia: 66, Singapore: 67, Slovakia: 68, Slovenia: 69, SouthAfrica: 70, Spain: 71, Sweden: 72, Switzerland: 73, Taiwan: 74, Thailand: 75, Tunisia: 76, Turkey: 77, UAE: 78, Uganda: 79, UK: 80, Ukraine: 81, Usa: 82, Vietnam: 83, Brazil: 84, Norway: 85, Oman: 86, Ecuador: 87, ElSalvador: 88, SriLanka: 89, Peru: 90, Uruguay: 91, Bahamas: 92, Bermuda: 93, Bolivia: 94, China: 95, EuropeanUnion: 96, Haiti: 97, Honduras: 98, Iceland: 99, Japan: 100, Luxembourg: 101, Montenegro: 102, Nicaragua: 103, SouthKorea: 104, Venezuela: 105, Afghanistan: 106, AlandIslands: 107, AmericanSamoa: 108, Andorra: 109, Angola: 110, Anguilla: 111, Antarctica: 112, AntiguaAndBarbuda: 113, Armenia: 114, Aruba: 115, BailiwickOfGuernsey: 116, BailiwickOfJersey: 117, Barbados: 118, Belarus: 119, Belize: 120, Benin: 121, Bhutan: 122, BonaireSaintEustatiusAndSaba: 123, Botswana: 124, BouvetIsland: 125, BritishIndianOceanTerritory: 126, BurkinaFaso: 127, Burundi: 128, Cameroon: 129, CapeVerde: 130, CaribbeanNetherlands: 131, CaymanIslands: 132, CentralAfricanRepublic: 133, Chad: 134, ChristmasIsland: 135, CocosIslands: 136, Comoros: 137, Congo: 138, CookIslands: 139, Cuba: 140, Curacao: 141, DemocraticRepublicOfTheCongo: 142, Djibouti: 143, Dominica: 144, EastTimor: 145, EquatorialGuinea: 146, Eritrea: 147, Ethiopia: 148, FalklandIslands: 149, FaroeIslands: 150, FederatedStatesOfMicronesia: 151, Fiji: 152, FrenchGuiana: 153, FrenchPolynesia: 154, FrenchSouthernTerritories: 155, Gabon: 156, Gambia: 157, Gibraltar: 158, Greenland: 159, Grenada: 160, Guadeloupe: 161, Guam: 162, Guinea: 163, GuineaBissau: 164, Guyana: 165, HeardIslandAndMcdonaldIslands: 166, Iran: 167, Iraq: 168, IsleOfMan: 169, IvoryCoast: 170, Jamaica: 171, Kiribati: 172, Kyrgyzstan: 173, Laos: 174, Lebanon: 175, Lesotho: 176, Liberia: 177, Libya: 178, Liechtenstein: 179, Macau: 180, Madagascar: 181, Malawi: 182, Mali: 183, MarshallIslands: 184, Martinique: 185, Mauritania: 186, Mayotte: 187, Moldova: 188, Monaco: 189, Mongolia: 190, Montserrat: 191, Mozambique: 192, Myanmar: 193, Namibia: 194, Nauru: 195, Nepal: 196, NewCaledonia: 197, Niger: 198, Niue: 199, NorfolkIsland: 200, NorthernCyprus: 201, NorthernMarianaIslands: 202, NorthKorea: 203, NorthMacedonia: 204, Palau: 205, Palestine: 206, PapuaNewGuinea: 207, Pitcairn: 208, Reunion: 209, Rwanda: 210, SaintBarthelemy: 211, SaintHelenaAscensionAndTristianDaCunha: 212, SaintKittsAndNevis: 213, SaintLucia: 214, SaintMartin: 215, SaintPierreAndMiquelon: 216, SaintVincentAndTheGrenadines: 217, Samoa: 218, SanMarino: 219, SaoTomeAndPrincipe: 220, Senegal: 221, Seychelles: 222, SierraLeone: 223, SintMaarten: 224, SolomonIslands: 225, Somalia: 226, SouthGeorgiaAndTheSouthSandwichIslands: 227, SouthSudan: 228, Sudan: 229, Suriname: 230, SvalbardAndJanMayen: 231, Eswatini: 232, Syria: 233, Tajikistan: 234, Tanzania: 235, Togo: 236, Tokelau: 237, Tonga: 238, TrinidadAndTobago: 239, Turkmenistan: 240, TurksAndCaicosIslands: 241, Tuvalu: 242, UnitedStatesMinorOutlyingIslands: 243, Uzbekistan: 244, Vanuatu: 245, VaticanCity: 246, VirginIslandsBritish: 247, VirginIslandsUs: 248, WallisAndFutuna: 249, WesternSahara: 250, Yemen: 251, Yugoslavia: 252, Zambia: 253, Zimbabwe: 254, SchengenArea: 255, } ); /** * Defines possible the document country's region from ClassInfo scanned with BlinkID or BlinkID MultiSide Recognizer */ BlinkID.prototype.Region = Object.freeze( { None: 0, Alabama: 1, Alaska: 2, Alberta: 3, Arizona: 4, Arkansas: 5, AustralianCapitalTerritory: 6, BritishColumbia: 7, California: 8, Colorado: 9, Connecticut: 10, Delaware: 11, DistrictOfColumbia: 12, Florida: 13, Georgia: 14, Hawaii: 15, Idaho: 16, Illinois: 17, Indiana: 18, Iowa: 19, Kansas: 20, Kentucky: 21, Louisiana: 22, Maine: 23, Manitoba: 24, Maryland: 25, Massachusetts: 26, Michigan: 27, Minnesota: 28, Mississippi: 29, Missouri: 30, Montana: 31, Nebraska: 32, Nevada: 33, NewBrunswick: 34, NewHampshire: 35, NewJersey: 36, NewMexico: 37, NewSouthWales: 38, NewYork: 39, NorthernTerritory: 40, NorthCarolina: 41, NorthDakota: 42, NovaScotia: 43, Ohio: 44, Oklahoma: 45, Ontario: 46, Oregon: 47, Pennsylvania: 48, Quebec: 49, Queensland: 50, RhodeIsland: 51, Saskatchewan: 52, SouthAustralia: 53, SouthCarolina: 54, SouthDakota: 55, Tasmania: 56, Tennessee: 57, Texas: 58, Utah: 59, Vermont: 60, Victoria: 61, Virginia: 62, Washington: 63, WesternAustralia: 64, WestVirginia: 65, Wisconsin: 66, Wyoming: 67, Yukon: 68, CiudadDeMexico: 69, Jalisco: 70, NewfoundlandAndLabrador: 71, NuevoLeon: 72, BajaCalifornia: 73, Chihuahua: 74, Guanajuato: 75, Guerrero: 76, Mexico: 77, Michoacan: 78, NewYorkCity: 79, Tamaulipas: 80, Veracruz: 81, Chiapas: 82, Coahuila: 83, Durango: 84, GuerreroCocula: 85, GuerreroJuchitan: 86, GuerreroTepecoacuilco: 87, GuerreroTlacoapa: 88, Gujarat: 89, Hidalgo: 90, Karnataka: 91, Kerala: 92, KhyberPakhtunkhwa: 93, MadhyaPradesh: 94, Maharashtra: 95, Morelos: 96, Nayarit: 97, Oaxaca: 98, Puebla: 99, Punjab: 100, Queretaro: 101, SanLuisPotosi: 102, Sinaloa: 103, Sonora: 104, Tabasco: 105, TamilNadu: 106, Yucatan: 107, Zacatecas: 108, Aguascalientes: 109, BajaCaliforniaSur: 110, Campeche: 111, Colima: 112, QuintanaRooBenitoJuarez: 113, QuintanaRoo: 114, QuintanaRooSolidaridad: 115, Tlaxcala: 116, QuintanaRooCozumel: 117, SaoPaolo: 118, RioDeJaneiro: 119, RioGrandeDoSul: 120, NorthwestTerritories: 121, Nunavut: 122, PrinceEdwardIsland: 123, DistritoFederal: 124, Maranhao: 125, MatoGrosso: 126, MinasGerais: 127, Para: 128, Parana: 129, Pernambuco: 130, SantaCatarina: 131, AndhraPradesh: 132, Ceara: 133, Goias: 134, GuerreroAcapulcoDeJuarez: 135, Haryana: 136, Sergipe: 137, Alagos: 138, Bangsamoro: 139 } ); /** * Defines possible the document type from ClassInfo scanned with BlinkID or BlinkID MultiSide Recognizer */ BlinkID.prototype.Type = Object.freeze( { None: 0, ConsularId: 1, Dl: 2, DlPublicServicesCard: 3, EmploymentPass: 4, FinCard: 5, Id: 6, MultipurposeId: 7, MyKad: 8, MyKid: 9, MyPr: 10, MyTentera: 11, PanCard: 12, ProfessionalId: 13, PublicServicesCard: 14, ResidencePermit: 15, ResidentId: 16, TemporaryResidencePermit: 17, VoterId: 18, WorkPermit: 19, iKad: 20, MilitaryId: 21, MyKas: 22, SocialSecurityCard: 23, HealthInsuranceCard: 24, Passport: 25, SPass: 26, AddressCard: 27, AlienId: 28, AlienPassport: 29, GreenCard: 30, MinorsId: 31, PostalId: 32, ProfessionalDl: 33, TaxId: 34, WeaponPermit: 35, Visa: 36, BorderCrossingCard: 37, DriverCard: 38, GlobalEntryCard: 39, Mypolis: 40, NexusCard: 41, PassportCard: 42, ProofOfAgeCard: 43, RefugeeId: 44, TribalId: 45, VeteranId: 46, CitizenshipCertificate: 47, MyNumberCard: 48, ConsularPassport: 49, MinorsPassport: 50, MinorsPublicServicesCard: 51, DrivingPrivilegeCard: 52, AsylumRequest: 53, DriverQualificationCard: 54, ProvisionalDl: 55, RefugeePassport: 56, SpecialId: 57, UniformedServicesId: 58, ImmigrantVisa: 59, ConsularVoterId: 60, TwicCard: 61, ExitEntryPermit: 62, MainlandTravelPermitTaiwan: 63, NbiClearance: 64, ProofOfRegistration: 65, TemporaryProtectionPermit: 66, AfghanCitizenCard: 67, EId: 68, Pass: 69, SisId: 70, AsicCard: 71, BidoonCard: 72, InterimHealthInsuranceCard: 73, NonVoterId: 74, ReciprocalHealthInsuranceCard: 75, VehicleRegistration: 76, EsaadCard: 77 } ); /** * Defines possible the document field type with BlinkID or BlinkID MultiSide Recognizer */ BlinkID.prototype.FieldType = Object.freeze ( { AdditionalAddressInformation: 0, AdditionalNameInformation: 1, AdditionalOptionalAddressInformation: 2, AdditionalPersonalIdNumber: 3, Address: 4, ClassEffectiveDate: 5, ClassExpiryDate: 6, Conditions: 7, DateOfBirth: 8, DateOfExpiry: 9, DateOfIssue: 10, DocumentAdditionalNumber: 11, DocumentOptionalAdditionalNumber: 12, DocumentNumber: 13, Employer: 14, Endorsements: 15, FathersName: 16, FirstName: 17, FullName: 18, IssuingAuthority: 19, LastName: 20, LicenceType: 21, LocalizedName: 22, MaritalStatus: 23, MothersName: 24, Mrz: 25, Nationality: 26, PersonalIdNumber: 27, PlaceOfBirth: 28, Profession: 29, Race: 30, Religion: 31, ResidentialStatus: 32, Restrictions: 33, Sex: 34, VehicleClass: 35, BloodType: 36, Sponsor: 37, VisaType: 38, DocumentSubtype: 39, Remarks: 40, ResidencePermitType: 41, ManufacturingYear: 42, VehicleType: 43, DependentDateOfBirth: 44, DependentSex: 45, DependentDocumentNumber: 46, DependentFullName: 47, EligibilityCategory: 48, SpecificDocumentValidity: 49, VehicleOwner: 50, } ); /** * Defines the type of the extracted image. */ BlinkID.prototype.ImageExtractionType = Object.freeze ( { /** Full document image. */ FullDocument: 0, /** Face image. */ Face: 1, /** Signature image. */ Signature: 2 } ); /** * Enumeration of possible barcode element keys */ BlinkID.prototype.BarcodeElementKey = Object.freeze( { //==============================================================/ //============== 1. DETERMINING BARCODE VERSION ================/ //==============================================================/ /** Mandatory on all driver's licenses. All barcodes which are using 3-track magnetic stripe encoding used in the interest of smoothing a transition from legacy documents shall be designated as "Magnetic". All barcodes which are using compact encoding compliant with ISO/IEC 18013-2 shall be designated as "Compact". All barcodes (majority compliant with Mandatory PDF417 Bar Code of the American Association of Motor Vehicle Administrators (AAMVA Card Design Standard from AAMVA DL/ID-2000 standard to DL/ID-2013 shall be designated as "AAMVA". */ DocumentType: 0, /** Mandatory on all driver's licenses. AAMVA Version Number: This is a decimal value between 0 and 99 that specifies the version level of the PDF417 bar code format. Version "0" and "00" is reserved for bar codes printed to the specification of the American Association of Motor Vehicle Administrators (AAMVA prior to the adoption of the AAMVA DL/ID-2000 standard. - All barcodes compliant with AAMVA DL/ID-2000 standard shall be designated Version "01." - All barcodes compliant with AAMVA Card Design Specification version 1.0, dated 09-2003 shall be designated Version "02." - All barcodes compliant with AAMVA Card Design Specification version 2.0, dated 03-2005 shall be designated Version "03." - All barcodes compliant with AAMVA Card Design Standard version 1.0, dated 07-2009 shall be designated Version "04." - All barcodes compliant with AAMVA Card Design Standard version 1.0, dated 07-2010 shall be designated Version "05." - All barcodes compliant with AAMVA Card Design Standard version 1.0, dated 07-2011 shall be designated Version "06". - All barcodes compliant with AAMVA Card Design Standard version 1.0, dated 06-2012 shall be designated Version "07". - All barcodes compliant with this current AAMVA standard shall be designated "08". Should a need arise requiring major revision to the format, this field provides the means to accommodate additional revision. If the document type is not "AAMVA", this field defines the version number of the given document type's standard. */ StandardVersionNumber: 1, //==============================================================/ //========== 2. PERSONAL DATA KEYS ===========/ //==============================================================/ /** 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: 2, /** Mandatory on all AAMVA, Magnetic and Compact barcodes. First name of the cardholder. */ CustomerFirstName: 3, /** 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: 4, /** Mandatory on all AAMVA, Magnetic and Compact barcodes. Date on which the cardholder was born. (MMDDCCYY format */ DateOfBirth: 5, /** Mandatory on all AAMVA, Magnetic barcodes. Optional on Compact barcodes. Gender of the cardholder. 1 = male, 2 = female. */ Sex: 6, /** Mandatory on AAMVA 02, 03, 04, 05, 06, 07, 08 barcodes. Optional on AAMVA 01, Magnetic and Compact barcodes. Color of cardholder's eyes. (ANSI D-20 codes Code Description BLK Black BLU Blue BRO Brown GRY Gray GRN Green HAZ Hazel MAR Maroon PNK Pink DIC Dichromatic UNK Unknown */ EyeColor: 7, /** 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: 8, /** Mandatory on all AAMVA and Magnetic barcodes. On compact barcodes, use kFullAddress. City portion of the cardholder address. */ AddressCity: 9, /** Mandatory on all AAMVA and Magnetic barcodes. On compact barcodes, use kFullAddress. State portion of the cardholder address. */ AddressJurisdictionCode: 10, /** 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: 11, /** Mandatory on all AAMVA and Magnetic barcodes. Optional on Compact barcodes. Full address of the individual holding the Driver's License or ID. The full address field contains up to four portions, separated with the "," delimiter: Street Address (required , (required if other address portions follow, otherwise optional City (optional , (required if other address portions follow, otherwise optional Jurisdiction Code (optional , (required if other address portions follow, otherwise optional ZIP - Postal Code (optional */ FullAddress: 12, /** Mandatory on AAMVA 02, 03, 04, 05, 06, 07, 08 and Compact barcodes. Optional on AAMVA 01 and Magnetic barcodes. Height of cardholder, either in Inches or in Centimeters. Inches (in: number of inches followed by " in" example: 6'1'' = "73 in" Centimeters (cm: number of centimeters followed by " cm" example: 181 centimeters = "181 cm" */ Height: 13, /** Mandatory on AAMVA 02, 03, 04, 05, 06, 07, 08 and Compact barcodes. Optional on AAMVA 01 and Magnetic barcodes. Height of cardholder in Inches. Example: 5'9'' = "69". */ HeightIn: 14, /** Mandatory on AAMVA 02, 03, 04, 05, 06, 07, 08 Compact barcodes. Optional on AAMVA 01 and Magnetic barcodes. Height of cardholder in Centimeters. Example: 180 Centimeters = "180". */ HeightCm: 15, /** 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: 16, /** Optional on all AAMVA, Magnetic and Compact barcodes. Bald, black, blonde, brown, gray, red/auburn, sandy, white, unknown. If the issuing jurisdiction wishes to abbreviate colors, the three-character codes provided in ANSI D20 must be used. Code Description BAL Bald BLK Black BLN Blond BRO Brown GRY Grey RED Red/Auburn SDY Sandy WHI White UNK Unknown */ HairColor: 17, /** Mandatory on AAMVA 02 barcodes. Optional on AAMVA 01, 03, 04, 05, 06, 07, 08, Magnetic and Compact barcodes. Name Suffix (If jurisdiction participates in systems requiring name suffix (PDPS, CDLIS, etc., the suffix must be collected and displayed on the DL/ID and in the MRT. - JR (Junior - SR (Senior - 1ST or I (First - 2ND or II (Second - 3RD or III (Third - 4TH or IV (Fourth - 5TH or V (Fifth - 6TH or VI (Sixth - 7TH or VII (Seventh - 8TH or VIII (Eighth - 9TH or IX (Ninth */ NameSuffix: 18, /** 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: 19, /** Optional on all AAMVA and Compact barcodes. Other family name by which the cardholder is known. */ AKAFamilyName: 20, /** Optional on all AAMVA and Compact barcodes. Other given name by which the cardholder is known */ AKAGivenName: 21, /** 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: 22, /** Mandatory on AAMVA 02 barcodes. Optional on AAMVA 01, 03, 04, 05, 06, 07, 08, Magnetic and Compact barcodes. Indicates the approximate weight range of the cardholder: 0 = up to 31 kg (up to 70 lbs 1 = 32 – 45 kg (71 – 100 lbs 2 = 46 - 59 kg (101 – 130 lbs 3 = 60 - 70 kg (131 – 160 lbs 4 = 71 - 86 kg (161 – 190 lbs 5 = 87 - 100 kg (191 – 220 lbs 6 = 101 - 113 kg (221 – 250 lbs 7 = 114 - 127 kg (251 – 280 lbs 8 = 128 – 145 kg (281 – 320 lbs 9 = 146+ kg (321+ lbs */ WeightRange: 23, /** Mandatory on AAMVA 02 barcodes. Optional on AAMVA 01, 03, 04, 05, 06, 07, 08, Magnetic and Compact barcodes. Cardholder weight in pounds Example: 185 lb = "185" */ WeightPounds: 24, /** Mandatory on AAMVA 02 barcodes. Optional on AAMVA 01, 03, 04, 05, 06, 07, 08, Magnetic and Compact barcodes. Cardholder weight in kilograms Example: 84 kg = "084" */ WeightKilograms: 25, /** Mandatory on all AAMVA and Compact barcodes. The number assigned or calculated by the issuing authority. */ CustomerIdNumber: 26, /** Mandatory on AAMVA 04, 05, 06, 07, 08 barcodes. Optional on Compact barcodes. A code that indicates whether a field has been truncated (T, has not been truncated (N, or – unknown whether truncated (U. */ FamilyNameTruncation: 27, /** Mandatory on AAMVA 04, 05, 06, 07, 08 barcodes. Optional on Compact barcodes. A code that indicates whether a field has been truncated (T, has not been truncated (N, or – unknown whether truncated (U. */ FirstNameTruncation: 28, /** Mandatory on AAMVA 04, 05, 06, 07, 08 barcodes. A code that indicates whether a field has been truncated (T, has not been truncated (N, or – unknown whether truncated (U. */ MiddleNameTruncation: 29, /** Optional on AAMVA 02, 03, 04, 05, 06, 07, 08 and Compact barcodes. Country and municipality and/or state/province. */ PlaceOfBirth: 30, /** Optional on all AAMVA barcodes. On Compact barcodes, use kFullAddress. Second line of street portion of the cardholder address. */ AddressStreet2: 31, /** Optional on AAMVA 02, 03, 04, 05, 06, 07, 08 and Compact barcodes. Codes for race or ethnicity of the cardholder, as defined in ANSI D20. Race: Code Description AI Alaskan or American Indian (Having Origins in Any of The Original Peoples of North America, and Maintaining Cultural Identification Through Tribal Affiliation of Community Recognition AP Asian or Pacific Islander (Having Origins in Any of the Original Peoples of the Far East, Southeast Asia, or Pacific Islands. This Includes China, India, Japan, Korea, the Philippines Islands, and Samoa BK Black (Having Origins in Any of the Black Racial Groups of Africa W White (Having Origins in Any of The Original Peoples of Europe, North Africa, or the Middle East Ethnicity: Code Description H Hispanic Origin (A Person of Mexican, Puerto Rican, Cuban, Central or South American or Other Spanish Culture or Origin, Regardless of Race O Not of Hispanic Origin (Any Person Other Than Hispanic U Unknown */ RaceEthnicity: 32, /** Optional on AAMVA 01 barcodes. PREFIX to Driver Name. Freeform as defined by issuing jurisdiction. */ NamePrefix: 33, /** 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: 34, /** Optional on AAMVA version 01. Driver Residence Street Address 1. */ ResidenceStreetAddress: 35, /** Optional on AAMVA version 01. Driver Residence Street Address 2. */ ResidenceStreetAddress2: 36, /** Optional on AAMVA version 01. Driver Residence City */ ResidenceCity: 37, /** Optional on AAMVA version 01. Driver Residence Jurisdiction Code. */ ResidenceJurisdictionCode: 38, /** Optional on AAMVA 01 barcodes. Driver Residence Postal Code. */ ResidencePostalCode: 39, /** Optional on AAMVA 01 barcodes. Full residence address of the individual holding the Dri