@regulaforensics/cordova-plugin-document-reader-api 6.2.1 → 6.3.1

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,17 +12,17 @@ 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 the 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 current repository using the command `git clone https://github.com/regulaforensics/DocumentReader-Cordova-Plugin.git`.
17
17
  3. Run the following commands in Terminal:
18
18
  ```bash
19
19
  $ cd example
20
20
  $ npm install
21
+ $ npx jetify
21
22
  $ cordova prepare
22
23
  ```
23
24
 
24
25
  4. Copy the `regula.license` file to the `example/www` folder.
25
- 5. Change the application ID to the one you have specified during the registration at [licensing.regulaforensics.com](https://licensing.regulaforensics.com).
26
26
  6. Android:
27
27
  * Run `cordova run android` inside `example` folder - this is just one way to run the app. You can also run it directly from within Android Studio.
28
28
 
@@ -35,7 +35,6 @@ $ cordova prepare
35
35
  ### Troubleshooting license issues
36
36
  If you have issues with license verification when running the application, please verify that next is true:
37
37
  1. The OS, which you use, is specified in the license (e.g., Android and/or iOS).
38
- 2. The application (Bundle) ID, which you use, is specified in the license.
39
38
  3. The license is valid (not expired).
40
39
  4. The date and time on the device, where you run the application, are valid.
41
40
  5. You use the latest release version of the Document Reader SDK.
@@ -17,6 +17,7 @@
17
17
  <allow-intent href="mailto:*" />
18
18
  <allow-intent href="geo:*" />
19
19
  <platform name="android">
20
+ <preference name="AndroidXEnabled" value="true" />
20
21
  <allow-intent href="market:*" />
21
22
  <config-file parent="/*" target="AndroidManifest.xml">
22
23
  <uses-permission android:name="android.permission.NFC" />
@@ -16,12 +16,13 @@
16
16
  "cordova-android": "^9.0.0",
17
17
  "cordova-ios": "^6.1.1",
18
18
  "cordova-plugin-add-swift-support": "^2.0.2",
19
- "@regulaforensics/cordova-plugin-document-reader-api": "^6.2.1",
20
- "@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "^6.2.1",
19
+ "@regulaforensics/cordova-plugin-document-reader-api": "^6.3.1",
20
+ "@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "^6.3.0",
21
21
  "cordova-plugin-file": "^6.0.2",
22
22
  "cordova-plugin-image-picker": "^1.1.3",
23
23
  "cordova-plugin-android-permissions": "1.1.0",
24
- "cordova-plugin-advanced-http": "3.2.1"
24
+ "cordova-plugin-advanced-http": "3.2.1",
25
+ "jetifier": "^2.0.0"
25
26
  },
26
27
  "cordova": {
27
28
  "plugins": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/cordova-plugin-document-reader-api",
3
- "version": "6.2.1",
3
+ "version": "6.3.1",
4
4
  "description": "Cordova plugin for reading and validation of identification documents (API framework)",
5
5
  "cordova": {
6
6
  "id": "@regulaforensics/cordova-plugin-document-reader-api",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-plugin-document-reader-api" version="6.2.1"
2
+ <plugin id="cordova-plugin-document-reader-api" version="6.3.1"
3
3
  xmlns="http://apache.org/cordova/ns/plugins/1.0">
4
4
  <name>DocumentReaderApi</name>
5
5
  <description>Cordova plugin Document reader api</description>
@@ -25,7 +25,7 @@
25
25
  <podspec>
26
26
  <config/>
27
27
  <pods>
28
- <pod name="DocumentReader" spec="~> 6.2.2441" />
28
+ <pod name="DocumentReader" spec="~> 6.3.2494" />
29
29
  </pods>
30
30
  </podspec>
31
31
  </platform>
@@ -19,6 +19,7 @@ import com.regula.documentreader.api.completions.IDocumentReaderPrepareCompletio
19
19
  import com.regula.documentreader.api.completions.IRfidPKDCertificateCompletion;
20
20
  import com.regula.documentreader.api.completions.IRfidReaderRequest;
21
21
  import com.regula.documentreader.api.completions.IRfidTASignatureCompletion;
22
+ import com.regula.documentreader.api.completions.ITccParamsCompletion;
22
23
  import com.regula.documentreader.api.enums.DocReaderAction;
23
24
  import com.regula.documentreader.api.errors.DocumentReaderException;
24
25
  import com.regula.documentreader.api.internal.core.CoreScenarioUtil;
@@ -325,8 +326,8 @@ public class DocumentReader extends CordovaPlugin {
325
326
  case "parseCoreResults":
326
327
  parseCoreResults(callback, args(0));
327
328
  break;
328
- case "initializeReaderWithDatabasePath":
329
- initializeReaderWithDatabasePath(callback, args(0), args(1));
329
+ case "setTCCParams":
330
+ setTCCParams(callback, args(0));
330
331
  break;
331
332
  case "initializeReaderWithDatabase":
332
333
  initializeReaderWithDatabase(callback, args(0), args(1));
@@ -439,6 +440,10 @@ public class DocumentReader extends CordovaPlugin {
439
440
  callback.success(Instance().version.database.documentsNumber);
440
441
  }
441
442
 
443
+ private void setTCCParams(Callback callback, final JSONObject params) {
444
+ Instance().setTccParams(JSONConstructor.TCCParamsFromJSON(params), getTCCParamsCompletion(callback));
445
+ }
446
+
442
447
  private void deinitializeReader(Callback callback) {
443
448
  Instance().deinitializeReader();
444
449
  callback.success();
@@ -700,11 +705,6 @@ public class DocumentReader extends CordovaPlugin {
700
705
  callback.error("recognizeImageWithCameraMode() is an ios-only method");
701
706
  }
702
707
 
703
- @SuppressWarnings("unused")
704
- private void initializeReaderWithDatabasePath(Callback callback, Object license, String path) {
705
- callback.error("initializeReaderWithDatabasePath() is an ios-only method");
706
- }
707
-
708
708
  @SuppressWarnings("unused")
709
709
  private void setRfidSessionStatus(Callback callback, String s) {
710
710
  callback.error("setRfidSessionStatus() is an ios-only method");
@@ -752,6 +752,15 @@ public class DocumentReader extends CordovaPlugin {
752
752
  };
753
753
  }
754
754
 
755
+ private ITccParamsCompletion getTCCParamsCompletion(Callback callback) {
756
+ return (success, error) -> {
757
+ if (success)
758
+ callback.success("success");
759
+ else
760
+ callback.error("failed: " + error.getMessage());
761
+ };
762
+ }
763
+
755
764
  private IRfidReaderRequest getIRfidReaderRequest() {
756
765
  return new IRfidReaderRequest() {
757
766
  @Override
@@ -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
  }
@@ -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
  }
@@ -12,7 +12,7 @@ repositories {
12
12
  }
13
13
 
14
14
  dependencies {
15
- implementation ('com.regula.documentreader:api:6.2.6717'){
15
+ implementation ('com.regula.documentreader:api:6.3.6946'){
16
16
  transitive = true
17
17
  }
18
18
  }
@@ -244,8 +244,8 @@ typedef void (^Callback)(NSString* response);
244
244
  [self provideTASignature :[args objectAtIndex:0] :successCallback :errorCallback];
245
245
  else if([action isEqualToString:@"parseCoreResults"])
246
246
  [self parseCoreResults :[args objectAtIndex:0] :successCallback :errorCallback];
247
- else if([action isEqualToString:@"initializeReaderWithDatabasePath"])
248
- [self initializeReaderWithDatabasePath :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
247
+ else if([action isEqualToString:@"setTCCParams"])
248
+ [self setTCCParams :[args objectAtIndex:0] :successCallback :errorCallback];
249
249
  else if([action isEqualToString:@"initializeReaderWithDatabase"])
250
250
  [self initializeReaderWithDatabase :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
251
251
  else if([action isEqualToString:@"recognizeImageFrame"])
@@ -324,10 +324,6 @@ typedef void (^Callback)(NSString* response);
324
324
  });
325
325
  }
326
326
 
327
- - (void) initializeReaderWithDatabasePath:(NSString*)licenseString :(NSString*)databasePath :(Callback)successCallback :(Callback)errorCallback{
328
- [RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:[[NSData alloc] initWithBase64EncodedString:licenseString options:0] licenseUpdateCheck:true databasePath:databasePath delayedNNLoadEnabled:false] completion:[self getInitCompletion :successCallback :errorCallback]];
329
- }
330
-
331
327
  - (void) prepareDatabase:(NSString*)dbID :(Callback)successCallback :(Callback)errorCallback{
332
328
  [RGLDocReader.shared prepareDatabase:dbID progressHandler:[self getProgressHandler :successCallback :errorCallback] completion:[self getPrepareCompletion :successCallback :errorCallback]];
333
329
  }
@@ -510,6 +506,10 @@ typedef void (^Callback)(NSString* response);
510
506
  [self result:RGLDocReader.shared.documentReaderStatus :successCallback];
511
507
  }
512
508
 
509
+ - (void) setTCCParams:(NSDictionary*)params :(Callback)successCallback :(Callback)errorCallback{
510
+ [RGLDocReader.shared setTCCParams:[RGLWJSONConstructor RGLTCCParamsFromJson:params] completion:[self getTCCParamsCompletion:successCallback :errorCallback]];
511
+ }
512
+
513
513
  - (void) getRfidSessionStatus:(Callback)successCallback :(Callback)errorCallback{
514
514
  [self result:RGLDocReader.shared.rfidSessionStatus :successCallback];
515
515
  }
@@ -636,4 +636,13 @@ typedef void (^Callback)(NSString* response);
636
636
  };
637
637
  }
638
638
 
639
+ -(void (^_Nullable)(BOOL success, NSError * _Nullable error))getTCCParamsCompletion:(Callback)successCallback :(Callback)errorCallback{
640
+ return ^(BOOL success, NSError * _Nullable error) {
641
+ if (success)
642
+ [self result:@"success" :successCallback];
643
+ else
644
+ [self result:[NSString stringWithFormat:@"%@/%@", @"failed: ", error.description] :errorCallback];
645
+ };
646
+ }
647
+
639
648
  @end
@@ -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];
@@ -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)
@@ -1682,6 +1682,7 @@ const eImageQualityCheckType = {
1682
1682
  IQC_BOUNDS: 5,
1683
1683
  IQC_SCREEN_CAPTURE: 6,
1684
1684
  IQC_PORTRAIT: 7,
1685
+ IQC_HANDWRITTEN: 8,
1685
1686
  }
1686
1687
 
1687
1688
  const eLDS_ParsingErrorCodes = {
@@ -6081,7 +6082,7 @@ DocumentReader.providePACertificates = (certificates, successCallback, errorCall
6081
6082
  DocumentReader.provideTACertificates = (certificates, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["provideTACertificates", certificates])
6082
6083
  DocumentReader.provideTASignature = (certificates, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["provideTASignature", certificates])
6083
6084
  DocumentReader.parseCoreResults = (json, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["parseCoreResults", json])
6084
- DocumentReader.initializeReaderWithDatabasePath = (license, path, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["initializeReaderWithDatabasePath", license, path])
6085
+ DocumentReader.setTCCParams = (params, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["setTCCParams", params])
6085
6086
  DocumentReader.initializeReaderWithDatabase = (license, db, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["initializeReaderWithDatabase", license, db])
6086
6087
  DocumentReader.recognizeImageFrame = (image, params, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["recognizeImageFrame", image, params])
6087
6088
  DocumentReader.recognizeImageWithOpts = (image, options, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["recognizeImageWithOpts", image, options])