@regulaforensics/react-native-document-reader-api 6.2.0 → 6.3.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/README.md CHANGED
@@ -12,7 +12,7 @@ This repository contains the source code of the Document Reader API, and the sam
12
12
  * [Additional information](#additional-information)
13
13
 
14
14
  ## How to build demo application
15
- 1. Visit [licensing.regulaforensics.com](https://licensing.regulaforensics.com) to get a trial license (`regula.license` file). The license creation wizard will guide you through the necessary steps.
15
+ 1. Visit [client.regulaforensics.com](https://client.regulaforensics.com) to get a trial license (`regula.license` file). The license creation wizard will guide you through the necessary steps.
16
16
  2. Download or clone this repository using the command `git clone https://github.com/regulaforensics/react-native-document-reader.git`.
17
17
  3. Run the following commands in Terminal:
18
18
  ```bash
@@ -26,14 +26,14 @@ $ pod install
26
26
 
27
27
  4. Android:
28
28
  * Copy the `regula.license` file to the `example/android/app/src/main/assets` folder.
29
- * Change the application ID to the one you have specified during the registration at [licensing.regulaforensics.com](https://licensing.regulaforensics.com).
29
+ * Change the application ID to the one you have specified during the registration at [client.regulaforensics.com](https://client.regulaforensics.com).
30
30
  * Run `npx react-native run-android` inside `example` folder - this is just one way to run the app. You can also run it directly from within Android Studio. **Note**: `npx react-native log-android` is used to view logs.
31
31
 
32
32
  **Note**: if the running failed with the following error `Error: spawn ./gradlew EACCES`, try to run the following command `chmod +x gradlew` within the `example/android` directory.
33
33
 
34
34
  5. iOS:
35
35
  * Copy the `regula.license` file to the `example/ios/DocumentReader` folder.
36
- * Change the Bundle Identifier to the one you have specified during the registration at [licensing.regulaforensics.com](https://licensing.regulaforensics.com).
36
+ * Change the Bundle Identifier to the one you have specified during the registration at [client.regulaforensics.com](https://client.regulaforensics.com).
37
37
  * Run `npx react-native run-ios` inside `example` folder - this is just one way to run the app. You can also run it directly from within Xcode.
38
38
 
39
39
  ### Troubleshooting license issues
@@ -14,6 +14,6 @@ Pod::Spec.new do |s|
14
14
  s.source = { :http => 'file:' + __dir__ }
15
15
  s.ios.deployment_target = '11.0'
16
16
  s.source_files = "ios/*.{h,m}"
17
- s.dependency 'DocumentReader', '6.2.2422'
17
+ s.dependency 'DocumentReader', '6.3.2494'
18
18
  s.dependency 'React'
19
19
  end
@@ -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.2.6717') {
52
+ implementation('com.regula.documentreader:api:6.3.6939') {
53
53
  transitive = true
54
54
  }
55
55
  }
@@ -16,6 +16,7 @@ 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
18
  import com.regula.documentreader.api.params.FaceMetaData;
19
+ import com.regula.documentreader.api.params.rfid.TccParams;
19
20
  import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
20
21
  import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
21
22
  import com.regula.documentreader.api.params.rfid.authorization.TAChallenge;
@@ -340,6 +341,25 @@ class JSONConstructor {
340
341
  return result;
341
342
  }
342
343
 
344
+ static TccParams TCCParamsFromJSON(JSONObject input) {
345
+ TccParams result = new TccParams();
346
+ try {
347
+ if (input.has("serviceUrlTA"))
348
+ result.setServiceUrlTA(input.getString("serviceUrlTA"));
349
+ if (input.has("serviceUrlPA"))
350
+ result.setServiceUrlPA(input.getString("serviceUrlPA"));
351
+ if (input.has("pfxCertUrl"))
352
+ result.setPfxCertUrl(input.getString("pfxCertUrl"));
353
+ if (input.has("pfxPassPhrase"))
354
+ result.setPfxPassPhrase(input.getString("pfxPassPhrase"));
355
+ if (input.has("pfxCert"))
356
+ result.setPfxCert(Base64.decode(input.getString("pfxCert"), Base64.DEFAULT));
357
+ } catch (JSONException e) {
358
+ e.printStackTrace();
359
+ }
360
+ return result;
361
+ }
362
+
343
363
  static Throwable ThrowableFromJSON(JSONObject jsonObject) {
344
364
  return new Throwable();
345
365
  }
@@ -28,6 +28,7 @@ import com.regula.documentreader.api.completions.IDocumentReaderPrepareCompletio
28
28
  import com.regula.documentreader.api.completions.IRfidPKDCertificateCompletion;
29
29
  import com.regula.documentreader.api.completions.IRfidReaderRequest;
30
30
  import com.regula.documentreader.api.completions.IRfidTASignatureCompletion;
31
+ import com.regula.documentreader.api.completions.ITccParamsCompletion;
31
32
  import com.regula.documentreader.api.enums.DocReaderAction;
32
33
  import com.regula.documentreader.api.errors.DocumentReaderException;
33
34
  import com.regula.documentreader.api.internal.core.CoreScenarioUtil;
@@ -351,8 +352,8 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
351
352
  case "parseCoreResults":
352
353
  parseCoreResults(callback, args(0));
353
354
  break;
354
- case "initializeReaderWithDatabasePath":
355
- initializeReaderWithDatabasePath(callback, args(0), args(1));
355
+ case "setTCCParams":
356
+ setTCCParams(callback, args(0));
356
357
  break;
357
358
  case "initializeReaderWithDatabase":
358
359
  initializeReaderWithDatabase(callback, args(0), args(1));
@@ -464,6 +465,10 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
464
465
  callback.success(Instance().version.database.documentsNumber);
465
466
  }
466
467
 
468
+ private void setTCCParams(Callback callback, final JSONObject params) {
469
+ Instance().setTccParams(JSONConstructor.TCCParamsFromJSON(params), getTCCParamsCompletion(callback));
470
+ }
471
+
467
472
  private void deinitializeReader(Callback callback) {
468
473
  Instance().deinitializeReader();
469
474
  callback.success();
@@ -725,11 +730,6 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
725
730
  callback.error("recognizeImageWithCameraMode() is an ios-only method");
726
731
  }
727
732
 
728
- @SuppressWarnings("unused")
729
- private void initializeReaderWithDatabasePath(Callback callback, Object license, String path) {
730
- callback.error("initializeReaderWithDatabasePath() is an ios-only method");
731
- }
732
-
733
733
  @SuppressWarnings("unused")
734
734
  private void setRfidSessionStatus(Callback callback, String s) {
735
735
  callback.error("setRfidSessionStatus() is an ios-only method");
@@ -777,6 +777,15 @@ public class RNRegulaDocumentReaderModule extends ReactContextBaseJavaModule imp
777
777
  };
778
778
  }
779
779
 
780
+ private ITccParamsCompletion getTCCParamsCompletion(Callback callback) {
781
+ return (success, error) -> {
782
+ if (success)
783
+ callback.success("success");
784
+ else
785
+ callback.error("failed: " + error.getMessage());
786
+ };
787
+ }
788
+
780
789
  private IRfidReaderRequest getIRfidReaderRequest() {
781
790
  return new IRfidReaderRequest() {
782
791
  @Override
@@ -323,6 +323,14 @@ class RegulaConfig {
323
323
  editor.setToolbarSize(BigDecimal.valueOf(opts.getDouble("toolbarSize")).floatValue());
324
324
  if (opts.has("statusBackgroundColor"))
325
325
  editor.setStatusBackgroundColor(opts.getString("statusBackgroundColor"));
326
+ if (opts.has("hologramAnimationImage"))
327
+ editor.setHologramAnimationImage(drawableFromBase64(opts.getString("hologramAnimationImage"), context));
328
+ if (opts.has("hologramAnimationPositionMultiplier"))
329
+ editor.setHologramAnimationPositionMultiplier((float) opts.getDouble("hologramAnimationPositionMultiplier"));
330
+ if (opts.has("hologramAnimationImageMatrix"))
331
+ editor.setHologramAnimationImageMatrix(matrixFromFloatArray(floatArrayFromJson(opts.getJSONArray("hologramAnimationImageMatrix"))));
332
+ if (opts.has("hologramAnimationImageScaleType"))
333
+ editor.setHologramAnimationImageScaleType(ScaleType.valueOf(opts.getString("hologramAnimationImageScaleType")));
326
334
 
327
335
  editor.applyImmediately(context);
328
336
  }
@@ -423,6 +431,10 @@ class RegulaConfig {
423
431
  object.put("changeFrameButtonCollapseImage", bitmapToBase64String(bitmapFromDrawable(customization.getChangeFrameCollapseButtonDrawable())));
424
432
  object.put("toolbarSize", customization.getToolbarSize());
425
433
  object.put("statusBackgroundColor", customization.getStatusBackgroundColor());
434
+ object.put("hologramAnimationImage", bitmapToBase64String(bitmapFromDrawable(customization.getHologramAnimationImage())));
435
+ object.put("hologramAnimationPositionMultiplier", customization.getHologramAnimationPositionMultiplier());
436
+ object.put("hologramAnimationImageMatrix", customization.getHologramAnimationImageMatrix());
437
+ object.put("hologramAnimationImageScaleType", customization.getHologramAnimationImageScaleType());
426
438
 
427
439
  return object;
428
440
  }
@@ -10,8 +10,8 @@
10
10
  "lint": "eslint ."
11
11
  },
12
12
  "dependencies": {
13
- "@regulaforensics/react-native-document-reader-api": "^6.2.0",
14
- "@regulaforensics/react-native-document-reader-core-fullrfid": "^6.2.0",
13
+ "@regulaforensics/react-native-document-reader-api": "^6.3.0",
14
+ "@regulaforensics/react-native-document-reader-core-fullrfid": "^6.3.0",
15
15
  "react": "17.0.2",
16
16
  "react-native": "^0.67.0",
17
17
  "react-native-check-box": "^2.1.7",
package/index.d.ts CHANGED
@@ -2157,6 +2157,7 @@ export const eImageQualityCheckType = {
2157
2157
  IQC_BOUNDS: 5,
2158
2158
  IQC_SCREEN_CAPTURE: 6,
2159
2159
  IQC_PORTRAIT: 7,
2160
+ IQC_HANDWRITTEN: 8,
2160
2161
  }
2161
2162
 
2162
2163
  export const eLDS_ParsingErrorCodes = {
@@ -6555,7 +6556,7 @@ export default class DocumentReader {
6555
6556
  static provideTACertificates(certificates: PKDCertificate[], successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
6556
6557
  static provideTASignature(certificates: byte[], successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
6557
6558
  static parseCoreResults(json: string, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
6558
- static initializeReaderWithDatabasePath(license: string, path: string, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
6559
+ static setTCCParams(params: object, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
6559
6560
  static initializeReaderWithDatabase(license: string, db: string, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
6560
6561
  static recognizeImageFrame(image: string, params: ImageInputParam, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
6561
6562
  static recognizeImageWithOpts(image: string, options: object, successCallback: (response: string) => void, errorCallback?: (error: string) => void): void
package/index.js CHANGED
@@ -1684,6 +1684,7 @@ export const eImageQualityCheckType = {
1684
1684
  IQC_BOUNDS: 5,
1685
1685
  IQC_SCREEN_CAPTURE: 6,
1686
1686
  IQC_PORTRAIT: 7,
1687
+ IQC_HANDWRITTEN: 8,
1687
1688
  }
1688
1689
 
1689
1690
  export const eLDS_ParsingErrorCodes = {
@@ -6083,7 +6084,7 @@ DocumentReader.providePACertificates = (certificates, successCallback, errorCall
6083
6084
  DocumentReader.provideTACertificates = (certificates, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "provideTACertificates", [certificates], successCallback, errorCallback)
6084
6085
  DocumentReader.provideTASignature = (certificates, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "provideTASignature", [certificates], successCallback, errorCallback)
6085
6086
  DocumentReader.parseCoreResults = (json, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "parseCoreResults", [json], successCallback, errorCallback)
6086
- DocumentReader.initializeReaderWithDatabasePath = (license, path, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "initializeReaderWithDatabasePath", [license, path], successCallback, errorCallback)
6087
+ DocumentReader.setTCCParams = (params, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "setTCCParams", [params], successCallback, errorCallback)
6087
6088
  DocumentReader.initializeReaderWithDatabase = (license, db, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "initializeReaderWithDatabase", [license, db], successCallback, errorCallback)
6088
6089
  DocumentReader.recognizeImageFrame = (image, params, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "recognizeImageFrame", [image, params], successCallback, errorCallback)
6089
6090
  DocumentReader.recognizeImageWithOpts = (image, options, successCallback, errorCallback) => RNRegulaDocumentReader.exec("DocumentReader", "recognizeImageWithOpts", [image, options], successCallback, errorCallback)
@@ -11,6 +11,7 @@
11
11
  +(NSMutableDictionary* _Nonnull)generateRfidNotificationCompletionWithError:(NSInteger)notification : (NSInteger)value;
12
12
  +(NSMutableDictionary* _Nonnull)generateNSDictionary:(NSDictionary<NSNumber*, NSNumber*>* _Nullable)input;
13
13
  +(RGLPKDCertificate* _Nullable)RGLPKDCertificateFromJson:(NSDictionary* _Nullable) dict;
14
+ +(RGLTCCParams* _Nonnull)RGLTCCParamsFromJson:(NSDictionary* _Nonnull)input;
14
15
  +(NSInteger)generateDocReaderAction:(RGLDocReaderAction)action;
15
16
  +(NSInteger)generateRFIDCompleteAction:(RGLRFIDCompleteAction)action;
16
17
  +(NSInteger)generateRFIDNotificationAction:(RGLRFIDNotificationAction)action;
@@ -25,6 +25,16 @@
25
25
  return [[RGLPKDCertificate alloc] initWithBinaryData:binaryData resourceType:type privateKey:privateKey];
26
26
  }
27
27
 
28
+ +(RGLTCCParams*)RGLTCCParamsFromJson:(NSDictionary*)input {
29
+ NSString* serviceTAURLString = [input valueForKey:@"serviceUrlTA"];
30
+ NSString* servicePAURLString = [input valueForKey:@"serviceUrlPA"];
31
+ NSString* pfxCertURLString = [input valueForKey:@"pfxCertUrl"];
32
+ NSString* pfxPassPhrase = [input valueForKey:@"pfxPassPhrase"];
33
+ NSData* pfxCertData = [input objectForKey:@"pfxCert"] != nil ? [[NSData alloc] initWithBase64EncodedString:[input objectForKey:@"pfxCert"] options:0] : nil;
34
+
35
+ return [[RGLTCCParams alloc] initWithServiceTAURLString:serviceTAURLString servicePAURLString:servicePAURLString pfxCertURLString:pfxCertURLString pfxCertData: pfxCertData pfxPassPhrase:pfxPassPhrase];
36
+ }
37
+
28
38
  +(NSMutableDictionary*)generateCGPoint:(CGPoint)input {
29
39
  NSMutableDictionary *result = [NSMutableDictionary new];
30
40
 
@@ -390,7 +400,7 @@
390
400
  NSMutableDictionary *result = [NSMutableDictionary new];
391
401
  if(input == nil) return result;
392
402
 
393
- result[@"type"] = @(input.type);
403
+ result[@"type"] = input.type;
394
404
  result[@"result"] = @(input.result);
395
405
  result[@"featureType"] = @(input.featureType);
396
406
  result[@"boundRects"] = [self generateNSArrayCGRect:input.boundRects];
@@ -236,8 +236,8 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
236
236
  [self provideTASignature :[args objectAtIndex:0] :successCallback :errorCallback];
237
237
  else if([action isEqualToString:@"parseCoreResults"])
238
238
  [self parseCoreResults :[args objectAtIndex:0] :successCallback :errorCallback];
239
- else if([action isEqualToString:@"initializeReaderWithDatabasePath"])
240
- [self initializeReaderWithDatabasePath :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
239
+ else if([action isEqualToString:@"setTCCParams"])
240
+ [self setTCCParams :[args objectAtIndex:0] :successCallback :errorCallback];
241
241
  else if([action isEqualToString:@"initializeReaderWithDatabase"])
242
242
  [self initializeReaderWithDatabase :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
243
243
  else if([action isEqualToString:@"recognizeImageFrame"])
@@ -316,10 +316,6 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
316
316
  });
317
317
  }
318
318
 
319
- - (void) initializeReaderWithDatabasePath:(NSString*)licenseString :(NSString*)databasePath :(Callback)successCallback :(Callback)errorCallback{
320
- [RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:[[NSData alloc] initWithBase64EncodedString:licenseString options:0] licenseUpdateCheck:true databasePath:databasePath delayedNNLoadEnabled:false] completion:[self getInitCompletion :successCallback :errorCallback]];
321
- }
322
-
323
319
  - (void) prepareDatabase:(NSString*)dbID :(Callback)successCallback :(Callback)errorCallback{
324
320
  [RGLDocReader.shared prepareDatabase:dbID progressHandler:[self getProgressHandler :successCallback :errorCallback] completion:[self getPrepareCompletion :successCallback :errorCallback]];
325
321
  }
@@ -502,6 +498,10 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
502
498
  [self result:RGLDocReader.shared.documentReaderStatus :successCallback];
503
499
  }
504
500
 
501
+ - (void) setTCCParams:(NSDictionary*)params :(Callback)successCallback :(Callback)errorCallback{
502
+ [RGLDocReader.shared setTCCParams:[RGLWJSONConstructor RGLTCCParamsFromJson:params] completion:[self getTCCParamsCompletion:successCallback :errorCallback]];
503
+ }
504
+
505
505
  - (void) getRfidSessionStatus:(Callback)successCallback :(Callback)errorCallback{
506
506
  [self result:RGLDocReader.shared.rfidSessionStatus :successCallback];
507
507
  }
@@ -628,4 +628,13 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
628
628
  };
629
629
  }
630
630
 
631
+ -(void (^_Nullable)(BOOL success, NSError * _Nullable error))getTCCParamsCompletion:(Callback)successCallback :(Callback)errorCallback{
632
+ return ^(BOOL success, NSError * _Nullable error) {
633
+ if (success)
634
+ [self result:@"success" :successCallback];
635
+ else
636
+ [self result:[NSString stringWithFormat:@"%@/%@", @"failed: ", error.description] :errorCallback];
637
+ };
638
+ }
639
+
631
640
  @end
@@ -299,6 +299,12 @@
299
299
  image.colornessCheck = [dict valueForKey:@"colornessCheck"];
300
300
  if([dict valueForKey:@"moireCheck"] != nil)
301
301
  image.moireCheck = [dict valueForKey:@"moireCheck"];
302
+ if([dict valueForKey:@"expectedPass"] != nil){
303
+ NSMutableArray<RGLImageQualityCheckType> *expectedPass = [NSMutableArray new];
304
+ for(NSString* str in [dict valueForKey:@"expectedPass"])
305
+ [expectedPass addObject:str];
306
+ image.expectedPass = expectedPass;
307
+ }
302
308
 
303
309
  return image;
304
310
  }
@@ -313,6 +319,7 @@
313
319
  result[@"glaresCheck"] = input.glaresCheck;
314
320
  result[@"colornessCheck"] = input.colornessCheck;
315
321
  result[@"moireCheck"] = input.moireCheck;
322
+ result[@"expectedPass"] = input.expectedPass;
316
323
 
317
324
  return result;
318
325
  }
@@ -537,6 +544,12 @@
537
544
  customization.toolbarSize = [[options valueForKey:@"toolbarSize"] floatValue];
538
545
  if([options valueForKey:@"statusBackgroundColor"] != nil)
539
546
  customization.statusBackgroundColor = [self getUIColorObjectFromHexString:[options valueForKey:@"statusBackgroundColor"] alpha:1];
547
+ if([options valueForKey:@"hologramAnimationImageContentMode"] != nil)
548
+ customization.hologramAnimationImageContentMode = [self UIViewContentModeWithNSInteger:[[options valueForKey:@"hologramAnimationImageContentMode"] integerValue]];
549
+ if([options valueForKey:@"hologramAnimationPositionMultiplier"] != nil)
550
+ customization.hologramAnimationPositionMultiplier = [[options valueForKey:@"hologramAnimationPositionMultiplier"] floatValue];
551
+ if([options valueForKey:@"hologramAnimationImage"] != nil)
552
+ customization.hologramAnimationImage = [self imageFromBase64:[options valueForKey:@"hologramAnimationImage"]];
540
553
  }
541
554
 
542
555
  +(void)setFunctionality:(NSDictionary*)options :(RGLFunctionality*)functionality {
@@ -740,6 +753,9 @@
740
753
  result[@"cameraFramePortraitAspectRatio"] = [NSNumber numberWithFloat:customization.cameraFramePortraitAspectRatio];
741
754
  result[@"cameraFrameLandscapeAspectRatio"] = [NSNumber numberWithFloat:customization.cameraFrameLandscapeAspectRatio];
742
755
  result[@"toolbarSize"] = [NSNumber numberWithFloat:customization.toolbarSize];
756
+ result[@"hologramAnimationImageContentMode"] = [NSNumber numberWithInteger:[self NSIntegerWithUIViewContentMode:customization.hologramAnimationImageContentMode]];
757
+ result[@"hologramAnimationPositionMultiplier"] = [NSNumber numberWithFloat:customization.hologramAnimationPositionMultiplier];
758
+ result[@"hologramAnimationImage"] = [UIImageJPEGRepresentation(customization.hologramAnimationImage, 1.0) base64EncodedStringWithOptions:0];
743
759
  if(customization.customLabelStatus != nil)
744
760
  result[@"customLabelStatus"] = customization.customLabelStatus.string;
745
761
  if(customization.activityIndicatorColor != nil)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/react-native-document-reader-api",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "description": "React Native module for reading and validation of identification documents (API framework)",
5
5
  "main": "index.js",
6
6
  "scripts": {