@trustchex/react-native-sdk 1.500.1 → 1.500.2

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.
@@ -383,7 +383,30 @@ const reconstructMRZCandidates = rawText => {
383
383
  head = fixed + head.slice(9);
384
384
  }
385
385
  }
386
- const optional = '<'.repeat(14);
386
+
387
+ // Recover the REAL optional/personal-number field (line-2 positions
388
+ // 29–42, i.e. 0-indexed 28–41) instead of blanking it. Many passports
389
+ // (and most residence permits) carry a personal number here; blanking it
390
+ // silently drops that data. Stitch any split fragment lines onto this
391
+ // line so the optional window is present, then accept the OCR'd optional
392
+ // ONLY if its own check digit (position 43, 0-indexed 42) validates —
393
+ // that proves the 14 chars were read correctly. If it doesn't validate
394
+ // (garbled/split-filler), fall back to the canonical blank, preserving
395
+ // the previous robustness for the empty-optional case.
396
+ let stitched = ocrLines[i];
397
+ let sj = i + 1;
398
+ while (stitched.length < 44 && sj < ocrLines.length) {
399
+ stitched += ocrLines[sj];
400
+ sj++;
401
+ }
402
+ let optional = '<'.repeat(14);
403
+ if (stitched.length >= 43) {
404
+ const candidateOptional = stitched.slice(28, 42);
405
+ const optionalCheck = stitched[42];
406
+ if (/^[A-Z0-9<]{14}$/.test(candidateOptional) && cd731(candidateOptional) === optionalCheck) {
407
+ optional = candidateOptional;
408
+ }
409
+ }
387
410
  const l2NoComposite = head + optional + cd731(optional);
388
411
  const composite = l2NoComposite.slice(0, 10) + l2NoComposite.slice(13, 20) + l2NoComposite.slice(21, 43);
389
412
  return l2NoComposite + cd731(composite);
@@ -2,4 +2,4 @@
2
2
 
3
3
  // This file is auto-generated. Do not edit manually.
4
4
  // Version is synced from package.json during build.
5
- export const SDK_VERSION = '1.500.1';
5
+ export const SDK_VERSION = '1.500.2';
@@ -1 +1 @@
1
- {"version":3,"file":"mrz.utils.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Libs/mrz.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EA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AAM;2BAyqC7B,MAAM,gBACF,OAAO,KACnB,mBAAmB;0CAwKuB,MAAM,KAAG,mBAAmB;wCA9oC9B,MAAM,KAAG,MAAM,EAAE,EAAE;wCAwpCnB,MAAM,KAAG,MAAM;gCAmDvB,MAAM;;;;;+BA/1BP,MAAM,KAAG,OAAO;iCA4Bd,MAAM,KAAG,MAAM;wCAi1BR,MAAM,GAAG,IAAI,KAAG,MAAM,GAAG,IAAI;kCA7+ChE,MAAM,GAAG,IAAI,GAAG,SAAS,KAC9B,MAAM,GAAG,IAAI;;AA4/ChB,wBAWE"}
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "1.500.1";
1
+ export declare const SDK_VERSION = "1.500.2";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustchex/react-native-sdk",
3
- "version": "1.500.1",
3
+ "version": "1.500.2",
4
4
  "description": "Trustchex mobile app react native SDK for android or ios devices",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -428,7 +428,33 @@ const reconstructMRZCandidates = (rawText: string): string[][] => {
428
428
  head = fixed + head.slice(9);
429
429
  }
430
430
  }
431
- const optional = '<'.repeat(14);
431
+
432
+ // Recover the REAL optional/personal-number field (line-2 positions
433
+ // 29–42, i.e. 0-indexed 28–41) instead of blanking it. Many passports
434
+ // (and most residence permits) carry a personal number here; blanking it
435
+ // silently drops that data. Stitch any split fragment lines onto this
436
+ // line so the optional window is present, then accept the OCR'd optional
437
+ // ONLY if its own check digit (position 43, 0-indexed 42) validates —
438
+ // that proves the 14 chars were read correctly. If it doesn't validate
439
+ // (garbled/split-filler), fall back to the canonical blank, preserving
440
+ // the previous robustness for the empty-optional case.
441
+ let stitched = ocrLines[i];
442
+ let sj = i + 1;
443
+ while (stitched.length < 44 && sj < ocrLines.length) {
444
+ stitched += ocrLines[sj];
445
+ sj++;
446
+ }
447
+ let optional = '<'.repeat(14);
448
+ if (stitched.length >= 43) {
449
+ const candidateOptional = stitched.slice(28, 42);
450
+ const optionalCheck = stitched[42];
451
+ if (
452
+ /^[A-Z0-9<]{14}$/.test(candidateOptional) &&
453
+ cd731(candidateOptional) === optionalCheck
454
+ ) {
455
+ optional = candidateOptional;
456
+ }
457
+ }
432
458
  const l2NoComposite = head + optional + cd731(optional);
433
459
  const composite =
434
460
  l2NoComposite.slice(0, 10) +
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Version is synced from package.json during build.
3
- export const SDK_VERSION = '1.500.1';
3
+ export const SDK_VERSION = '1.500.2';