@regulaforensics/react-native-document-reader-api 6.4.0 → 6.5.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.
- package/RNDocumentReaderApi.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/regula/documentreader/Helpers.java +1 -1
- package/android/src/main/java/com/regula/documentreader/JSONConstructor.java +24 -47
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.java +12 -14
- package/android/src/main/java/com/regula/documentreader/RegulaConfig.java +46 -6
- package/core/.gitkeep +0 -0
- package/example/App.js +168 -168
- package/example/metro.config.js +7 -8
- package/example/package.json +2 -2
- package/index.d.ts +3410 -3289
- package/index.js +3256 -3177
- package/ios/RGLWJSONConstructor.h +1 -0
- package/ios/RGLWJSONConstructor.m +22 -3
- package/ios/RNRegulaDocumentReader.m +8 -8
- package/ios/RegulaConfig.m +37 -6
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -49,7 +49,7 @@ dependencies {
|
|
|
49
49
|
//noinspection GradleDynamicVersion
|
|
50
50
|
implementation 'com.facebook.react:react-native:+'
|
|
51
51
|
//noinspection GradleDependency
|
|
52
|
-
implementation('com.regula.documentreader:api:6.
|
|
52
|
+
implementation('com.regula.documentreader:api:6.5.7488') {
|
|
53
53
|
transitive = true
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -10,7 +10,7 @@ import android.graphics.drawable.Drawable;
|
|
|
10
10
|
import android.util.Base64;
|
|
11
11
|
|
|
12
12
|
import com.regula.documentreader.api.enums.BarcodeType;
|
|
13
|
-
import com.regula.documentreader.api.params.FaceMetaData;
|
|
13
|
+
import com.regula.documentreader.api.internal.params.FaceMetaData;
|
|
14
14
|
import com.regula.documentreader.api.results.Bounds;
|
|
15
15
|
|
|
16
16
|
import org.json.JSONArray;
|
|
@@ -15,7 +15,8 @@ import com.regula.documentreader.api.enums.eGraphicFieldType;
|
|
|
15
15
|
import com.regula.documentreader.api.enums.eRPRM_Lights;
|
|
16
16
|
import com.regula.documentreader.api.errors.DocumentReaderException;
|
|
17
17
|
import com.regula.documentreader.api.internal.core.CoreDetailedScenario;
|
|
18
|
-
import com.regula.documentreader.api.params.
|
|
18
|
+
import com.regula.documentreader.api.params.DocReaderConfig;
|
|
19
|
+
import com.regula.documentreader.api.internal.params.FaceMetaData;
|
|
19
20
|
import com.regula.documentreader.api.params.ImageInputData;
|
|
20
21
|
import com.regula.documentreader.api.params.rfid.TccParams;
|
|
21
22
|
import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
|
|
@@ -56,7 +57,6 @@ import com.regula.documentreader.api.results.rfid.Extension;
|
|
|
56
57
|
import com.regula.documentreader.api.results.rfid.File;
|
|
57
58
|
import com.regula.documentreader.api.results.rfid.FileData;
|
|
58
59
|
import com.regula.documentreader.api.results.rfid.RFIDSessionData;
|
|
59
|
-
import com.regula.documentreader.api.results.rfid.RFIDSessionDataStatus;
|
|
60
60
|
import com.regula.documentreader.api.results.rfid.SecurityObject;
|
|
61
61
|
import com.regula.documentreader.api.results.rfid.SecurityObjectCertificates;
|
|
62
62
|
import com.regula.documentreader.api.results.rfid.SignerInfo;
|
|
@@ -361,6 +361,28 @@ class JSONConstructor {
|
|
|
361
361
|
return result;
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
+
static DocReaderConfig DocReaderConfigFromJSON(JSONObject input) {
|
|
365
|
+
DocReaderConfig result = new DocReaderConfig(null);
|
|
366
|
+
byte[] license;
|
|
367
|
+
try {
|
|
368
|
+
if (input.has("license")) {
|
|
369
|
+
license = Base64.decode(input.getString("license"), Base64.DEFAULT);
|
|
370
|
+
result = new DocReaderConfig(license);
|
|
371
|
+
} else return result;
|
|
372
|
+
if (input.has("customDb"))
|
|
373
|
+
result = new DocReaderConfig(license, Base64.decode(input.getString("customDb"), Base64.DEFAULT));
|
|
374
|
+
if (input.has("licenseUpdate"))
|
|
375
|
+
result.setLicenseUpdate(input.getBoolean("licenseUpdate"));
|
|
376
|
+
if (input.has("delayedNNLoad"))
|
|
377
|
+
result.setDelayedNNLoad(input.getBoolean("delayedNNLoad"));
|
|
378
|
+
if (input.has("blackList"))
|
|
379
|
+
result.setBlackList(input.getJSONObject("blackList"));
|
|
380
|
+
} catch (JSONException e) {
|
|
381
|
+
e.printStackTrace();
|
|
382
|
+
}
|
|
383
|
+
return result;
|
|
384
|
+
}
|
|
385
|
+
|
|
364
386
|
static ImageInputData ImageInputDataFromJSON(JSONObject input) {
|
|
365
387
|
ImageInputData result = new ImageInputData(null);
|
|
366
388
|
int pageIndex = 0;
|
|
@@ -920,7 +942,6 @@ class JSONConstructor {
|
|
|
920
942
|
result.put("extLeSupport", input.extLeSupport);
|
|
921
943
|
result.put("processTime", input.processTime);
|
|
922
944
|
result.put("cardProperties", generateCardProperties(input.cardProperties));
|
|
923
|
-
result.put("sessionDataStatus", generateRFIDSessionDataStatus(input.sessionDataStatus));
|
|
924
945
|
result.put("accessControls", generateList(input.accessControls, JSONConstructor::generateAccessControlProcedureType));
|
|
925
946
|
result.put("applications", generateList(input.applications, JSONConstructor::generateApplication));
|
|
926
947
|
result.put("securityObjects", generateList(input.securityObjects, JSONConstructor::generateSecurityObject));
|
|
@@ -958,23 +979,6 @@ class JSONConstructor {
|
|
|
958
979
|
return result;
|
|
959
980
|
}
|
|
960
981
|
|
|
961
|
-
static JSONObject generateRFIDSessionDataStatus(RFIDSessionDataStatus input) {
|
|
962
|
-
JSONObject result = new JSONObject();
|
|
963
|
-
if (input == null) return result;
|
|
964
|
-
try {
|
|
965
|
-
result.put("AA", input.AA);
|
|
966
|
-
result.put("BAC", input.BAC);
|
|
967
|
-
result.put("CA", input.CA);
|
|
968
|
-
result.put("PA", input.PA);
|
|
969
|
-
result.put("PACE", input.PACE);
|
|
970
|
-
result.put("TA", input.TA);
|
|
971
|
-
result.put("overallStatus", input.overallStatus);
|
|
972
|
-
} catch (JSONException e) {
|
|
973
|
-
e.printStackTrace();
|
|
974
|
-
}
|
|
975
|
-
return result;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
982
|
static JSONObject generateDocumentReaderBarcodeResult(DocumentReaderBarcodeResult input) {
|
|
979
983
|
JSONObject result = new JSONObject();
|
|
980
984
|
if (input == null) return result;
|
|
@@ -1243,7 +1247,6 @@ class JSONConstructor {
|
|
|
1243
1247
|
if (input == null) return result;
|
|
1244
1248
|
try {
|
|
1245
1249
|
result.put("chipPage", input.chipPage);
|
|
1246
|
-
result.put("overallResult", input.getOverallResult());
|
|
1247
1250
|
result.put("processingFinishedStatus", input.processingFinishedStatus);
|
|
1248
1251
|
result.put("elapsedTime", input.elapsedTime);
|
|
1249
1252
|
result.put("elapsedTimeRFID", input.elapsedTimeRFID);
|
|
@@ -2038,8 +2041,6 @@ class JSONConstructor {
|
|
|
2038
2041
|
result.processTime = input.getInt("processTime");
|
|
2039
2042
|
if (input.has("cardProperties"))
|
|
2040
2043
|
result.cardProperties = CardPropertiesFromJSON(input.getJSONObject("cardProperties"));
|
|
2041
|
-
if (input.has("sessionDataStatus"))
|
|
2042
|
-
result.sessionDataStatus = RFIDSessionDataStatusFromJSON(input.getJSONObject("sessionDataStatus"));
|
|
2043
2044
|
if (input.has("accessControls")){
|
|
2044
2045
|
JSONArray jsonArray_accessControls = input.getJSONArray("accessControls");
|
|
2045
2046
|
List<AccessControlProcedureType> accessControls = new ArrayList<>();
|
|
@@ -2105,30 +2106,6 @@ class JSONConstructor {
|
|
|
2105
2106
|
return null;
|
|
2106
2107
|
}
|
|
2107
2108
|
|
|
2108
|
-
static RFIDSessionDataStatus RFIDSessionDataStatusFromJSON(JSONObject input) {
|
|
2109
|
-
try {
|
|
2110
|
-
RFIDSessionDataStatus result = new RFIDSessionDataStatus();
|
|
2111
|
-
if (input.has("AA"))
|
|
2112
|
-
result.AA = input.getInt("AA");
|
|
2113
|
-
if (input.has("BAC"))
|
|
2114
|
-
result.BAC = input.getInt("BAC");
|
|
2115
|
-
if (input.has("CA"))
|
|
2116
|
-
result.CA = input.getInt("CA");
|
|
2117
|
-
if (input.has("PA"))
|
|
2118
|
-
result.PA = input.getInt("PA");
|
|
2119
|
-
if (input.has("PACE"))
|
|
2120
|
-
result.PACE = input.getInt("PACE");
|
|
2121
|
-
if (input.has("TA"))
|
|
2122
|
-
result.TA = input.getInt("TA");
|
|
2123
|
-
if (input.has("overallStatus"))
|
|
2124
|
-
result.overallStatus = input.getInt("overallStatus");
|
|
2125
|
-
return result;
|
|
2126
|
-
} catch (JSONException e) {
|
|
2127
|
-
e.printStackTrace();
|
|
2128
|
-
}
|
|
2129
|
-
return null;
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
2109
|
static DocumentReaderBarcodeResult DocumentReaderBarcodeResultFromJSON(JSONObject input) {
|
|
2133
2110
|
try {
|
|
2134
2111
|
DocumentReaderBarcodeResult result = new DocumentReaderBarcodeResult();
|
|
@@ -34,12 +34,12 @@ import com.regula.documentreader.api.errors.DocumentReaderException;
|
|
|
34
34
|
import com.regula.documentreader.api.internal.core.CoreScenarioUtil;
|
|
35
35
|
import com.regula.documentreader.api.params.DocReaderConfig;
|
|
36
36
|
import com.regula.documentreader.api.params.ImageInputData;
|
|
37
|
-
import com.regula.documentreader.api.params.ImageInputParam;
|
|
37
|
+
import com.regula.documentreader.api.internal.params.ImageInputParam;
|
|
38
38
|
import com.regula.documentreader.api.params.rfid.PKDCertificate;
|
|
39
39
|
import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
|
|
40
40
|
import com.regula.documentreader.api.params.rfid.authorization.TAChallenge;
|
|
41
41
|
import com.regula.documentreader.api.results.DocumentReaderResults;
|
|
42
|
-
import com.regula.documentreader.api.parser.DocReaderResultsJsonParser;
|
|
42
|
+
import com.regula.documentreader.api.internal.parser.DocReaderResultsJsonParser;
|
|
43
43
|
|
|
44
44
|
import org.json.JSONArray;
|
|
45
45
|
import org.json.JSONException;
|
|
@@ -341,6 +341,9 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
341
341
|
case "recognizeImage":
|
|
342
342
|
recognizeImage(callback, args(0));
|
|
343
343
|
break;
|
|
344
|
+
case "recognizeData":
|
|
345
|
+
recognizeData(callback, args(0));
|
|
346
|
+
break;
|
|
344
347
|
case "setRfidSessionStatus":
|
|
345
348
|
setRfidSessionStatus(callback, args(0));
|
|
346
349
|
break;
|
|
@@ -359,9 +362,6 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
359
362
|
case "setTCCParams":
|
|
360
363
|
setTCCParams(callback, args(0));
|
|
361
364
|
break;
|
|
362
|
-
case "initializeReaderWithDatabase":
|
|
363
|
-
initializeReaderWithDatabase(callback, args(0), args(1));
|
|
364
|
-
break;
|
|
365
365
|
case "recognizeImageWithOpts":
|
|
366
366
|
recognizeImageWithOpts(callback, args(0), args(1));
|
|
367
367
|
break;
|
|
@@ -525,16 +525,9 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
525
525
|
callback.success(Instance().isRFIDAvailableForUse());
|
|
526
526
|
}
|
|
527
527
|
|
|
528
|
-
private void initializeReader(Callback callback,
|
|
529
|
-
if (!Instance().isReady())
|
|
530
|
-
Instance().initializeReader(getContext(), new DocReaderConfig(Base64.decode(license.toString(), Base64.DEFAULT)), getInitCompletion(callback));
|
|
531
|
-
else
|
|
532
|
-
callback.success("already initialized");
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
private void initializeReaderWithDatabase(Callback callback, Object license, Object db) {
|
|
528
|
+
private void initializeReader(Callback callback, JSONObject config) {
|
|
536
529
|
if (!Instance().isReady())
|
|
537
|
-
Instance().initializeReader(getContext(),
|
|
530
|
+
Instance().initializeReader(getContext(), JSONConstructor.DocReaderConfigFromJSON(config), getInitCompletion(callback));
|
|
538
531
|
else
|
|
539
532
|
callback.success("already initialized");
|
|
540
533
|
}
|
|
@@ -559,6 +552,11 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
|
|
|
559
552
|
Instance().recognizeImage(Helpers.bitmapFromBase64(base64Image), getCompletion());
|
|
560
553
|
}
|
|
561
554
|
|
|
555
|
+
private void recognizeData(@SuppressWarnings("unused") Callback callback, Object data) {
|
|
556
|
+
stopBackgroundRFID();
|
|
557
|
+
Instance().recognizeImage(Base64.decode(data.toString(), Base64.DEFAULT), getCompletion());
|
|
558
|
+
}
|
|
559
|
+
|
|
562
560
|
private void recognizeImages(@SuppressWarnings("unused") Callback callback, JSONArray base64Images) throws JSONException {
|
|
563
561
|
stopBackgroundRFID();
|
|
564
562
|
Bitmap[] images = new Bitmap[base64Images.length()];
|
|
@@ -6,9 +6,11 @@ import org.json.JSONException;
|
|
|
6
6
|
|
|
7
7
|
import com.regula.documentreader.api.DocumentReader;
|
|
8
8
|
import com.regula.documentreader.api.params.ImageQA;
|
|
9
|
+
import com.regula.documentreader.api.params.OnlineProcessingConfig;
|
|
9
10
|
import com.regula.documentreader.api.params.ParamsCustomization;
|
|
10
11
|
import com.regula.documentreader.api.params.Functionality;
|
|
11
12
|
import com.regula.documentreader.api.params.ProcessParam;
|
|
13
|
+
import com.regula.documentreader.api.params.rfid.ReprocParams;
|
|
12
14
|
import com.regula.documentreader.api.params.rfid.dg.DataGroups;
|
|
13
15
|
|
|
14
16
|
import android.content.Context;
|
|
@@ -59,8 +61,6 @@ class RegulaConfig {
|
|
|
59
61
|
editor.setShowCaptureButtonDelayFromDetect(opts.getInt("showCaptureButtonDelayFromDetect"));
|
|
60
62
|
if (opts.has("showCaptureButtonDelayFromStart"))
|
|
61
63
|
editor.setShowCaptureButtonDelayFromStart(opts.getInt("showCaptureButtonDelayFromStart"));
|
|
62
|
-
if (opts.has("isOnlineMode"))
|
|
63
|
-
editor.setOnlineMode(opts.getBoolean("isOnlineMode"));
|
|
64
64
|
if (opts.has("databaseAutoupdate"))
|
|
65
65
|
editor.setDatabaseAutoupdate(opts.getBoolean("databaseAutoupdate"));
|
|
66
66
|
if (opts.has("showSkipNextPageButton"))
|
|
@@ -73,8 +73,6 @@ class RegulaConfig {
|
|
|
73
73
|
editor.setShowCameraSwitchButton(opts.getBoolean("showCameraSwitchButton"));
|
|
74
74
|
if (opts.has("cameraFrame"))
|
|
75
75
|
editor.setCameraFrame(opts.getString("cameraFrame"));
|
|
76
|
-
if (opts.has("serviceURL"))
|
|
77
|
-
editor.setServiceURL(opts.getString("serviceURL"));
|
|
78
76
|
if (opts.has("btDeviceName"))
|
|
79
77
|
editor.setBtDeviceName(opts.getString("btDeviceName"));
|
|
80
78
|
if (opts.has("orientation"))
|
|
@@ -105,6 +103,8 @@ class RegulaConfig {
|
|
|
105
103
|
editor.setExposure(BigDecimal.valueOf(opts.getDouble("exposure")).floatValue());
|
|
106
104
|
if (opts.has("rfidTimeout"))
|
|
107
105
|
editor.setRfidTimeout(opts.getInt("rfidTimeout"));
|
|
106
|
+
if (opts.has("onlineProcessingConfiguration"))
|
|
107
|
+
editor.setOnlineProcessingConfiguration(OnlineProcessingConfigFromJSON(opts.getJSONObject("onlineProcessingConfiguration")));
|
|
108
108
|
|
|
109
109
|
editor.apply();
|
|
110
110
|
}
|
|
@@ -349,14 +349,12 @@ class RegulaConfig {
|
|
|
349
349
|
object.put("showChangeFrameButton", functionality.isShowChangeFrameButton());
|
|
350
350
|
object.put("showCaptureButtonDelayFromDetect", functionality.getShowCaptureButtonDelayFromDetect());
|
|
351
351
|
object.put("showCaptureButtonDelayFromStart", functionality.getShowCaptureButtonDelayFromStart());
|
|
352
|
-
object.put("isOnlineMode", functionality.isOnlineMode());
|
|
353
352
|
object.put("databaseAutoupdate", functionality.isDatabaseAutoupdate());
|
|
354
353
|
object.put("showSkipNextPageButton", functionality.isShowSkipNextPageButton());
|
|
355
354
|
object.put("useAuthenticator", functionality.isUseAuthenticator());
|
|
356
355
|
object.put("skipFocusingFrames", functionality.isSkipFocusingFrames());
|
|
357
356
|
object.put("showCameraSwitchButton", functionality.isShowCameraSwitchButton());
|
|
358
357
|
object.put("cameraFrame", functionality.getCameraFrame());
|
|
359
|
-
object.put("serviceURL", functionality.getServiceURL());
|
|
360
358
|
object.put("btDeviceName", functionality.getBtDeviceName());
|
|
361
359
|
object.put("orientation", functionality.getOrientation());
|
|
362
360
|
object.put("BTDeviceApiPresent", functionality.isBTDeviceApiPresent());
|
|
@@ -603,6 +601,10 @@ class RegulaConfig {
|
|
|
603
601
|
setDataGroups(DocumentReader.Instance().rfidScenario().eIDDataGroups(), opts.getJSONObject("eIDDataGroups"));
|
|
604
602
|
if (opts.has("eDLDataGroups"))
|
|
605
603
|
setDataGroups(DocumentReader.Instance().rfidScenario().eDLDataGroups(), opts.getJSONObject("eDLDataGroups"));
|
|
604
|
+
if (opts.has("reprocessParams"))
|
|
605
|
+
DocumentReader.Instance().rfidScenario().setReprocessParams(ReprocParamsFromJSON(opts.getJSONObject("reprocessParams")));
|
|
606
|
+
if (opts.has("defaultReadingBufferSize"))
|
|
607
|
+
DocumentReader.Instance().rfidScenario().setDefaultReadingBufferSize(opts.getInt("defaultReadingBufferSize"));
|
|
606
608
|
}
|
|
607
609
|
|
|
608
610
|
private static void setDataGroups(DataGroups dataGroup, JSONObject opts) throws JSONException {
|
|
@@ -649,4 +651,42 @@ class RegulaConfig {
|
|
|
649
651
|
if (opts.has("DG21"))
|
|
650
652
|
dataGroup.setDG14(opts.getBoolean("DG21"));
|
|
651
653
|
}
|
|
654
|
+
|
|
655
|
+
private static ReprocParams ReprocParamsFromJSON(JSONObject input) {
|
|
656
|
+
try {
|
|
657
|
+
ReprocParams result;
|
|
658
|
+
if (input.has("serviceUrl"))
|
|
659
|
+
result = new ReprocParams(input.getString("serviceUrl"));
|
|
660
|
+
else return null;
|
|
661
|
+
if (input.has("failIfNoService"))
|
|
662
|
+
result.setFailIfNoService(input.getBoolean("failIfNoService"));
|
|
663
|
+
return result;
|
|
664
|
+
} catch (JSONException e) {
|
|
665
|
+
e.printStackTrace();
|
|
666
|
+
}
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
private static OnlineProcessingConfig OnlineProcessingConfigFromJSON(JSONObject input) {
|
|
671
|
+
try {
|
|
672
|
+
OnlineProcessingConfig.Builder builder;
|
|
673
|
+
if (input.has("mode"))
|
|
674
|
+
builder = new OnlineProcessingConfig.Builder(input.getInt("mode"));
|
|
675
|
+
else return null;
|
|
676
|
+
if (input.has("imageFormat"))
|
|
677
|
+
builder.setImageFormat(input.getInt("imageFormat"));
|
|
678
|
+
if (input.has("url"))
|
|
679
|
+
builder.setUrl(input.getString("url"));
|
|
680
|
+
if (input.has("imageCompressionQuality"))
|
|
681
|
+
builder.setImageCompressionQuality((float) input.getDouble("imageCompressionQuality"));
|
|
682
|
+
if (input.has("processParams")) {
|
|
683
|
+
ProcessParam params = new ProcessParam();
|
|
684
|
+
setProcessParams(params, input.getJSONObject("processParams"));
|
|
685
|
+
builder.setProcessParams(params);
|
|
686
|
+
}
|
|
687
|
+
} catch (JSONException e) {
|
|
688
|
+
e.printStackTrace();
|
|
689
|
+
}
|
|
690
|
+
return null;
|
|
691
|
+
}
|
|
652
692
|
}
|
package/core/.gitkeep
ADDED
|
File without changes
|