forked from BlinkID/blinkid-cordova
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblinkIdScanner.js
3888 lines (3167 loc) · 120 KB
/
blinkIdScanner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* 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 'showTimeLimitedLicenseKeyWarning' which indicates
* whether warning for time limited license key will be shown, in format
* {
* ios: 'base64iOSLicense',
* android: 'base64AndroidLicense',
* licensee: String,
* showTimeLimitedLicenseKeyWarning: 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]);
};
// 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 : 1,
/** Recognizer result contains some values, but is incomplete or it contains all values, but some are not uncertain */
uncertain : 2,
/** Recognizer resul contains all required values */
valid : 3
}
);
/**
* 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 = 10000;
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;
}
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 : 1,
/** Identity card */
IdentityCard : 2,
/** Passport */
Passport : 3,
/** Visa */
Visa : 4,
/** US Green Card */
GreenCard : 5,
/** Malaysian PASS type IMM13P */
MalaysianPassIMM13P : 6
}
);
/**
* Possible types of documents scanned with IdBarcodeRecognizer.
*/
BlinkID.prototype.IdBarcodeDocumentType = Object.freeze(
{
/** No document was scanned */
None: 1,
/** AAMVACompliant document was scanned */
AAMVACompliant: 2,
/** Argentina ID document was scanned */
ArgentinaID: 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 Combined Recognizer
*/
BlinkID.prototype.DocumentImageColorStatus = Object.freeze(
{
/** Determining image color status was not performed */
NotAvailable: 1,
/** Black-and-white image scanned */
BlackAndWhite: 2,
/** Color image scanned */
Color: 3
}
);
/**
* Defines possible states of Moire pattern detection.
*/
BlinkID.prototype.ImageAnalysisDetectionStatus = Object.freeze(
{
/** Detection of Moire patterns was not performed. */
NotAvailable: 1,
/** Moire pattern not detected on input image. */
NotDetected: 2,
/** Moire pattern detected on input image. */
Detected: 3
}
);
/**
* Define level of anonymization performed on recognizer result.
*/
var AnonymizationMode = Object.freeze(
{
/** Anonymization will not be performed. */
None: 1,
/** FullDocumentImage is anonymized with black boxes covering sensitive data. */
ImageOnly: 2,
/** Result fields containing sensitive data are removed from result. */
ResultFieldsOnly: 3,
/** This mode is combination of ImageOnly and ResultFieldsOnly modes. */
FullResult: 4
}
);
/**
* 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: 1,
/** Detection of the document failed. */
DetectionFailed: 2,
/** Preprocessing of the input image has failed. */
ImagePreprocessingFailed: 3,
/** Recognizer has inconsistent results. */
StabilityTestFailed: 4,
/** Wrong side of the document has been scanned. */
ScanningWrongSide: 5,
/** Identification of the fields present on the document has failed. */
FieldIdentificationFailed: 6,
/** Mandatory field for the specific document is missing. */
MandatoryFieldMissing: 7,
/** Result contains invalid characters in some of the fields. */
InvalidCharactersFound: 8,
/** Failed to return a requested image. */
ImageReturnFailed: 9,
/** Reading or parsing of the barcode has failed. */
BarcodeRecognitionFailed: 10,
/** Parsing of the MRZ has failed. */
MrzParsingFailed: 11,
/** Document class has been filtered out. */
ClassFiltered: 12,
/** Document currently not supported by the recognizer. */
UnsupportedClass: 13,
/** License for the detected document is missing. */
UnsupportedByLicense: 14
}
);
BlinkID.prototype.RecognitionMode = Object.freeze(
{
/** No recognition performed. */
None: 1,
/** Recognition of mrz document (does not include visa and passport) */
MrzId: 2,
/** Recognition of visa mrz. */
MrzVisa: 3,
/** Recognition of passport mrz. */
MrzPassport: 4,
/** Recognition of documents that have face photo on the front. */
PhotoId: 5,
/** Detailed document recognition. */
FullRecognition: 6
}
);
/**
* Defines possible color and moire statuses determined from scanned image.
*/
function ImageAnalysisResult(nativeImageAnalysisResult) {
/** Whether the image is blurred. */
this.blurred = nativeImageAnalysisResult.blurred;
/** 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;
}
/**
* Defines possible the document country from ClassInfo scanned with BlinkID or BlinkID Combined Recognizer
*/
BlinkID.prototype.Country = Object.freeze(
{
None: 1,
Albania: 2,
Algeria: 3,
Argentina: 4,
Australia: 5,
Austria: 6,
Azerbaijan: 7,
Bahrain: 8,
Bangladesh: 9,
Belgium: 10,
BosniaAndHerzegovina: 11,
Brunei: 12,
Bulgaria: 13,
Cambodia: 14,
Canada: 15,
Chile: 16,
Colombia: 17,
CostaRica: 18,
Croatia: 19,
Cyprus: 20,
Czechia: 21,
Denmark: 22,
DominicanRepublic: 23,
Egypt: 24,
Estonia: 25,
Finland: 26,
France: 27,
Georgia: 28,
Germany: 29,
Ghana: 30,
Greece: 31,
Guatemala: 32,
HongKong: 33,
Hungary: 34,
India: 35,
Indonesia: 36,
Ireland: 37,
Israel: 38,
Italy: 39,
Jordan: 40,
Kazakhstan: 41,
Kenya: 42,
Kosovo: 43,
Kuwait: 44,
Latvia: 45,
Lithuania: 46,
Malaysia: 47,
Maldives: 48,
Malta: 49,
Mauritius: 50,
Mexico: 51,
Morocco: 52,
Netherlands: 53,
NewZealand: 54,
Nigeria: 55,
Pakistan: 56,
Panama: 57,
Paraguay: 58,
Philippines: 59,
Poland: 60,
Portugal: 61,
PuertoRico: 62,
Qatar: 63,
Romania: 64,
Russia: 65,
SaudiArabia: 66,
Serbia: 67,
Singapore: 68,
Slovakia: 69,
Slovenia: 70,
SouthAfrica: 71,
Spain: 72,
Sweden: 73,
Switzerland: 74,
Taiwan: 75,
Thailand: 76,
Tunisia: 77,
Turkey: 78,
UAE: 79,
Uganda: 80,
UK: 81,
Ukraine: 82,
Usa: 83,
Vietnam: 84,
Brazil: 85,
Norway: 86,
Oman: 87,
Ecuador: 88,
ElSalvador: 89,
SriLanka: 90,
Peru: 91,
Uruguay: 92,
Bahamas: 93,
Bermuda: 94,
Bolivia: 95,
China: 96,
EuropeanUnion: 97,
Haiti: 98,
Honduras: 99,
Iceland: 100,
Japan: 101,
Luxembourg: 102,
Montenegro: 103,
Nicaragua: 104,
SouthKorea: 105,
Venezuela: 106
}
);
/**
* Defines possible the document country's region from ClassInfo scanned with BlinkID or BlinkID Combined Recognizer
*/
BlinkID.prototype.Region = Object.freeze(
{
None: 1,
Alabama: 2,
Alaska: 3,
Alberta: 4,
Arizona: 5,
Arkansas: 6,
AustralianCapitalTerritory: 7,
BritishColumbia: 8,
California: 9,
Colorado: 10,
Connecticut: 11,
Delaware: 12,
DistrictOfColumbia: 13,
Florida: 14,
Georgia: 15,
Hawaii: 16,
Idaho: 17,
Illinois: 18,
Indiana: 19,
Iowa: 20,
Kansas: 21,
Kentucky: 22,
Louisiana: 23,
Maine: 24,
Manitoba: 25,
Maryland: 26,
Massachusetts: 27,
Michigan: 28,
Minnesota: 29,
Mississippi: 30,
Missouri: 31,
Montana: 32,
Nebraska: 33,
Nevada: 34,
NewBrunswick: 35,
NewHampshire: 36,
NewJersey: 37,
NewMexico: 38,
NewSouthWales: 39,
NewYork: 40,
NorthernTerritory: 41,
NorthCarolina: 42,
NorthDakota: 43,
NovaScotia: 44,
Ohio: 45,
Oklahoma: 46,
Ontario: 47,
Oregon: 48,
Pennsylvania: 49,
Quebec: 50,
Queensland: 51,
RhodeIsland: 52,
Saskatchewan: 53,
SouthAustralia: 54,
SouthCarolina: 55,
SouthDakota: 56,
Tasmania: 57,
Tennessee: 58,
Texas: 59,
Utah: 60,
Vermont: 61,
Victoria: 62,
Virginia: 63,
Washington: 64,
WesternAustralia: 65,
WestVirginia: 66,
Wisconsin: 67,
Wyoming: 68,
Yukon: 69,
CiudadDeMexico: 70,
Jalisco: 71,
NewfoundlandAndLabrador: 72,
NuevoLeon: 73,
BajaCalifornia: 74,
Chihuahua: 75,
Guanajuato: 76,
Guerrero: 77,
Mexico: 78,
Michoacan: 79,
NewYorkCity: 80,
Tamaulipas: 81,
Veracruz: 82
}
);
/**
* Defines possible the document type from ClassInfo scanned with BlinkID or BlinkID Combined Recognizer
*/
BlinkID.prototype.Type = Object.freeze(
{
None: 1,
ConsularId: 2,
Dl: 3,
DlPublicServicesCard: 4,
EmploymentPass: 5,
FinCard: 6,
Id: 7,
MultipurposeId: 8,
MyKad: 9,
MyKid: 10,
MyPr: 11,
MyTentera: 12,
PanCard: 13,
ProfessionalId: 14,
PublicServicesCard: 15,
ResidencePermit: 16,
ResidentId: 17,
TemporaryResidencePermit: 18,
VoterId: 19,
WorkPermit: 20,
iKad: 21,
MilitaryId: 22,
MyKas: 23,
SocialSecurityCard: 24,
HealthInsuranceCard: 25,
Passport: 26,
SPass: 27,
AddressCard: 28,
AlienId: 29,
AlienPassport: 30,
GreenCard: 31,
MinorsId: 32,
PostalId: 33,
ProfessionalDl: 34,
TaxId: 35,
WeaponPermit: 36
}
);
/** Defines the data extracted from the barcode. */
function BarcodeResult(nativeBarcodeResult) {
/** Type of the barcode scanned */
this.barcodeType = nativeBarcodeResult.barcodeType;
/** Byte array with result of the scan */
this.rawData = nativeBarcodeResult.rawData;
/** Retrieves string content of scanned data */
this.stringData = nativeBarcodeResult.stringData;
/** Flag indicating uncertain scanning data */
this.uncertain = nativeBarcodeResult.uncertain;
/** The first name of the document owner. */
this.firstName = nativeBarcodeResult.firstName;
/** The middle name of the document owner. */
this.middleName = nativeBarcodeResult.middleName;
/** The last name of the document owner. */
this.lastName = nativeBarcodeResult.lastName;
/** The full name of the document owner. */
this.fullName = nativeBarcodeResult.fullName;
/** The additional name information of the document owner. */
this.additionalNameInformation = nativeBarcodeResult.additionalNameInformation;
/** The address of the document owner. */
this.address = nativeBarcodeResult.address;
/** The place of birth of the document owner. */
this.placeOfBirth = nativeBarcodeResult.placeOfBirth;
/** The nationality of the documet owner. */
this.nationality = nativeBarcodeResult.nationality;
/** The race of the document owner. */
this.race = nativeBarcodeResult.race;
/** The religion of the document owner. */
this.religion = nativeBarcodeResult.religion;
/** The profession of the document owner. */
this.profession = nativeBarcodeResult.profession;
/** The marital status of the document owner. */
this.maritalStatus = nativeBarcodeResult.maritalStatus;
/** The residential stauts of the document owner. */
this.residentialStatus = nativeBarcodeResult.residentialStatus;
/** The employer of the document owner. */
this.employer = nativeBarcodeResult.employer;
/** The sex of the document owner. */
this.sex = nativeBarcodeResult.sex;
/** The date of birth of the document owner. */
this.dateOfBirth = nativeBarcodeResult.dateOfBirth != null ? new Date(nativeBarcodeResult.dateOfBirth) : null;
/** The date of issue of the document. */
this.dateOfIssue = nativeBarcodeResult.dateOfIssue.Date != null ? new Date(nativeBarcodeResult.dateOfIssue) : null;
/** The date of expiry of the document. */
this.dateOfExpiry = nativeBarcodeResult.dateOfExpiry.Date != null ? new Date(nativeBarcodeResult.dateOfExpiry) : null;
/** The document number. */
this.documentNumber = nativeBarcodeResult.documentNumber;
/** The personal identification number. */
this.personalIdNumber = nativeBarcodeResult.personalIdNumber;
/** The additional number of the document. */
this.documentAdditionalNumber = nativeBarcodeResult.documentAdditionalNumber;
/** The issuing authority of the document. */
this.issuingAuthority = nativeBarcodeResult.issuingAuthority;
/** The street address portion of the document owner. */
this.street = nativeBarcodeResult.street;
/** The postal code address portion of the document owner. */
this.postalCode = nativeBarcodeResult.postalCode;
/** The city address portion of the document owner. */
this.city = nativeBarcodeResult.city;
/** The jurisdiction code address portion of the document owner. */
this.jurisdiction = nativeBarcodeResult.jurisdiction;
/** The driver license detailed info. */
this.driverLicenseDetailedInfo = nativeBarcodeResult.driverLicenseDetailedInfo != null ? new DriverLicenseDetailedInfo(nativeBarcodeResult.driverLicenseDetailedInfo) : null;
/** Flag that indicates if barcode result is empty */
this.empty = nativeBarcodeResult.empty;
}
function VizResult(nativeVizResult) {
/** The first name of the document owner. */
this.firstName = nativeVizResult.firstName;
/** The last name of the document owner. */
this.lastName = nativeVizResult.lastName;
/** The full name of the document owner. */
this.fullName = nativeVizResult.fullName;
/** The additional name information of the document owner. */
this.additionalNameInformation = nativeVizResult.additionalNameInformation;
/** The localized name of the document owner. */
this.localizedName = nativeVizResult.localizedName;
/** The address of the document owner. */
this.address = nativeVizResult.address;
/** The additional address information of the document owner. */
this.additionalAddressInformation = nativeVizResult.additionalAddressInformation;
/** The place of birth of the document owner. */
this.placeOfBirth = nativeVizResult.placeOfBirth;
/** The nationality of the documet owner. */
this.nationality = nativeVizResult.nationality;
/** The race of the document owner. */
this.race = nativeVizResult.race;
/** The religion of the document owner. */
this.religion = nativeVizResult.religion;
/** The profession of the document owner. */
this.profession = nativeVizResult.profession;
/** The marital status of the document owner. */
this.maritalStatus = nativeVizResult.maritalStatus;
/** The residential stauts of the document owner. */
this.residentialStatus = nativeVizResult.residentialStatus;
/** The employer of the document owner. */
this.employer = nativeVizResult.employer;
/** The sex of the document owner. */
this.sex = nativeVizResult.sex;
/** The date of birth of the document owner. */
this.dateOfBirth = nativeVizResult.dateOfBirth.Date != null ? new Date(nativeVizResult.dateOfBirth) : null;
/** The date of issue of the document. */
this.dateOfIssue = nativeVizResult.dateOfIssue.Date != null ? new Date(nativeVizResult.dateOfIssue) : null;
/** The date of expiry of the document. */
this.dateOfExpiry = nativeVizResult.dateOfExpiry.Date != null ? new Date(nativeVizResult.dateOfExpiry) : null;
/** The document number. */
this.documentNumber = nativeVizResult.documentNumber;
/** The personal identification number. */
this.personalIdNumber = nativeVizResult.personalIdNumber;
/** The additional number of the document. */
this.documentAdditionalNumber = nativeVizResult.documentAdditionalNumber;
/** The additional personal identification number. */
this.additionalPersonalIdNumber = nativeVizResult.additionalPersonalIdNumber;
/** The issuing authority of the document. */
this.issuingAuthority = nativeVizResult.issuingAuthority;
/** The driver license detailed info. */
this.driverLicenseDetailedInfo = nativeVizResult.driverLicenseDetailedInfo != null ? new DriverLicenseDetailedInfo(nativeVizResult.driverLicenseDetailedInfo) : null;
/** The driver license conditions. */
this.conditions = nativeVizResult.conditions;
/** Flag that indicates if barcode result is empty */
this.empty = nativeVizResult.empty;
/** The one more additional number of the document. */
this.documentOptionalAdditionalNumber = nativeVizResult.documentOptionalAdditionalNumber;
}
/**
* Represents data extracted from MRZ (Machine Readable Zone) of Machine Readable Travel Document (MRTD).
*/
function MrzResult(nativeMRZResult) {
/**
* Type of recognized document. It is always one of the values represented by BlinkIDScanner.MRTDDocumentType
*/
this.documentType = nativeMRZResult.documentType;
/** The primary indentifier. If there is more than one component, they are separated with space. */
this.primaryId = nativeMRZResult.primaryId;
/** The secondary identifier. If there is more than one component, they are separated with space. */
this.secondaryId = nativeMRZResult.secondaryId;
/**
* 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.
*/
this.issuer = nativeMRZResult.issuer;
/** Holder's date of birth */
this.dateOfBirth = nativeMRZResult.dateOfBirth != null ? new Date(nativeMRZResult.dateOfBirth) : null;
/**
* The document number. Document number contains up to 9 characters.
* Element does not exist on US Green Card. To see which document was scanned use documentType property.
*/
this.documentNumber = nativeMRZResult.documentNumber;
/**
* The nationality of the 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.
*/
this.nationality = nativeMRZResult.nationality;
/**
* The gender of the card holder. Gender is specified by use of the single initial, capital letter F for female,
* M for male or <code><</code> for unspecified.
*/
this.gender = nativeMRZResult.gender;
/**
* 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 <code><</code>.
*/
this.documentCode = nativeMRZResult.documentCode;
/** The date of expiry */
this.dateOfExpiry = nativeMRZResult.dateOfExpiry != null ? new Date(nativeMRZResult.dateOfExpiry) : null;
/**
* The first optional data. Contains empty string if not available.
* Element does not exist on US Green Card. To see which document was scanned use the documentType property.
*/
this.opt1 = nativeMRZResult.opt1;
/**
* The second optional data. Contains empty string if not available.
* Element does not exist on Passports and Visas. To see which document was scanned use the documentType property.
*/
this.opt2 = nativeMRZResult.opt2;
/**
* The alien number. Contains empty string if not available.
* Exists only on US Green Cards. To see which document was scanned use the documentType property.
*/
this.alienNumber = nativeMRZResult.alienNumber;
/**
* The application receipt number. Contains empty string if not available.
* Exists only on US Green Cards. To see which document was scanned use the documentType property.
*/
this.applicationReceiptNumber = nativeMRZResult.applicationReceiptNumber;
/**
* The immigrant case number. Contains empty string if not available.
* Exists only on US Green Cards. To see which document was scanned use the documentType property.
*/
this.immigrantCaseNumber = nativeMRZResult.immigrantCaseNumber;
/**
* The entire Machine Readable Zone text from ID. This text is usually used for parsing
* other elements.
* NOTE: This string is available only if OCR result was parsed successfully.
*/
this.mrzText = nativeMRZResult.mrzText;
/** true if Machine Readable Zone has been parsed, false otherwise. */
this.mrzParsed = nativeMRZResult.mrzParsed;
/** true if all check digits inside MRZ are correct, false otherwise. */
this.mrzVerified = nativeMRZResult.mrzVerified;
/**
* Sanitized field opt1
*/
this.sanitizedOpt1 = nativeMRZResult.sanitizedOpt1;
/**
* Sanitized field opt2
*/
this.sanitizedOpt2 = nativeMRZResult.sanitizedOpt2;
/**
* Sanitized field nationality
*/
this.sanitizedNationality = nativeMRZResult.sanitizedNationality;
/**
* Sanitized field issuer
*/
this.sanitizedIssuer = nativeMRZResult.sanitizedIssuer;
/**
* Sanitized document code
*/
this.sanitizedDocumentCode = nativeMRZResult.sanitizedDocumentCode;
/**
* Sanitized document number
*/
this.sanitizedDocumentNumber = nativeMRZResult.sanitizedDocumentNumber;
/**
* The current age of the document owner in years. It is calculated difference
* between now and date of birth. Now is current time on the device.
* @return current age of the document owner in years or -1 if date of birth is unknown.
*/
this.age = nativeMRZResult.age;
}
/**
* Result of the data matching algorithm for scanned parts/sides of the document.
*/
var DataMatchResult = Object.freeze(
{
/** Data matching has not been performed. */
NotPerformed : 1,
/** Data does not match. */
Failed : 2,
/** Data match. */
Success : 3
}
);
/**
* Possible values for Document Data Match Result field.
*/
BlinkID.prototype.DataMatchResult = DataMatchResult
/** Possible supported detectors for documents containing face image */
var DocumentFaceDetectorType = Object.freeze(
{
/** Uses document detector for TD1 size identity cards */
TD1 : 1,
/** Uses document detector for TD2 size identity cards */
TD2 : 2,
/** Uses MRTD detector for detecting documents with MRZ */
PassportsAndVisas : 3
}
);
/**
* Possible values for DocumentFaceDetectorType field.
*/
BlinkID.prototype.DocumentFaceDetectorType = DocumentFaceDetectorType;
/**
* Extension factors relative to corresponding dimension of the full image. For example,
* upFactor and downFactor define extensions relative to image height, e.g.
* when upFactor is 0.5, upper image boundary will be extended for half of image's full
* height.
*/
function ImageExtensionFactors() {
/** image extension factor relative to full image height in UP direction. */
this.upFactor = 0.0;
/** image extension factor relative to full image height in RIGHT direction. */
this.rightFactor = 0.0;
/** image extension factor relative to full image height in DOWN direction. */
this.downFactor = 0.0;
/** image extension factor relative to full image height in LEFT direction. */
this.leftFactor = 0.0;