petrus-react-native 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/PetrusReactNative.podspec +20 -0
  2. package/android/build.gradle +64 -0
  3. package/android/src/main/AndroidManifest.xml +4 -0
  4. package/android/src/main/java/com/petrusreactnative/PDF417ScanSession.kt +86 -0
  5. package/android/src/main/java/com/petrusreactnative/PassportScanSession.kt +137 -0
  6. package/android/src/main/java/com/petrusreactnative/PetrusCameraView.kt +146 -0
  7. package/android/src/main/java/com/petrusreactnative/PetrusCameraViewManager.kt +93 -0
  8. package/android/src/main/java/com/petrusreactnative/PetrusOverlayView.kt +87 -0
  9. package/android/src/main/java/com/petrusreactnative/PetrusReactNativeModule.kt +253 -0
  10. package/android/src/main/java/com/petrusreactnative/PetrusReactNativePackage.kt +38 -0
  11. package/android/src/main/java/com/petrusreactnative/VehicleRegistrationScanSession.kt +119 -0
  12. package/android/src/main/java/com/petrusreactnative/events/CapturedEvent.kt +30 -0
  13. package/android/src/main/java/com/petrusreactnative/events/DocumentDetectedEvent.kt +49 -0
  14. package/android/src/main/java/com/petrusreactnative/events/FrameMetadataEvent.kt +24 -0
  15. package/android/src/main/java/com/petrusreactnative/mrz/PassportResultMapping.kt +54 -0
  16. package/android/src/main/java/com/petrusreactnative/ocr/OCRResultMapping.kt +52 -0
  17. package/android/src/main/java/com/petrusreactnative/pdf417/SouthAfricanDriversLicenseResultMapping.kt +80 -0
  18. package/android/src/main/java/com/petrusreactnative/sa/SouthAfricanIDResultMapping.kt +50 -0
  19. package/android/src/main/java/com/petrusreactnative/vehicle/VehicleRegistrationResultMapping.kt +72 -0
  20. package/ios/PetrusReactNative.h +5 -0
  21. package/ios/PetrusReactNative.mm +21 -0
  22. package/lib/module/NativePetrusReactNative.js +5 -0
  23. package/lib/module/NativePetrusReactNative.js.map +1 -0
  24. package/lib/module/PetrusCameraView.js +6 -0
  25. package/lib/module/PetrusCameraView.js.map +1 -0
  26. package/lib/module/PetrusCameraView.native.js +24 -0
  27. package/lib/module/PetrusCameraView.native.js.map +1 -0
  28. package/lib/module/PetrusCameraViewNativeComponent.ts +47 -0
  29. package/lib/module/cameraPermissions.js +9 -0
  30. package/lib/module/cameraPermissions.js.map +1 -0
  31. package/lib/module/cameraPermissions.native.js +10 -0
  32. package/lib/module/cameraPermissions.native.js.map +1 -0
  33. package/lib/module/getPipelineVersion.js +6 -0
  34. package/lib/module/getPipelineVersion.js.map +1 -0
  35. package/lib/module/getPipelineVersion.native.js +7 -0
  36. package/lib/module/getPipelineVersion.native.js.map +1 -0
  37. package/lib/module/index.js +45 -0
  38. package/lib/module/index.js.map +1 -0
  39. package/lib/module/package.json +1 -0
  40. package/lib/module/parseMRZ.js +6 -0
  41. package/lib/module/parseMRZ.js.map +1 -0
  42. package/lib/module/parseMRZ.native.js +12 -0
  43. package/lib/module/parseMRZ.native.js.map +1 -0
  44. package/lib/module/parseSouthAfricanDriversLicense.js +6 -0
  45. package/lib/module/parseSouthAfricanDriversLicense.js.map +1 -0
  46. package/lib/module/parseSouthAfricanDriversLicense.native.js +12 -0
  47. package/lib/module/parseSouthAfricanDriversLicense.native.js.map +1 -0
  48. package/lib/module/parseSouthAfricanID.js +6 -0
  49. package/lib/module/parseSouthAfricanID.js.map +1 -0
  50. package/lib/module/parseSouthAfricanID.native.js +8 -0
  51. package/lib/module/parseSouthAfricanID.native.js.map +1 -0
  52. package/lib/module/parseVehicleRegistration.js +6 -0
  53. package/lib/module/parseVehicleRegistration.js.map +1 -0
  54. package/lib/module/parseVehicleRegistration.native.js +8 -0
  55. package/lib/module/parseVehicleRegistration.native.js.map +1 -0
  56. package/lib/module/recognizeText.js +6 -0
  57. package/lib/module/recognizeText.js.map +1 -0
  58. package/lib/module/recognizeText.native.js +8 -0
  59. package/lib/module/recognizeText.native.js.map +1 -0
  60. package/lib/module/scanPDF417.js +6 -0
  61. package/lib/module/scanPDF417.js.map +1 -0
  62. package/lib/module/scanPDF417.native.js +8 -0
  63. package/lib/module/scanPDF417.native.js.map +1 -0
  64. package/lib/module/scanPassport.js +6 -0
  65. package/lib/module/scanPassport.js.map +1 -0
  66. package/lib/module/scanPassport.native.js +13 -0
  67. package/lib/module/scanPassport.native.js.map +1 -0
  68. package/lib/module/scanSouthAfricanDriversLicense.js +6 -0
  69. package/lib/module/scanSouthAfricanDriversLicense.js.map +1 -0
  70. package/lib/module/scanSouthAfricanDriversLicense.native.js +12 -0
  71. package/lib/module/scanSouthAfricanDriversLicense.native.js.map +1 -0
  72. package/lib/module/scanVehicleRegistration.js +6 -0
  73. package/lib/module/scanVehicleRegistration.js.map +1 -0
  74. package/lib/module/scanVehicleRegistration.native.js +13 -0
  75. package/lib/module/scanVehicleRegistration.native.js.map +1 -0
  76. package/lib/module/types.js +2 -0
  77. package/lib/module/types.js.map +1 -0
  78. package/lib/typescript/package.json +1 -0
  79. package/lib/typescript/src/NativePetrusReactNative.d.ts +271 -0
  80. package/lib/typescript/src/NativePetrusReactNative.d.ts.map +1 -0
  81. package/lib/typescript/src/PetrusCameraView.d.ts +10 -0
  82. package/lib/typescript/src/PetrusCameraView.d.ts.map +1 -0
  83. package/lib/typescript/src/PetrusCameraView.native.d.ts +4 -0
  84. package/lib/typescript/src/PetrusCameraView.native.d.ts.map +1 -0
  85. package/lib/typescript/src/PetrusCameraViewNativeComponent.d.ts +38 -0
  86. package/lib/typescript/src/PetrusCameraViewNativeComponent.d.ts.map +1 -0
  87. package/lib/typescript/src/cameraPermissions.d.ts +4 -0
  88. package/lib/typescript/src/cameraPermissions.d.ts.map +1 -0
  89. package/lib/typescript/src/cameraPermissions.native.d.ts +4 -0
  90. package/lib/typescript/src/cameraPermissions.native.d.ts.map +1 -0
  91. package/lib/typescript/src/getPipelineVersion.d.ts +2 -0
  92. package/lib/typescript/src/getPipelineVersion.d.ts.map +1 -0
  93. package/lib/typescript/src/getPipelineVersion.native.d.ts +2 -0
  94. package/lib/typescript/src/getPipelineVersion.native.d.ts.map +1 -0
  95. package/lib/typescript/src/index.d.ts +45 -0
  96. package/lib/typescript/src/index.d.ts.map +1 -0
  97. package/lib/typescript/src/parseMRZ.d.ts +3 -0
  98. package/lib/typescript/src/parseMRZ.d.ts.map +1 -0
  99. package/lib/typescript/src/parseMRZ.native.d.ts +8 -0
  100. package/lib/typescript/src/parseMRZ.native.d.ts.map +1 -0
  101. package/lib/typescript/src/parseSouthAfricanDriversLicense.d.ts +3 -0
  102. package/lib/typescript/src/parseSouthAfricanDriversLicense.d.ts.map +1 -0
  103. package/lib/typescript/src/parseSouthAfricanDriversLicense.native.d.ts +8 -0
  104. package/lib/typescript/src/parseSouthAfricanDriversLicense.native.d.ts.map +1 -0
  105. package/lib/typescript/src/parseSouthAfricanID.d.ts +3 -0
  106. package/lib/typescript/src/parseSouthAfricanID.d.ts.map +1 -0
  107. package/lib/typescript/src/parseSouthAfricanID.native.d.ts +4 -0
  108. package/lib/typescript/src/parseSouthAfricanID.native.d.ts.map +1 -0
  109. package/lib/typescript/src/parseVehicleRegistration.d.ts +3 -0
  110. package/lib/typescript/src/parseVehicleRegistration.d.ts.map +1 -0
  111. package/lib/typescript/src/parseVehicleRegistration.native.d.ts +4 -0
  112. package/lib/typescript/src/parseVehicleRegistration.native.d.ts.map +1 -0
  113. package/lib/typescript/src/recognizeText.d.ts +3 -0
  114. package/lib/typescript/src/recognizeText.d.ts.map +1 -0
  115. package/lib/typescript/src/recognizeText.native.d.ts +4 -0
  116. package/lib/typescript/src/recognizeText.native.d.ts.map +1 -0
  117. package/lib/typescript/src/scanPDF417.d.ts +3 -0
  118. package/lib/typescript/src/scanPDF417.d.ts.map +1 -0
  119. package/lib/typescript/src/scanPDF417.native.d.ts +4 -0
  120. package/lib/typescript/src/scanPDF417.native.d.ts.map +1 -0
  121. package/lib/typescript/src/scanPassport.d.ts +3 -0
  122. package/lib/typescript/src/scanPassport.d.ts.map +1 -0
  123. package/lib/typescript/src/scanPassport.native.d.ts +9 -0
  124. package/lib/typescript/src/scanPassport.native.d.ts.map +1 -0
  125. package/lib/typescript/src/scanSouthAfricanDriversLicense.d.ts +3 -0
  126. package/lib/typescript/src/scanSouthAfricanDriversLicense.d.ts.map +1 -0
  127. package/lib/typescript/src/scanSouthAfricanDriversLicense.native.d.ts +8 -0
  128. package/lib/typescript/src/scanSouthAfricanDriversLicense.native.d.ts.map +1 -0
  129. package/lib/typescript/src/scanVehicleRegistration.d.ts +3 -0
  130. package/lib/typescript/src/scanVehicleRegistration.d.ts.map +1 -0
  131. package/lib/typescript/src/scanVehicleRegistration.native.d.ts +9 -0
  132. package/lib/typescript/src/scanVehicleRegistration.native.d.ts.map +1 -0
  133. package/lib/typescript/src/types.d.ts +237 -0
  134. package/lib/typescript/src/types.d.ts.map +1 -0
  135. package/package.json +124 -0
  136. package/src/NativePetrusReactNative.ts +303 -0
  137. package/src/PetrusCameraView.native.tsx +44 -0
  138. package/src/PetrusCameraView.tsx +19 -0
  139. package/src/PetrusCameraViewNativeComponent.ts +47 -0
  140. package/src/cameraPermissions.native.tsx +10 -0
  141. package/src/cameraPermissions.tsx +13 -0
  142. package/src/getPipelineVersion.native.tsx +5 -0
  143. package/src/getPipelineVersion.tsx +5 -0
  144. package/src/index.tsx +83 -0
  145. package/src/parseMRZ.native.tsx +11 -0
  146. package/src/parseMRZ.tsx +7 -0
  147. package/src/parseSouthAfricanDriversLicense.native.tsx +13 -0
  148. package/src/parseSouthAfricanDriversLicense.tsx +9 -0
  149. package/src/parseSouthAfricanID.native.tsx +7 -0
  150. package/src/parseSouthAfricanID.tsx +7 -0
  151. package/src/parseVehicleRegistration.native.tsx +9 -0
  152. package/src/parseVehicleRegistration.tsx +9 -0
  153. package/src/recognizeText.native.tsx +7 -0
  154. package/src/recognizeText.tsx +7 -0
  155. package/src/scanPDF417.native.tsx +7 -0
  156. package/src/scanPDF417.tsx +7 -0
  157. package/src/scanPassport.native.tsx +12 -0
  158. package/src/scanPassport.tsx +7 -0
  159. package/src/scanSouthAfricanDriversLicense.native.tsx +11 -0
  160. package/src/scanSouthAfricanDriversLicense.tsx +7 -0
  161. package/src/scanVehicleRegistration.native.tsx +12 -0
  162. package/src/scanVehicleRegistration.tsx +7 -0
  163. package/src/types.ts +272 -0
@@ -0,0 +1,7 @@
1
+ import type { PassportResult } from './types';
2
+
3
+ export function scanPassport(): Promise<PassportResult> {
4
+ return Promise.reject(
5
+ new Error("'petrus-react-native' is only supported on native platforms.")
6
+ );
7
+ }
@@ -0,0 +1,11 @@
1
+ import PetrusReactNative from './NativePetrusReactNative';
2
+ import type { SouthAfricanDriversLicenseResult } from './types';
3
+
4
+ /**
5
+ * Opens a headless (no preview UI) camera session, scans for a PDF417 barcode, and
6
+ * parses it as an SA driver's licence in one call. Rejects on timeout (~20s) or if
7
+ * no Activity is available.
8
+ */
9
+ export function scanSouthAfricanDriversLicense(): Promise<SouthAfricanDriversLicenseResult> {
10
+ return PetrusReactNative.scanSouthAfricanDriversLicense();
11
+ }
@@ -0,0 +1,7 @@
1
+ import type { SouthAfricanDriversLicenseResult } from './types';
2
+
3
+ export function scanSouthAfricanDriversLicense(): Promise<SouthAfricanDriversLicenseResult> {
4
+ return Promise.reject(
5
+ new Error("'petrus-react-native' is only supported on native platforms.")
6
+ );
7
+ }
@@ -0,0 +1,12 @@
1
+ import PetrusReactNative from './NativePetrusReactNative';
2
+ import type { VehicleRegistrationResult } from './types';
3
+
4
+ /**
5
+ * Opens a headless (no preview UI) camera session, runs OCR on frames, and parses
6
+ * each result as a vehicle registration document -- stops once a frame yields a
7
+ * registration number or VIN. Rejects on timeout (~20s) or if no Activity is
8
+ * available.
9
+ */
10
+ export function scanVehicleRegistration(): Promise<VehicleRegistrationResult> {
11
+ return PetrusReactNative.scanVehicleRegistration();
12
+ }
@@ -0,0 +1,7 @@
1
+ import type { VehicleRegistrationResult } from './types';
2
+
3
+ export function scanVehicleRegistration(): Promise<VehicleRegistrationResult> {
4
+ return Promise.reject(
5
+ new Error("'petrus-react-native' is only supported on native platforms.")
6
+ );
7
+ }
package/src/types.ts ADDED
@@ -0,0 +1,272 @@
1
+ export type PetrusCameraPermissionStatus = 'granted' | 'denied' | 'blocked';
2
+
3
+ export interface PetrusFrameMetadata {
4
+ width: number;
5
+ height: number;
6
+ rotation: number;
7
+ /** Epoch milliseconds. */
8
+ timestamp: number;
9
+ }
10
+
11
+ export interface PetrusPoint2D {
12
+ x: number;
13
+ y: number;
14
+ }
15
+
16
+ /**
17
+ * Corners are normalized (0..1) relative to frameWidth x frameHeight -- the analysis
18
+ * frame's own (unrotated) buffer space, before rotationDegrees is applied.
19
+ */
20
+ export interface PetrusDocumentCorners {
21
+ topLeft: PetrusPoint2D;
22
+ topRight: PetrusPoint2D;
23
+ bottomRight: PetrusPoint2D;
24
+ bottomLeft: PetrusPoint2D;
25
+ frameWidth: number;
26
+ frameHeight: number;
27
+ rotationDegrees: number;
28
+ }
29
+
30
+ export interface PetrusDocumentDetectedEvent {
31
+ detected: boolean;
32
+ isStable: boolean;
33
+ stableDurationMs: number;
34
+ confidence: number;
35
+ /** Meaningless (zeroed) when `detected` is false -- check `detected` first. */
36
+ corners: PetrusDocumentCorners;
37
+ }
38
+
39
+ export interface PetrusCapturedEvent {
40
+ corners: PetrusDocumentCorners;
41
+ confidence: number;
42
+ /** Epoch milliseconds. */
43
+ timestamp: number;
44
+ }
45
+
46
+ export interface OCRBoundingBox {
47
+ left: number;
48
+ top: number;
49
+ right: number;
50
+ bottom: number;
51
+ }
52
+
53
+ /** One recognized word (ML Kit's finest granularity). */
54
+ export interface OCRWord {
55
+ text: string;
56
+ boundingBox: OCRBoundingBox;
57
+ /** [0, 1]; may read 0 on older Play Services versions -- see README. */
58
+ confidence: number;
59
+ }
60
+
61
+ export interface OCRLine {
62
+ text: string;
63
+ boundingBox: OCRBoundingBox;
64
+ /** [0, 1]; may read 0 on older Play Services versions -- see README. */
65
+ confidence: number;
66
+ words: OCRWord[];
67
+ }
68
+
69
+ /** ML Kit reports no confidence at block level -- only OCRLine/OCRWord carry one. */
70
+ export interface OCRBlock {
71
+ text: string;
72
+ boundingBox: OCRBoundingBox;
73
+ lines: OCRLine[];
74
+ }
75
+
76
+ /**
77
+ * Raw OCR output: text, geometry, confidence. Deliberately has no notion of document
78
+ * type or fields -- SA ID/driver's licence/MRZ/PDF417 parsing all consume this from
79
+ * outside; none of that logic lives in petrus-react-native or petrus-core.
80
+ */
81
+ export interface OCRResult {
82
+ fullText: string;
83
+ /** Average confidence across all recognized words; 0 if none. */
84
+ confidence: number;
85
+ blocks: OCRBlock[];
86
+ }
87
+
88
+ export type SouthAfricanGender = 'male' | 'female';
89
+
90
+ /** 0 = SA citizen, 1 = permanent resident, 2 = refugee; anything else is 'unknown'. */
91
+ export type SouthAfricanCitizenship =
92
+ | 'citizen'
93
+ | 'permanent_resident'
94
+ | 'refugee'
95
+ | 'unknown';
96
+
97
+ export interface SouthAfricanDateOfBirth {
98
+ year: number;
99
+ month: number;
100
+ day: number;
101
+ }
102
+
103
+ export interface SouthAfricanIDValidation {
104
+ isValid: boolean;
105
+ hasValidChecksum: boolean;
106
+ hasValidDateOfBirth: boolean;
107
+ hasValidCitizenshipDigit: boolean;
108
+ }
109
+
110
+ /**
111
+ * `idNumber` is the best 13-digit candidate found in the text (digit-lookalike-
112
+ * corrected), even if it failed validation -- `isValid`/`validation` say whether it
113
+ * actually checks out. `dateOfBirth`/`gender`/`citizenship` are derived straight
114
+ * from `idNumber`'s digits regardless of checksum validity. All fields are `null`
115
+ * when no 13-digit candidate was found in the text at all.
116
+ */
117
+ export interface SouthAfricanIDResult {
118
+ idNumber: string | null;
119
+ isValid: boolean;
120
+ dateOfBirth: SouthAfricanDateOfBirth | null;
121
+ gender: SouthAfricanGender | null;
122
+ citizenship: SouthAfricanCitizenship | null;
123
+ validation: SouthAfricanIDValidation | null;
124
+ }
125
+
126
+ /**
127
+ * Raw output of scanning a PDF417 barcode -- no SA-specific interpretation. SA
128
+ * driver's licence barcodes carry binary (RSA-"encrypted") data, so `rawText` is
129
+ * rarely human-readable for them; pass `rawDataBase64` to
130
+ * parseSouthAfricanDriversLicense instead.
131
+ */
132
+ export interface PDF417ScanResult {
133
+ /** Base64-encoded raw decoded barcode bytes. */
134
+ rawDataBase64: string;
135
+ rawText: string;
136
+ }
137
+
138
+ /** Which reverse-engineered generation of the SA driver's licence barcode format was detected. */
139
+ export type SouthAfricanDriversLicenseVersion = 'v1' | 'v2';
140
+
141
+ export interface CalendarDate {
142
+ year: number;
143
+ month: number;
144
+ day: number;
145
+ }
146
+
147
+ /**
148
+ * Structured SA driver's licence fields decoded from a PDF417 barcode. See the
149
+ * README's confidence note on this reverse-engineered format before relying on
150
+ * these fields in production -- `parseWarnings` flags anything that looked
151
+ * malformed or implausible while parsing *this* barcode specifically.
152
+ */
153
+ export interface SouthAfricanDriversLicenseResult {
154
+ version: SouthAfricanDriversLicenseVersion;
155
+ surname: string;
156
+ initials: string;
157
+ idNumber: string | null;
158
+ /** Reuses the same SA ID validation used by parseSouthAfricanID. */
159
+ idNumberValidation: SouthAfricanIDValidation | null;
160
+ licenseNumber: string;
161
+ vehicleCodes: string[];
162
+ vehicleRestrictions: string[];
163
+ prdpCode: string | null;
164
+ idCountryOfIssue: string;
165
+ licenseCountryOfIssue: string;
166
+ gender: SouthAfricanGender | null;
167
+ dateOfBirth: CalendarDate | null;
168
+ licenseIssueNumber: number | null;
169
+ licenseValidFrom: CalendarDate | null;
170
+ licenseValidTo: CalendarDate | null;
171
+ prdpExpiry: CalendarDate | null;
172
+ driverRestrictionCodes: number[];
173
+ parseWarnings: string[];
174
+ }
175
+
176
+ /** Which NATIS/eNaTIS vehicle document type was detected -- see the README's confidence note. */
177
+ export type VehicleDocumentType =
178
+ | 'registration_certificate'
179
+ | 'license_disc'
180
+ | 'notification_of_change'
181
+ | 'roadworthy_certificate'
182
+ | 'unknown';
183
+
184
+ /**
185
+ * ISO 3779 structural checks (universal) plus an optional North American
186
+ * (SAE J853/NHTSA) position-9 check digit signal -- NOT universal, since South
187
+ * Africa isn't a North-American-format vehicle market. `null` when the VIN wasn't
188
+ * structurally valid to begin with (no check digit to evaluate).
189
+ */
190
+ export interface VINValidation {
191
+ hasValidLength: boolean;
192
+ hasValidCharacterSet: boolean;
193
+ isStructurallyValid: boolean;
194
+ northAmericanCheckDigitValid: boolean | null;
195
+ }
196
+
197
+ export interface VehicleRegistrationValidation {
198
+ isValid: boolean;
199
+ hasStructurallyValidVin: boolean;
200
+ hasPlausibleRegistrationNumber: boolean;
201
+ hasPlausibleYearModel: boolean;
202
+ }
203
+
204
+ /**
205
+ * Structured fields parsed from a NATIS/eNaTIS vehicle registration document. See
206
+ * the README's confidence note on label wording before relying on these fields in
207
+ * production -- `parseWarnings` flags anything that looked malformed or
208
+ * implausible while parsing *this* document specifically. `ownerIdNumber`/
209
+ * `ownerIdValidation` are a bonus cross-check using the same SA ID validation as
210
+ * parseSouthAfricanID, when an ID number happens to appear near the owner's name.
211
+ */
212
+ export interface VehicleRegistrationResult {
213
+ documentType: VehicleDocumentType;
214
+ registrationNumber: string | null;
215
+ vin: string | null;
216
+ vinValidation: VINValidation | null;
217
+ engineNumber: string | null;
218
+ make: string | null;
219
+ model: string | null;
220
+ yearModel: number | null;
221
+ ownerName: string | null;
222
+ ownerIdNumber: string | null;
223
+ ownerIdValidation: SouthAfricanIDValidation | null;
224
+ validation: VehicleRegistrationValidation;
225
+ parseWarnings: string[];
226
+ }
227
+
228
+ /** MRZ sex marker. `'unspecified'` covers ICAO 9303's `<` (unspecified) value, not just an OCR failure. */
229
+ export type MRZSex = 'male' | 'female' | 'unspecified';
230
+
231
+ /**
232
+ * A date decoded from an MRZ's 2-digit-year `YYMMDD` field, with the century
233
+ * resolved by `parseMRZ`/`scanPassport` -- ICAO 9303 doesn't itself specify a
234
+ * resolution rule; see the README's confidence note.
235
+ */
236
+ export interface MRZDate {
237
+ year: number;
238
+ month: number;
239
+ day: number;
240
+ twoDigitYear: number;
241
+ }
242
+
243
+ export interface MRZValidation {
244
+ isValid: boolean;
245
+ passportNumberCheckValid: boolean;
246
+ dateOfBirthCheckValid: boolean;
247
+ expiryDateCheckValid: boolean;
248
+ personalNumberCheckValid: boolean;
249
+ compositeCheckValid: boolean;
250
+ }
251
+
252
+ /**
253
+ * Structured fields parsed from an ICAO 9303 TD3 (passport) MRZ. `parseWarnings`
254
+ * flags anything that looked malformed or implausible while parsing *this*
255
+ * MRZ -- including "no MRZ found at all", in which case every `string` field is
256
+ * `""` and the date/personalNumber fields are `null` (this function never
257
+ * throws/returns null -- see the README's confidence note).
258
+ */
259
+ export interface PassportResult {
260
+ documentCode: string;
261
+ issuingCountry: string;
262
+ surname: string;
263
+ givenNames: string;
264
+ passportNumber: string;
265
+ nationality: string;
266
+ dateOfBirth: MRZDate | null;
267
+ sex: MRZSex;
268
+ dateOfExpiry: MRZDate | null;
269
+ personalNumber: string | null;
270
+ validation: MRZValidation;
271
+ parseWarnings: string[];
272
+ }