@regulaforensics/cordova-plugin-document-reader-api 7.6.18-beta → 7.6.38-beta

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.
@@ -0,0 +1,75 @@
1
+ spec:
2
+ inputs:
3
+ stage:
4
+ default: reports
5
+ image:
6
+ default: ubuntu:22.04
7
+ ignore_vulnerabilities:
8
+ default: "false"
9
+ sast_report_file:
10
+ default: gl-sast-report.json
11
+ secret_detection_report_file:
12
+ default: gl-secret-detection-report.json
13
+ dependency_scanning_report_file:
14
+ default: gl-dependency-scanning-report.json
15
+ ---
16
+
17
+ view reports:
18
+ image: $[[ inputs.image ]]
19
+ stage: $[[ inputs.stage ]]
20
+ variables:
21
+ IGNORE_VULNERABILITIES: $[[ inputs.ignore_vulnerabilities ]]
22
+ SAST_REPORT_FILE: $[[ inputs.sast_report_file ]]
23
+ SECRET_DETECTION_REPORT_FILE: $[[ inputs.secret_detection_report_file ]]
24
+ DEPENDENCY_SCANNING_REPORT_FILE: $[[ inputs.dependency_scanning_report_file ]]
25
+ RED: \033[0;31m
26
+ YELLOW: \033[1;33m
27
+ GREEN: \033[0;32m
28
+ NC: \033[0m
29
+ needs:
30
+ - job: semgrep-sast
31
+ artifacts: true
32
+ - job: secret_detection
33
+ artifacts: true
34
+ - job: gemnasium-dependency_scanning
35
+ artifacts: true
36
+ rules:
37
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
38
+ script:
39
+ - ls -la
40
+ - apt update && apt install -y jq
41
+ - |
42
+ for f in SAST_REPORT_FILE SECRET_DETECTION_REPORT_FILE DEPENDENCY_SCANNING_REPORT_FILE
43
+ do
44
+ if [[ -f "${!f}" ]]
45
+ then
46
+ echo -e "${GREEN}File ${!f} exists, adding report${NC}"
47
+ r=${f/%_FILE}
48
+ declare $r="$(cat ${!f} | jq 'select(.vulnerabilities != []).vulnerabilities')"
49
+ if [[ ! -z "${!r}" ]]
50
+ then
51
+ VULNERABILITIES_FOUND=true
52
+ echo -e "${RED}Found $r vulnerabilities${NC}"
53
+ echo "${!r}"
54
+ echo
55
+ fi
56
+ else
57
+ echo -e "${YELLOW}File ${!f} doesn't exist, skipping${NC}"
58
+ fi
59
+ done
60
+
61
+ if [[ "$VULNERABILITIES_FOUND" == true ]]
62
+ then
63
+ if [[ "$IGNORE_VULNERABILITIES" == true ]]
64
+ then
65
+ echo -e "${GREEN}All found vulnerabilities were ignored due to IGNORE_VULNERABILITIES=true${NC}"
66
+ exit 0
67
+ else
68
+ echo -e "${RED}Vulnerabilities found, please see reports above${NC}"
69
+ exit 1
70
+ fi
71
+ fi
72
+
73
+ echo -e "${GREEN}No vulnerabilities found${NC}"
74
+
75
+ exit 0
package/.gitlab-ci.yml ADDED
@@ -0,0 +1,49 @@
1
+ stages:
2
+ - test
3
+ - reports
4
+
5
+ include:
6
+ - template: Jobs/SAST.gitlab-ci.yml
7
+ - template: Jobs/Secret-Detection.gitlab-ci.yml
8
+ - template: Jobs/Dependency-Scanning.gitlab-ci.yml
9
+ - local: .gitlab/report.yaml
10
+ rules:
11
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
12
+ inputs:
13
+ stage: reports
14
+ image: ubuntu:22.04
15
+ ignore_vulnerabilities: "false"
16
+ sast_report_file: gl-sast-report.json
17
+ secret_detection_report_file: gl-secret-detection-report.json
18
+ dependency_scanning_report_file: gl-dependency-scanning-report.json
19
+
20
+ trivy scan:
21
+ stage: test
22
+ image: aquasec/trivy
23
+ rules:
24
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
25
+ script:
26
+ - trivy fs --severity CRITICAL,HIGH,MEDIUM,LOW --ignore-unfixed --db-repository container-registry.regula.local:80/aquasecurity/trivy-db:2 --exit-code 1 .
27
+
28
+ semgrep-sast:
29
+ rules:
30
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
31
+ artifacts:
32
+ paths:
33
+ - gl-sast-report.json
34
+
35
+ secret_detection:
36
+ rules:
37
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
38
+ artifacts:
39
+ paths:
40
+ - gl-secret-detection-report.json
41
+
42
+ gemnasium-dependency_scanning:
43
+ variables:
44
+ DS_MAX_DEPTH: -1
45
+ rules:
46
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
47
+ artifacts:
48
+ paths:
49
+ - gl-dependency-scanning-report.json
@@ -13,7 +13,7 @@
13
13
  "author": "Regula Forensics Inc.",
14
14
  "license": "commercial",
15
15
  "dependencies": {
16
- "@regulaforensics/cordova-plugin-document-reader-api": "7.6.18-beta",
16
+ "@regulaforensics/cordova-plugin-document-reader-api": "7.6.38-beta",
17
17
  "@regulaforensics/cordova-plugin-document-reader-core-fullauthrfid": "7.5.875",
18
18
  "cordova-android": "13.0.0",
19
19
  "cordova-ios": "7.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/cordova-plugin-document-reader-api",
3
- "version": "7.6.18-beta",
3
+ "version": "7.6.38-beta",
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="@regulaforensics/cordova-plugin-document-reader-api" version="7.6.18-beta" xmlns="http://apache.org/cordova/ns/plugins/1.0">
2
+ <plugin id="@regulaforensics/cordova-plugin-document-reader-api" version="7.6.38-beta" xmlns="http://apache.org/cordova/ns/plugins/1.0">
3
3
  <name>DocumentReaderApi</name>
4
4
  <description>Cordova plugin Document reader api</description>
5
5
  <license>commercial</license>
@@ -14,7 +14,7 @@
14
14
  <feature name="DocumentReader">
15
15
  <param name="ios-package" value="RGLWDocumentReader" />
16
16
  </feature>
17
- <preference name="deployment-target" value="12.0" />
17
+ <preference name="deployment-target" value="13.0" />
18
18
  </config-file>
19
19
  <header-file src="src/ios/RGLWDocumentReader.h" />
20
20
  <source-file src="src/ios/RGLWDocumentReader.m" />
@@ -26,7 +26,7 @@
26
26
  <config>
27
27
  </config>
28
28
  <pods>
29
- <pod name="DocumentReaderBeta" spec="7.5.4164" />
29
+ <pod name="DocumentReaderBeta" spec="7.6.4384" />
30
30
  </pods>
31
31
  </podspec>
32
32
  </platform>
@@ -22,11 +22,10 @@ import android.content.pm.PackageManager.PERMISSION_GRANTED
22
22
  import android.os.Build
23
23
  import android.os.IBinder
24
24
  import android.provider.Settings
25
- import androidx.core.app.ActivityCompat.requestPermissions
26
25
  import androidx.core.content.ContextCompat.checkSelfPermission
27
- import com.regula.documentreader.api.ble.BLEWrapper
28
- import com.regula.documentreader.api.ble.BleWrapperCallback
29
- import com.regula.documentreader.api.ble.RegulaBleService
26
+ import com.regula.common.ble.BLEWrapper
27
+ import com.regula.common.ble.BleWrapperCallback
28
+ import com.regula.common.ble.RegulaBleService
30
29
  import com.regula.documentreader.api.internal.permission.BluetoothPermissionHelper.BLE_ACCESS_PERMISSION
31
30
  import com.regula.documentreader.api.internal.permission.BluetoothSettingsHelper.isBluetoothEnabled
32
31
  import com.regula.documentreader.api.internal.permission.BluetoothSettingsHelper.isLocationServiceEnabled
@@ -67,9 +66,9 @@ fun connectBluetoothDevice(callback: Callback) {
67
66
  Timer().schedule(timer, SEARCHING_TIMEOUT)
68
67
 
69
68
  // start searching devices
70
- val bleIntent = Intent(activity, RegulaBleService::class.java)
71
- activity.startService(bleIntent)
72
- activity.bindService(bleIntent, object : ServiceConnection {
69
+ val bleIntent = Intent(context, RegulaBleService::class.java)
70
+ context.startService(bleIntent)
71
+ context.bindService(bleIntent, object : ServiceConnection {
73
72
  override fun onServiceConnected(name: ComponentName, service: IBinder) {
74
73
  bluetooth = (service as RegulaBleService.LocalBinder).service.bleManager
75
74
  bluetooth.addCallback(object : BleWrapperCallback() {
@@ -88,7 +87,7 @@ fun connectBluetoothDevice(callback: Callback) {
88
87
 
89
88
  fun onRequestPermissionsResult(
90
89
  requestCode: Int,
91
- permissions: Array<out String>,
90
+ permissions: Array<String>,
92
91
  grantResults: IntArray
93
92
  ): Boolean {
94
93
  if (requestCode != BLE_ACCESS_PERMISSION || permissions.isEmpty()) return false
@@ -117,7 +116,7 @@ fun onActivityResult(requestCode: Int, rc: Int, @Suppress("UNUSED_PARAMETER") da
117
116
  }
118
117
 
119
118
  fun isBluetoothSettingsReady(activity: Activity): Boolean {
120
- deniedBluetoothPermissions(activity)?.let {
119
+ deniedBluetoothPermissions()?.let {
121
120
  requestPermissions(activity, it, BLE_ACCESS_PERMISSION)
122
121
  return false
123
122
  }
@@ -132,31 +131,28 @@ fun isBluetoothSettingsReady(activity: Activity): Boolean {
132
131
  return true
133
132
  }
134
133
 
135
- fun deniedBluetoothPermissions(activity: Activity): Array<String>? {
134
+ fun deniedBluetoothPermissions(): Array<String>? {
136
135
  val result = mutableListOf<String>()
137
136
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
138
- result.addAll(deniedBluetoothPermission(activity, BLUETOOTH_SCAN))
139
- result.addAll(deniedBluetoothPermission(activity, BLUETOOTH_CONNECT))
137
+ result.addAll(deniedBluetoothPermission(BLUETOOTH_SCAN))
138
+ result.addAll(deniedBluetoothPermission(BLUETOOTH_CONNECT))
140
139
  } else
141
- result.addAll(deniedBluetoothPermission(activity, ACCESS_FINE_LOCATION))
140
+ result.addAll(deniedBluetoothPermission(ACCESS_FINE_LOCATION))
142
141
  return result.let { if (it.size > 0) it.toTypedArray() else null }
143
142
  }
144
143
 
145
- fun deniedBluetoothPermission(
146
- activity: Activity,
147
- permission: String
148
- ): Array<String> {
149
- if (checkSelfPermission(activity, permission) != PERMISSION_GRANTED)
144
+ fun deniedBluetoothPermission(permission: String): Array<String> {
145
+ if (checkSelfPermission(context, permission) != PERMISSION_GRANTED)
150
146
  return arrayOf(permission)
151
147
  return arrayOf()
152
148
  }
153
149
 
154
150
  fun requestEnableBluetooth(activity: Activity) {
155
151
  val enableIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
156
- activity.startActivityForResult(enableIntent, INTENT_REQUEST_ENABLE_BLUETOOTH)
152
+ startActivityForResult(activity, enableIntent, INTENT_REQUEST_ENABLE_BLUETOOTH)
157
153
  }
158
154
 
159
155
  fun requestEnableLocationService(activity: Activity) {
160
156
  val myIntent = Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)
161
- activity.startActivityForResult(myIntent, INTENT_REQUEST_ENABLE_LOCATION)
157
+ startActivityForResult(activity, myIntent, INTENT_REQUEST_ENABLE_LOCATION)
162
158
  }
@@ -6,6 +6,8 @@
6
6
  // Copyright © 2023 Regula. All rights reserved.
7
7
  //
8
8
 
9
+ @file:Suppress("EnumValuesSoftDeprecate")
10
+
9
11
  package cordova.plugin.documentreader
10
12
 
11
13
  import android.content.Context
@@ -53,6 +55,7 @@ fun setFunctionality(functionality: Functionality, opts: JSONObject) = opts.forE
53
55
  "isCameraTorchCheckDisabled" -> editor.setIsCameraTorchCheckDisabled(v as Boolean)
54
56
  "recordScanningProcess" -> editor.setDoRecordProcessingVideo(v as Boolean)
55
57
  "manualMultipageMode" -> editor.setManualMultipageMode(v as Boolean)
58
+ "torchTurnedOn" -> editor.setTorchTurnedOn(v as Boolean)
56
59
  "showCaptureButtonDelayFromDetect" -> editor.setShowCaptureButtonDelayFromDetect(v.toLong())
57
60
  "showCaptureButtonDelayFromStart" -> editor.setShowCaptureButtonDelayFromStart(v.toLong())
58
61
  "orientation" -> editor.setOrientation(v.toInt())
@@ -86,6 +89,7 @@ fun getFunctionality(functionality: Functionality) = mapOf(
86
89
  "isCameraTorchCheckDisabled" to functionality.isCameraTorchCheckDisabled,
87
90
  "recordScanningProcess" to functionality.doRecordProcessingVideo(),
88
91
  "manualMultipageMode" to functionality.isManualMultipageMode,
92
+ "torchTurnedOn" to functionality.isTorchTurnedOn,
89
93
  "showCaptureButtonDelayFromDetect" to functionality.showCaptureButtonDelayFromDetect,
90
94
  "showCaptureButtonDelayFromStart" to functionality.showCaptureButtonDelayFromStart,
91
95
  "orientation" to functionality.orientation,
@@ -158,7 +162,6 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
158
162
  "dateFormat" -> processParams.dateFormat = v as String
159
163
  "scenario" -> processParams.scenario = v as String
160
164
  "captureButtonScenario" -> processParams.captureButtonScenario = v as String
161
- "sessionLogFolder" -> processParams.sessionLogFolder = v as String
162
165
  "timeout" -> processParams.timeout = v.toDouble()
163
166
  "timeoutFromFirstDetect" -> processParams.timeoutFromFirstDetect = v.toDouble()
164
167
  "timeoutFromFirstDocType" -> processParams.timeoutFromFirstDocType = v.toDouble()
@@ -240,7 +243,6 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
240
243
  "dateFormat" to processParams.dateFormat,
241
244
  "scenario" to processParams.scenario,
242
245
  "captureButtonScenario" to processParams.captureButtonScenario,
243
- "sessionLogFolder" to processParams.sessionLogFolder,
244
246
  "timeout" to processParams.timeout,
245
247
  "timeoutFromFirstDetect" to processParams.timeoutFromFirstDetect,
246
248
  "timeoutFromFirstDocType" to processParams.timeoutFromFirstDocType,
@@ -439,6 +441,7 @@ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach
439
441
  "proceedReadingAlways" -> rfidScenario.proceedReadingAlways = v as Boolean
440
442
  "readDTC" -> rfidScenario.isReadDTC = v as Boolean
441
443
  "mrzStrictCheck" -> rfidScenario.isMrzStrictCheck = v as Boolean
444
+ "loadCRLFromRemote" -> rfidScenario.isLoadCRLFromRemote = v as Boolean
442
445
  "signManagementAction" -> rfidScenario.signManagementAction = v.toInt()
443
446
  "readingBuffer" -> rfidScenario.readingBuffer = v.toInt()
444
447
  "onlineTAToSignDataType" -> rfidScenario.onlineTAToSignDataType = v.toInt()
@@ -458,7 +461,7 @@ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach
458
461
  "ePassportDataGroups" -> setDataGroups(rfidScenario.ePassportDataGroups(), v as JSONObject)
459
462
  "eIDDataGroups" -> setDataGroups(rfidScenario.eIDDataGroups(), v as JSONObject)
460
463
  "eDLDataGroups" -> setDataGroups(rfidScenario.eDLDataGroups(), v as JSONObject)
461
- "dtcDataGroups" -> setDataGroups(rfidScenario.DTCDataGroup(), v as JSONObject)
464
+ "dtcDataGroups" -> setDTCDataGroup(rfidScenario.DTCDataGroup(), v as JSONObject)
462
465
  }
463
466
  }
464
467
 
@@ -499,6 +502,7 @@ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
499
502
  "proceedReadingAlways" to rfidScenario.proceedReadingAlways,
500
503
  "readDTC" to rfidScenario.isReadDTC,
501
504
  "mrzStrictCheck" to rfidScenario.isMrzStrictCheck,
505
+ "loadCRLFromRemote" to rfidScenario.isLoadCRLFromRemote,
502
506
  "signManagementAction" to rfidScenario.signManagementAction,
503
507
  "readingBuffer" to rfidScenario.readingBuffer,
504
508
  "onlineTAToSignDataType" to rfidScenario.onlineTAToSignDataType,
@@ -518,7 +522,7 @@ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
518
522
  "ePassportDataGroups" to getDataGroups(rfidScenario.ePassportDataGroups()),
519
523
  "eIDDataGroups" to getDataGroups(rfidScenario.eIDDataGroups()),
520
524
  "eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups()),
521
- "dtcDataGroups" to getDataGroups(rfidScenario.DTCDataGroup())
525
+ "dtcDataGroups" to getDTCDataGroup(rfidScenario.DTCDataGroup())
522
526
  ).toJsonObject()
523
527
 
524
528
  fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v ->
@@ -552,15 +556,6 @@ fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v
552
556
  "DG20" -> dataGroup.isDG20 = value
553
557
  "DG21" -> dataGroup.isDG21 = value
554
558
  }
555
- if (dataGroup is DTCDataGroup) when (k) {
556
- "DG15" -> dataGroup.isDG15 = value
557
- "DG16" -> dataGroup.isDG16 = value
558
- "DG17" -> dataGroup.isDG17 = value
559
- "DG18" -> dataGroup.isDG18 = value
560
- "DG22" -> dataGroup.isDG22 = value
561
- "DG23" -> dataGroup.isDG23 = value
562
- "DG24" -> dataGroup.isDG24 = value
563
- }
564
559
  }
565
560
 
566
561
  fun getDataGroups(dataGroup: DataGroups): JSONObject {
@@ -593,18 +588,28 @@ fun getDataGroups(dataGroup: DataGroups): JSONObject {
593
588
  result["DG20"] = dataGroup.isDG20
594
589
  result["DG21"] = dataGroup.isDG21
595
590
  }
596
- if (dataGroup is DTCDataGroup) {
597
- result["DG15"] = dataGroup.isDG15
598
- result["DG16"] = dataGroup.isDG16
599
- result["DG17"] = dataGroup.isDG17
600
- result["DG18"] = dataGroup.isDG18
601
- result["DG22"] = dataGroup.isDG22
602
- result["DG23"] = dataGroup.isDG23
603
- result["DG24"] = dataGroup.isDG24
604
- }
605
591
  return result.toJsonObject()
606
592
  }
607
593
 
594
+ fun setDTCDataGroup(dataGroup: DTCDataGroup, opts: JSONObject) = opts.forEach { k, v ->
595
+ val value = v as Boolean
596
+ when (k) {
597
+ "DG17" -> dataGroup.isDG17 = value
598
+ "DG18" -> dataGroup.isDG18 = value
599
+ "DG22" -> dataGroup.isDG22 = value
600
+ "DG23" -> dataGroup.isDG23 = value
601
+ "DG24" -> dataGroup.isDG24 = value
602
+ }
603
+ }
604
+
605
+ fun getDTCDataGroup(dataGroup: DTCDataGroup) = mapOf(
606
+ "DG17" to dataGroup.isDG17,
607
+ "DG18" to dataGroup.isDG18,
608
+ "DG22" to dataGroup.isDG22,
609
+ "DG23" to dataGroup.isDG23,
610
+ "DG24" to dataGroup.isDG24,
611
+ ).toJsonObject()
612
+
608
613
  fun setImageQA(input: ImageQA, opts: JSONObject) = opts.forEach { k, v ->
609
614
  when (k) {
610
615
  "focusCheck" -> input.focusCheck = v as Boolean
@@ -649,6 +654,7 @@ fun setAuthenticityParams(input: AuthenticityParams, opts: JSONObject) = opts.fo
649
654
  "checkPhotoEmbedding" -> input.checkPhotoEmbedding = v as Boolean
650
655
  "checkPhotoComparison" -> input.checkPhotoComparison = v as Boolean
651
656
  "checkLetterScreen" -> input.checkLetterScreen = v as Boolean
657
+ "checkSecurityText" -> input.checkSecurityText = v as Boolean
652
658
  "livenessParams" -> {
653
659
  if (input.livenessParams == null) input.livenessParams = LivenessParams.defaultParams()
654
660
  setLivenessParams(input.livenessParams!!, v as JSONObject)
@@ -672,6 +678,7 @@ fun getAuthenticityParams(input: AuthenticityParams?) = input?.let {
672
678
  "checkPhotoEmbedding" to it.checkPhotoEmbedding,
673
679
  "checkPhotoComparison" to it.checkPhotoComparison,
674
680
  "checkLetterScreen" to it.checkLetterScreen,
681
+ "checkSecurityText" to it.checkSecurityText,
675
682
  "livenessParams" to getLivenessParams(it.livenessParams)
676
683
  ).toJsonObject()
677
684
  }
@@ -682,6 +689,8 @@ fun setLivenessParams(input: LivenessParams, opts: JSONObject) = opts.forEach {
682
689
  "checkMLI" -> input.checkMLI = v as Boolean
683
690
  "checkHolo" -> input.checkHolo = v as Boolean
684
691
  "checkED" -> input.checkED = v as Boolean
692
+ "checkBlackAndWhiteCopy" -> input.checkBlackAndWhiteCopy = v as Boolean
693
+ "checkDynaprint" -> input.checkDynaprint = v as Boolean
685
694
  }
686
695
  }
687
696
 
@@ -690,7 +699,9 @@ fun getLivenessParams(input: LivenessParams?) = input?.let {
690
699
  "checkOVI" to input.checkOVI,
691
700
  "checkMLI" to input.checkMLI,
692
701
  "checkHolo" to input.checkHolo,
693
- "checkED" to input.checkED
702
+ "checkED" to input.checkED,
703
+ "checkBlackAndWhiteCopy" to input.checkBlackAndWhiteCopy,
704
+ "checkDynaprint" to input.checkDynaprint,
694
705
  ).toJsonObject()
695
706
  }
696
707
 
@@ -1,8 +1,8 @@
1
1
  package cordova.plugin.documentreader
2
2
 
3
- import android.annotation.SuppressLint
4
3
  import android.app.Activity
5
4
  import android.app.PendingIntent
5
+ import android.content.Context
6
6
  import android.content.Intent
7
7
  import android.content.IntentFilter
8
8
  import android.nfc.NfcAdapter
@@ -47,31 +47,16 @@ import org.apache.cordova.PluginResult
47
47
  import org.json.JSONArray
48
48
  import org.json.JSONObject
49
49
 
50
- class DocumentReader : CordovaPlugin() {
51
- override fun onNewIntent(intent: Intent) {
52
- newIntent(intent)
53
- }
54
-
55
- override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
56
- myOnActivityResult(requestCode, resultCode, intent)
57
- }
58
-
59
- override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>?, grantResults: IntArray?) {
60
- myOnRequestPermissionsResult(requestCode, permissions!!, grantResults!!)
61
- }
62
-
63
- override fun execute(action: String, args: JSONArray, callbackContext: CallbackContext): Boolean {
64
- activity = cordova.activity
65
- exec(args, callbackContext)
66
- return true
67
- }
68
- }
69
-
70
- fun myOnActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
71
- onActivityResult(requestCode, resultCode, intent)
72
- }
50
+ lateinit var callbackContext: CallbackContext
73
51
 
74
- fun myOnRequestPermissionsResult(requestCode: Int, permissions: Array<out String>?, grantResults: IntArray?) = onRequestPermissionsResult(requestCode, permissions!!, grantResults!!)
52
+ lateinit var args: JSONArray
53
+ lateinit var binding: CordovaPlugin
54
+ val context: Context
55
+ get() = binding.cordova.context
56
+ val activity: Activity
57
+ get() = binding.cordova.activity
58
+ val lifecycle: Lifecycle
59
+ get() = (activity as AppCompatActivity).lifecycle
75
60
 
76
61
  fun sendEvent(event: String, data: Any? = "") {
77
62
  // These events are not working in cordova and ionic because they don't have a method
@@ -99,10 +84,34 @@ fun <T> argsNullable(index: Int): T? = if (args.get(index).toString() != "null")
99
84
  args.get(index) as T
100
85
  } else null
101
86
 
102
- lateinit var args: JSONArray
103
- lateinit var callbackContext: CallbackContext
104
- val lifecycle: Lifecycle
105
- get() = (activity as AppCompatActivity).lifecycle
87
+ class DocumentReader : CordovaPlugin() {
88
+ init {
89
+ binding = this
90
+ }
91
+
92
+ override fun onNewIntent(intent: Intent) {
93
+ newIntent(intent)
94
+ }
95
+
96
+ override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
97
+ myOnActivityResult(requestCode, resultCode, intent)
98
+ }
99
+
100
+ @Suppress("OVERRIDE_DEPRECATION")
101
+ override fun onRequestPermissionResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
102
+ myOnRequestPermissionsResult(requestCode, permissions, grantResults)
103
+ }
104
+
105
+ override fun execute(action: String, args: JSONArray, callbackContext: CallbackContext): Boolean {
106
+ exec(args, callbackContext)
107
+ return true
108
+ }
109
+ }
110
+
111
+ fun requestPermissions(@Suppress("UNUSED_PARAMETER") activity: Activity, permissions: Array<String>, requestCode: Int) = binding.cordova.requestPermissions(binding, requestCode, permissions)
112
+ fun startActivityForResult(@Suppress("UNUSED_PARAMETER") activity: Activity, intent: Intent, requestCode: Int) = binding.cordova.startActivityForResult(binding, intent, requestCode)
113
+ fun myOnRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) = onRequestPermissionsResult(requestCode, permissions, grantResults)
114
+ fun myOnActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) = onActivityResult(requestCode, resultCode, intent)
106
115
 
107
116
  fun exec(arguments: JSONArray, tempContext: CallbackContext) {
108
117
  args = arguments
@@ -192,14 +201,6 @@ interface Callback {
192
201
  fun error(message: String)
193
202
  }
194
203
 
195
- @SuppressLint("StaticFieldLeak")
196
- lateinit var activity: Activity
197
- lateinit var lifecycleObserver: LifecycleEventObserver
198
- val context
199
- get() = activity
200
-
201
- var backgroundRFIDEnabled = false
202
-
203
204
  const val eventCompletion = "completion"
204
205
  const val eventDatabaseProgress = "database_progress"
205
206
 
@@ -507,6 +508,9 @@ fun newIntent(intent: Intent): Boolean {
507
508
  return true
508
509
  }
509
510
 
511
+ var backgroundRFIDEnabled = false
512
+ lateinit var lifecycleObserver: LifecycleEventObserver
513
+
510
514
  fun startForegroundDispatch() {
511
515
  backgroundRFIDEnabled = true
512
516
  val filters: Array<IntentFilter?> = arrayOfNulls(1)
@@ -514,9 +518,9 @@ fun startForegroundDispatch() {
514
518
  filters[0]!!.addAction(NfcAdapter.ACTION_TECH_DISCOVERED)
515
519
  filters[0]!!.addCategory(Intent.CATEGORY_DEFAULT)
516
520
  val techList = arrayOf(arrayOf("android.nfc.tech.IsoDep"))
517
- val intent = Intent(context, context.javaClass)
521
+ val intent = Intent(activity, activity.javaClass)
518
522
  val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
519
- val pendingIntent = PendingIntent.getActivity(context, 0, intent, flag)
523
+ val pendingIntent = PendingIntent.getActivity(activity, 0, intent, flag)
520
524
 
521
525
  if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
522
526
  enableForegroundDispatch(pendingIntent, filters, techList)
@@ -527,7 +531,7 @@ fun startForegroundDispatch() {
527
531
  else -> Unit
528
532
  }
529
533
  }
530
- context.runOnUiThread { lifecycle.addObserver(lifecycleObserver) }
534
+ activity.runOnUiThread { lifecycle.addObserver(lifecycleObserver) }
531
535
  }
532
536
 
533
537
  fun enableForegroundDispatch(
@@ -536,15 +540,15 @@ fun enableForegroundDispatch(
536
540
  techList: Array<Array<String>>
537
541
  ) = NfcAdapter.getDefaultAdapter(context).enableForegroundDispatch(activity, pendingIntent, filters, techList)
538
542
 
539
- fun disableForegroundDispatch() = NfcAdapter.getDefaultAdapter(activity).disableForegroundDispatch(activity)
543
+ fun disableForegroundDispatch() = NfcAdapter.getDefaultAdapter(context).disableForegroundDispatch(activity)
540
544
 
541
545
  fun stopBackgroundRFID() {
542
546
  if (!backgroundRFIDEnabled) return
543
547
  backgroundRFIDEnabled = false
544
548
  if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
545
549
  disableForegroundDispatch()
546
- context.runOnUiThread { lifecycle.removeObserver(lifecycleObserver) }
550
+ activity.runOnUiThread { lifecycle.removeObserver(lifecycleObserver) }
547
551
  }
548
552
 
549
553
  // Weak references
550
- var localizationCallbacks: LocalizationCallbacks? = null
554
+ var localizationCallbacks: LocalizationCallbacks? = null
@@ -26,6 +26,7 @@ import com.regula.documentreader.api.enums.PDF417Info
26
26
  import com.regula.documentreader.api.enums.eGraphicFieldType
27
27
  import com.regula.documentreader.api.enums.eRFID_DataFile_Type
28
28
  import com.regula.documentreader.api.enums.eRPRM_Lights
29
+ import com.regula.documentreader.api.listener.NetworkInterceptorListener
29
30
  import com.regula.documentreader.api.params.AuthenticityParams
30
31
  import com.regula.documentreader.api.params.BackendProcessingConfig
31
32
  import com.regula.documentreader.api.params.BleDeviceConfig
@@ -106,6 +107,8 @@ import cordova.plugin.documentreader.Convert.generateByteArray
106
107
  import org.json.JSONArray
107
108
  import org.json.JSONObject
108
109
 
110
+ val weakReferencesHolder = mutableListOf<Any>()
111
+
109
112
  fun generateCompletion(action: Int, results: DocumentReaderResults?, error: RegulaException?, context: Context?) = object : JSONObject() { init {
110
113
  put("action", action)
111
114
  if (listOf(
@@ -175,6 +178,7 @@ fun transactionInfoFromJSON(temp: JSONObject?): TransactionInfo? {
175
178
 
176
179
  if (input.has("transactionId")) result.transactionId = input.getString("transactionId")
177
180
  if (input.has("tag")) result.tag = input.getString("tag")
181
+ if (input.has("sessionLogFolder")) result.sessionLogFolder = input.getString("sessionLogFolder")
178
182
 
179
183
  return result
180
184
  }
@@ -186,6 +190,7 @@ fun generateTransactionInfo(temp: TransactionInfo?): JSONObject? {
186
190
 
187
191
  result.put("transactionId", input.transactionId)
188
192
  result.put("tag", input.tag)
193
+ result.put("sessionLogFolder", input.sessionLogFolder)
189
194
 
190
195
  return result
191
196
  }
@@ -366,6 +371,11 @@ fun onlineProcessingConfigFromJSON(temp: JSONObject?): OnlineProcessingConfig? {
366
371
  if (input.has("url")) builder.setUrl(input.getString("url"))
367
372
  if (input.has("imageCompressionQuality")) builder.setImageCompressionQuality(input.getDouble("imageCompressionQuality").toFloat())
368
373
  if (input.has("processParams")) builder.setProcessParams(processParamFromJSON(input.getJSONObject("processParams")))
374
+ if (input.has("requestHeaders")) {
375
+ val listener = NetworkInterceptorListener { input.getJSONObject("requestHeaders").forEach { k, v -> it.setRequestProperty(k, v as String) } }
376
+ weakReferencesHolder.add(listener)
377
+ builder.setNetworkInterceptorListener(listener)
378
+ }
369
379
 
370
380
  return builder.build()
371
381
  }
@@ -524,13 +534,13 @@ fun eIDDataGroupsFromJSON(input: JSONObject): EIDDataGroups {
524
534
 
525
535
  fun generateEIDDataGroups(input: EIDDataGroups): JSONObject = getDataGroups(input)
526
536
 
527
- fun dtcDataGroupsFromJSON(input: JSONObject): DTCDataGroup {
537
+ fun dtcDataGroupFromJSON(input: JSONObject): DTCDataGroup {
528
538
  val result = DTCDataGroup()
529
- setDataGroups(result, input)
539
+ setDTCDataGroup(result, input)
530
540
  return result
531
541
  }
532
542
 
533
- fun generateDTCDataGroups(input: DTCDataGroup): JSONObject = getDataGroups(input)
543
+ fun generateDTCDataGroup(input: DTCDataGroup): JSONObject = getDTCDataGroup(input)
534
544
 
535
545
  fun rfidScenarioFromJSON(input: JSONObject): RfidScenario {
536
546
  val result = RfidScenario()
@@ -1713,6 +1723,7 @@ fun generateDocumentReaderAuthenticityResult(temp: DocumentReaderAuthenticityRes
1713
1723
  temp ?: return null
1714
1724
  val input: DocumentReaderAuthenticityResult = temp
1715
1725
 
1726
+ @Suppress("DEPRECATION")
1716
1727
  result.put("status", input.status)
1717
1728
  result.put("checks", generateList(input.checks, ::generateDocumentReaderAuthenticityCheck, context))
1718
1729
 
@@ -2181,7 +2192,7 @@ fun documentReaderResultsFromJSON(temp: JSONObject?): DocumentReaderResults? {
2181
2192
  result.status = documentReaderResultsStatusFromJSON(input.optJSONObject("status"))!!
2182
2193
  result.vdsncData = vdsncDataFromJSON(input.optJSONObject("vdsncData")!!)
2183
2194
  result.dtcData = input.getString("dtcData")
2184
- result.transactionInfo = transactionInfoFromJSON(input.optJSONObject("transactionInfo"))
2195
+ result.transactionInfo = transactionInfoFromJSON(input.optJSONObject("transactionInfo"))!!
2185
2196
 
2186
2197
  return result
2187
2198
  }
@@ -14,7 +14,7 @@ repositories {
14
14
 
15
15
  dependencies {
16
16
  //noinspection GradleDependency
17
- implementation ('com.regula.documentreader:api:7.5.10445'){
17
+ implementation ('com.regula.documentreader:api:7.6.10624'){
18
18
  transitive = true
19
19
  }
20
20
  }
@@ -23,6 +23,7 @@
23
23
  +(void)setCustomization:(NSDictionary*)options :(RGLCustomization*)customization;
24
24
  +(void)setRfidScenario:(NSDictionary*)options :(RGLRFIDScenario*)rfidScenario;
25
25
  +(void)setDataGroups:(RGLDataGroup*)dataGroup dict:(NSDictionary*)dict;
26
+ +(void)setDTCDataGroup:(RGLDTCDataGroup*)dataGroup dict:(NSDictionary*)dict;
26
27
  +(void)setImageQA:(RGLImageQA*)result input:(NSDictionary*)input;
27
28
  +(void)setAuthenticityParams:(RGLAuthenticityParams*)result input:(NSDictionary*)input;
28
29
  +(void)setLivenessParams:(RGLLivenessParams*)result input:(NSDictionary*)input;
@@ -32,6 +33,7 @@
32
33
  +(NSDictionary*)getCustomization:(RGLCustomization*)customization;
33
34
  +(NSDictionary*)getRfidScenario:(RGLRFIDScenario*)rfidScenario;
34
35
  +(NSDictionary*)getDataGroups:(RGLDataGroup*)dataGroup;
36
+ +(NSDictionary*)getDTCDataGroup:(RGLDTCDataGroup*)dataGroup;
35
37
  +(NSDictionary*)getImageQA:(RGLImageQA*)input;
36
38
  +(NSDictionary*)getAuthenticityParams:(RGLAuthenticityParams*)input;
37
39
  +(NSDictionary*)getLivenessParams:(RGLLivenessParams*)input;
@@ -41,6 +41,7 @@
41
41
  functionality.manualMultipageMode = [[options valueForKey:@"manualMultipageMode"] boolValue];
42
42
  if([options valueForKey:@"singleResult"] != nil)
43
43
  functionality.singleResult = [[options valueForKey:@"singleResult"] boolValue];
44
+ if(options[@"torchTurnedOn"]) functionality.torchTurnedOn = [options[@"torchTurnedOn"] boolValue];
44
45
 
45
46
  // Int
46
47
  if([options valueForKey:@"showCaptureButtonDelayFromDetect"] != nil)
@@ -94,6 +95,7 @@
94
95
  result[@"recordScanningProcess"] = [NSNumber numberWithBool:functionality.recordScanningProcess];
95
96
  result[@"manualMultipageMode"] = [NSNumber numberWithBool:functionality.manualMultipageMode];
96
97
  result[@"singleResult"] = [NSNumber numberWithBool:functionality.singleResult];
98
+ result[@"torchTurnedOn"] = @(functionality.torchTurnedOn);
97
99
 
98
100
  // Int
99
101
  result[@"showCaptureButtonDelayFromDetect"] = [NSNumber numberWithDouble:functionality.showCaptureButtonDelayFromDetect];
@@ -337,7 +339,6 @@
337
339
  result[@"dateFormat"] = processParams.dateFormat;
338
340
  result[@"scenario"] = processParams.scenario;
339
341
  result[@"captureButtonScenario"] = processParams.captureButtonScenario;
340
- result[@"sessionLogFolder"] = processParams.sessionLogFolder;
341
342
 
342
343
  // Double
343
344
  result[@"timeout"] = processParams.timeout;
@@ -662,6 +663,7 @@
662
663
  rfidScenario.proceedReadingAlways = [[options valueForKey:@"proceedReadingAlways"] boolValue];
663
664
  if(options[@"readDTC"]) rfidScenario.readDTC = [options[@"readDTC"] boolValue];
664
665
  if(options[@"mrzStrictCheck"]) rfidScenario.mrzStrictCheck = options[@"mrzStrictCheck"];
666
+ if(options[@"loadCRLFromRemote"]) rfidScenario.loadCRLFromRemote = options[@"loadCRLFromRemote"];
665
667
 
666
668
  // Int
667
669
  if([options valueForKey:@"signManagementAction"] != nil)
@@ -705,7 +707,7 @@
705
707
  [self setDataGroups :rfidScenario.eIDDataGroups dict:[options valueForKey:@"eIDDataGroups"]];
706
708
  if([options valueForKey:@"eDLDataGroups"] != nil)
707
709
  [self setDataGroups :rfidScenario.eDLDataGroups dict:[options valueForKey:@"eDLDataGroups"]];
708
- if(options[@"dtcDataGroups"]) [self setDataGroups :rfidScenario.DTCDataGroups dict:options[@"dtcDataGroups"]];
710
+ if(options[@"dtcDataGroups"]) [self setDTCDataGroup :rfidScenario.DTCDataGroups dict:options[@"dtcDataGroups"]];
709
711
  }
710
712
 
711
713
  +(NSDictionary*)getRfidScenario:(RGLRFIDScenario*)rfidScenario {
@@ -748,6 +750,7 @@
748
750
  result[@"proceedReadingAlways"] = [NSNumber numberWithBool:rfidScenario.proceedReadingAlways];
749
751
  result[@"readDTC"] = [NSNumber numberWithBool:rfidScenario.readDTC];
750
752
  result[@"mrzStrictCheck"] = rfidScenario.mrzStrictCheck;
753
+ result[@"loadCRLFromRemote"] = @(rfidScenario.loadCRLFromRemote);
751
754
 
752
755
  // Int
753
756
  result[@"signManagementAction"] = [NSNumber numberWithInteger:rfidScenario.signManagementAction];
@@ -773,7 +776,7 @@
773
776
  result[@"eDLDataGroups"] = [self getDataGroups:rfidScenario.eDLDataGroups];
774
777
  result[@"ePassportDataGroups"] = [self getDataGroups:rfidScenario.ePassportDataGroups];
775
778
  result[@"eIDDataGroups"] = [self getDataGroups:rfidScenario.eIDDataGroups];
776
- result[@"dtcDataGroups"] = [self getDataGroups:rfidScenario.DTCDataGroups];
779
+ result[@"dtcDataGroups"] = [self getDTCDataGroup:rfidScenario.DTCDataGroups];
777
780
 
778
781
  return result;
779
782
  }
@@ -835,17 +838,6 @@
835
838
  if([dict valueForKey:@"DG21"] != nil)
836
839
  ((RGLeIDDataGroup*)dataGroup).dG21 = [[dict valueForKey:@"DG21"] boolValue];
837
840
  }
838
-
839
- // DTCDataGroups: 1-18 & 22-24
840
- if ([dataGroup class] == [RGLDTCDataGroup class]) {
841
- if(dict[@"DG15"]) ((RGLDTCDataGroup*)dataGroup).dG15 = [dict[@"DG15"] boolValue];
842
- if(dict[@"DG16"]) ((RGLDTCDataGroup*)dataGroup).dG16 = [dict[@"DG16"] boolValue];
843
- if(dict[@"DG17"]) ((RGLDTCDataGroup*)dataGroup).dG17 = [dict[@"DG17"] boolValue];
844
- if(dict[@"DG18"]) ((RGLDTCDataGroup*)dataGroup).dG18 = [dict[@"DG18"] boolValue];
845
- if(dict[@"DG22"]) ((RGLDTCDataGroup*)dataGroup).dG22 = [dict[@"DG22"] boolValue];
846
- if(dict[@"DG23"]) ((RGLDTCDataGroup*)dataGroup).dG23 = [dict[@"DG23"] boolValue];
847
- if(dict[@"DG24"]) ((RGLDTCDataGroup*)dataGroup).dG24 = [dict[@"DG24"] boolValue];
848
- }
849
841
  }
850
842
 
851
843
  +(NSDictionary *)getDataGroups:(RGLDataGroup*)dataGroup {
@@ -884,16 +876,25 @@
884
876
  result[@"DG21"] = [NSNumber numberWithBool:((RGLeIDDataGroup*)dataGroup).dG21];
885
877
  }
886
878
 
887
- // DTCDataGroups: 1-18 & 22-24
888
- if ([dataGroup class] == [RGLDTCDataGroup class]) {
889
- result[@"DG15"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG15];
890
- result[@"DG16"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG16];
891
- result[@"DG17"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG17];
892
- result[@"DG18"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG18];
893
- result[@"DG22"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG22];
894
- result[@"DG23"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG23];
895
- result[@"DG24"] = [NSNumber numberWithBool:((RGLDTCDataGroup*)dataGroup).dG24];
896
- }
879
+ return result;
880
+ }
881
+
882
+ +(void)setDTCDataGroup:(RGLDTCDataGroup*)dataGroup dict:(NSDictionary*)dict {
883
+ if(dict[@"DG17"]) dataGroup.dG17 = [dict[@"DG17"] boolValue];
884
+ if(dict[@"DG18"]) dataGroup.dG18 = [dict[@"DG18"] boolValue];
885
+ if(dict[@"DG22"]) dataGroup.dG22 = [dict[@"DG22"] boolValue];
886
+ if(dict[@"DG23"]) dataGroup.dG23 = [dict[@"DG23"] boolValue];
887
+ if(dict[@"DG24"]) dataGroup.dG24 = [dict[@"DG24"] boolValue];
888
+ }
889
+
890
+ +(NSDictionary *)getDTCDataGroup:(RGLDTCDataGroup*)dataGroup {
891
+ NSMutableDictionary *result = [NSMutableDictionary new];
892
+
893
+ result[@"DG17"] = @(dataGroup.dG17);
894
+ result[@"DG18"] = @(dataGroup.dG18);
895
+ result[@"DG22"] = @(dataGroup.dG22);
896
+ result[@"DG23"] = @(dataGroup.dG23);
897
+ result[@"DG24"] = @(dataGroup.dG24);
897
898
 
898
899
  return result;
899
900
  }
@@ -978,6 +979,7 @@
978
979
  result.checkPhotoComparison = [input valueForKey:@"checkPhotoComparison"];
979
980
  if([input valueForKey:@"checkLetterScreen"] != nil)
980
981
  result.checkLetterScreen = [input valueForKey:@"checkLetterScreen"];
982
+ if(input[@"checkSecurityText"]) result.checkSecurityText = input[@"checkSecurityText"];
981
983
  }
982
984
 
983
985
  +(NSDictionary*)getAuthenticityParams:(RGLAuthenticityParams*)input {
@@ -999,6 +1001,7 @@
999
1001
  result[@"checkPhotoEmbedding"] = input.checkPhotoEmbedding;
1000
1002
  result[@"checkPhotoComparison"] = input.checkPhotoComparison;
1001
1003
  result[@"checkLetterScreen"] = input.checkLetterScreen;
1004
+ result[@"checkSecurityText"] = input.checkSecurityText;
1002
1005
 
1003
1006
  return result;
1004
1007
  }
@@ -1012,6 +1015,8 @@
1012
1015
  result.checkHolo = [input valueForKey:@"checkHolo"];
1013
1016
  if([input valueForKey:@"checkED"] != nil)
1014
1017
  result.checkED = [input valueForKey:@"checkED"];
1018
+ if(input[@"checkBlackAndWhiteCopy"]) result.checkBlackAndWhiteCopy = input[@"checkBlackAndWhiteCopy"];
1019
+ if(input[@"checkDynaprint"]) result.checkDynaprint = input[@"checkDynaprint"];
1015
1020
  }
1016
1021
 
1017
1022
  +(NSDictionary*)getLivenessParams:(RGLLivenessParams*)input {
@@ -1022,6 +1027,8 @@
1022
1027
  result[@"checkMLI"] = input.checkMLI;
1023
1028
  result[@"checkHolo"] = input.checkHolo;
1024
1029
  result[@"checkED"] = input.checkED;
1030
+ result[@"checkBlackAndWhiteCopy"] = input.checkBlackAndWhiteCopy;
1031
+ result[@"checkDynaprint"] = input.checkDynaprint;
1025
1032
 
1026
1033
  return result;
1027
1034
  }
@@ -63,8 +63,8 @@
63
63
  +(NSDictionary* _Nullable)generateEPassportDataGroups:(RGLePassportDataGroup* _Nullable)input;
64
64
  +(RGLeIDDataGroup* _Nullable)eIDDataGroupsFromJson:(NSDictionary* _Nullable)input;
65
65
  +(NSDictionary* _Nullable)generateEIDDataGroups:(RGLeIDDataGroup* _Nullable)input;
66
- +(RGLeIDDataGroup* _Nullable)dtcDataGroupsFromJson:(NSDictionary* _Nullable)input;
67
- +(NSDictionary* _Nullable)generateRGLDTCDataGroups:(RGLeIDDataGroup* _Nullable)input;
66
+ +(RGLeIDDataGroup* _Nullable)dtcDataGroupFromJson:(NSDictionary* _Nullable)input;
67
+ +(NSDictionary* _Nullable)generateRGLDTCDataGroup:(RGLeIDDataGroup* _Nullable)input;
68
68
  +(RGLRFIDScenario* _Nullable)rfidScenarioFromJson:(NSDictionary* _Nullable)input;
69
69
  +(NSDictionary* _Nullable)generateRFIDScenario:(RGLRFIDScenario* _Nullable)input;
70
70
  +(RGLCustomization* _Nullable)customizationFromJson:(NSDictionary* _Nullable)input;
@@ -184,4 +184,9 @@
184
184
  +(NSDictionary* _Nullable)generateTransactionInfo:(RGLTransactionInfo* _Nullable)input;
185
185
 
186
186
  @end
187
+
188
+ @interface RGLWRequestInterceptorProxy : NSObject <RGLURLRequestInterceptingDelegate>
189
+ - (instancetype _Nonnull)initWithHeaders:(NSDictionary*_Nonnull)headers;
190
+ @end
191
+
187
192
  #endif
@@ -11,6 +11,13 @@
11
11
 
12
12
  @implementation RGLWJSONConstructor
13
13
 
14
+ static NSMutableArray* weakReferencesHolder;
15
+ +(void) holdWeakReference:(id)reference {
16
+ if(!weakReferencesHolder)
17
+ weakReferencesHolder = [NSMutableArray new];
18
+ [weakReferencesHolder addObject:reference];
19
+ }
20
+
14
21
  +(NSString*)dictToString:(NSDictionary*)input {
15
22
  if(input == nil) return nil;
16
23
  return [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:input options:NSJSONWritingPrettyPrinted error:nil] encoding:NSUTF8StringEncoding];
@@ -104,8 +111,9 @@
104
111
 
105
112
  NSString* transactionId = [input valueForKey:@"transactionId"];
106
113
  NSString* tag = [input valueForKey:@"tag"];
114
+ NSString* sessionLogFolder = input[@"sessionLogFolder"];
107
115
 
108
- return [[RGLTransactionInfo alloc] initWithTag:tag transactionId:transactionId];
116
+ return [[RGLTransactionInfo alloc] initWithTag:tag transactionId:transactionId sessionLogFolder:sessionLogFolder];
109
117
  }
110
118
 
111
119
  +(NSDictionary*)generateTransactionInfo:(RGLTransactionInfo*)input {
@@ -114,6 +122,7 @@
114
122
 
115
123
  result[@"transactionId"] = input.transactionId;
116
124
  result[@"tag"] = input.tag;
125
+ result[@"sessionLogFolder"] = input.sessionLogFolder;
117
126
 
118
127
  return result;
119
128
  }
@@ -349,14 +358,14 @@
349
358
  return [RGLWConfig getDataGroups:input];
350
359
  }
351
360
 
352
- +(RGLDTCDataGroup*)dtcDataGroupsFromJson:(NSDictionary*)input {
361
+ +(RGLDTCDataGroup*)dtcDataGroupFromJson:(NSDictionary*)input {
353
362
  RGLDTCDataGroup *result = [RGLDTCDataGroup new];
354
- [RGLWConfig setDataGroups :result dict:input];
363
+ [RGLWConfig setDTCDataGroup:result dict:input];
355
364
  return result;
356
365
  }
357
366
 
358
- +(NSDictionary*)generateRGLDTCDataGroups:(RGLDTCDataGroup*)input {
359
- return [RGLWConfig getDataGroups:input];
367
+ +(NSDictionary*)generateRGLDTCDataGroup:(RGLDTCDataGroup*)input {
368
+ return [RGLWConfig getDTCDataGroup:input];
360
369
  }
361
370
 
362
371
  +(RGLRFIDScenario*)rfidScenarioFromJson:(NSDictionary*)input {
@@ -406,6 +415,11 @@
406
415
  [RGLWConfig setProcessParams:[input valueForKey:@"processParams"] :params];
407
416
  result.processParams = params;
408
417
  }
418
+ if([input valueForKey:@"requestHeaders"] != nil) {
419
+ RGLWRequestInterceptorProxy* proxy = [[RGLWRequestInterceptorProxy alloc] initWithHeaders:[input valueForKey:@"requestHeaders"]];
420
+ [self holdWeakReference: proxy];
421
+ result.requestInterceptingDelegate = proxy;
422
+ }
409
423
 
410
424
  return result;
411
425
  }
@@ -1684,10 +1698,12 @@
1684
1698
  NSMutableArray<RGLAuthenticityElement*> *array = [NSMutableArray new];
1685
1699
  for(NSDictionary* item in [input valueForKey:@"elements"])
1686
1700
  [array addObject:[self authenticityElementFromJson:item]];
1687
- return [[RGLAuthenticityCheck alloc]
1688
- initWithAuthenticity:[[input valueForKey:@"type"] integerValue]
1689
- elements:array
1690
- pageIndex:[[input valueForKey:@"pageIndex"] integerValue]];
1701
+ RGLAuthenticityCheck* result = [[RGLAuthenticityCheck alloc]
1702
+ initWithAuthenticity:[[input valueForKey:@"type"] integerValue]
1703
+ elements:array
1704
+ pageIndex:[[input valueForKey:@"pageIndex"] integerValue]];
1705
+ if (input[@"status"]) [result setValue:input[@"status"] forKey:@"status"];
1706
+ return result;;
1691
1707
  }
1692
1708
 
1693
1709
  +(NSDictionary*)generateAuthenticityCheck:(RGLAuthenticityCheck*)input {
@@ -1790,8 +1806,10 @@
1790
1806
  NSMutableArray<RGLAuthenticityCheck*> *array = [NSMutableArray new];
1791
1807
  for(NSDictionary* item in [input valueForKey:@"checks"])
1792
1808
  [array addObject:[self authenticityCheckFromJson:item]];
1793
- return [[RGLDocumentReaderAuthenticityResult alloc]
1794
- initWithAuthenticityChecks:array];
1809
+ RGLDocumentReaderAuthenticityResult* result = [[RGLDocumentReaderAuthenticityResult alloc]
1810
+ initWithAuthenticityChecks:array];
1811
+ if (input[@"status"]) [result setValue:input[@"status"] forKey:@"_security"];
1812
+ return result;
1795
1813
  }
1796
1814
 
1797
1815
  +(NSDictionary*)generateDocumentReaderAuthenticityResult:(RGLDocumentReaderAuthenticityResult*)input {
@@ -2336,3 +2354,22 @@
2336
2354
  }
2337
2355
 
2338
2356
  @end
2357
+
2358
+ @implementation RGLWRequestInterceptorProxy {
2359
+ NSDictionary* _headers;
2360
+ }
2361
+
2362
+ - (instancetype)initWithHeaders:(NSDictionary*)headers {
2363
+ self = [super init];
2364
+ _headers = [headers copy];
2365
+ return self;
2366
+ }
2367
+
2368
+ -(NSURLRequest*)interceptorPrepareRequest:(NSURLRequest*)request {
2369
+ NSMutableURLRequest *interceptedRequest = [request mutableCopy];
2370
+ for (NSString* key in _headers.allKeys)
2371
+ [interceptedRequest addValue:[_headers valueForKey:key] forHTTPHeaderField:key];
2372
+ return interceptedRequest;
2373
+ }
2374
+
2375
+ @end
@@ -996,6 +996,7 @@ class OnlineProcessingConfig {
996
996
  result.processParams = ProcessParams.fromJson(jsonObject["processParams"])
997
997
  result.imageFormat = jsonObject["imageFormat"]
998
998
  result.imageCompressionQuality = jsonObject["imageCompressionQuality"]
999
+ result.requestHeaders = jsonObject["requestHeaders"]
999
1000
 
1000
1001
  return result
1001
1002
  }
@@ -1095,6 +1096,7 @@ class TransactionInfo {
1095
1096
 
1096
1097
  result.transactionId = jsonObject["transactionId"]
1097
1098
  result.tag = jsonObject["tag"]
1099
+ result.sessionLogFolder = jsonObject["sessionLogFolder"]
1098
1100
 
1099
1101
  return result
1100
1102
  }
@@ -1179,6 +1181,7 @@ class Functionality {
1179
1181
  result.recordScanningProcess = jsonObject["recordScanningProcess"]
1180
1182
  result.manualMultipageMode = jsonObject["manualMultipageMode"]
1181
1183
  result.singleResult = jsonObject["singleResult"]
1184
+ result.torchTurnedOn = jsonObject["torchTurnedOn"]
1182
1185
  result.showCaptureButtonDelayFromDetect = jsonObject["showCaptureButtonDelayFromDetect"]
1183
1186
  result.showCaptureButtonDelayFromStart = jsonObject["showCaptureButtonDelayFromStart"]
1184
1187
  result.rfidTimeout = jsonObject["rfidTimeout"]
@@ -1308,6 +1311,8 @@ class LivenessParams {
1308
1311
  result.checkMLI = jsonObject["checkMLI"]
1309
1312
  result.checkHolo = jsonObject["checkHolo"]
1310
1313
  result.checkED = jsonObject["checkED"]
1314
+ result.checkBlackAndWhiteCopy = jsonObject["checkBlackAndWhiteCopy"]
1315
+ result.checkDynaprint = jsonObject["checkDynaprint"]
1311
1316
 
1312
1317
  return result
1313
1318
  }
@@ -1333,6 +1338,7 @@ class AuthenticityParams {
1333
1338
  result.checkPhotoEmbedding = jsonObject["checkPhotoEmbedding"]
1334
1339
  result.checkPhotoComparison = jsonObject["checkPhotoComparison"]
1335
1340
  result.checkLetterScreen = jsonObject["checkLetterScreen"]
1341
+ result.checkSecurityText = jsonObject["checkSecurityText"]
1336
1342
 
1337
1343
  return result
1338
1344
  }
@@ -1396,7 +1402,6 @@ class ProcessParams {
1396
1402
  result.dateFormat = jsonObject["dateFormat"]
1397
1403
  result.scenario = jsonObject["scenario"]
1398
1404
  result.captureButtonScenario = jsonObject["captureButtonScenario"]
1399
- result.sessionLogFolder = jsonObject["sessionLogFolder"]
1400
1405
  result.timeout = jsonObject["timeout"]
1401
1406
  result.timeoutFromFirstDetect = jsonObject["timeoutFromFirstDetect"]
1402
1407
  result.timeoutFromFirstDocType = jsonObject["timeoutFromFirstDocType"]
@@ -1670,27 +1675,11 @@ class EIDDataGroups {
1670
1675
  }
1671
1676
  }
1672
1677
 
1673
- class DTCDataGroups {
1678
+ class DTCDataGroup {
1674
1679
  static fromJson(jsonObject) {
1675
1680
  if (jsonObject == null) return null
1676
- const result = new DTCDataGroups()
1681
+ const result = new DTCDataGroup()
1677
1682
 
1678
- result.DG1 = jsonObject["DG1"]
1679
- result.DG2 = jsonObject["DG2"]
1680
- result.DG3 = jsonObject["DG3"]
1681
- result.DG4 = jsonObject["DG4"]
1682
- result.DG5 = jsonObject["DG5"]
1683
- result.DG6 = jsonObject["DG6"]
1684
- result.DG7 = jsonObject["DG7"]
1685
- result.DG8 = jsonObject["DG8"]
1686
- result.DG9 = jsonObject["DG9"]
1687
- result.DG10 = jsonObject["DG10"]
1688
- result.DG11 = jsonObject["DG11"]
1689
- result.DG12 = jsonObject["DG12"]
1690
- result.DG13 = jsonObject["DG13"]
1691
- result.DG14 = jsonObject["DG14"]
1692
- result.DG15 = jsonObject["DG15"]
1693
- result.DG16 = jsonObject["DG16"]
1694
1683
  result.DG17 = jsonObject["DG17"]
1695
1684
  result.DG18 = jsonObject["DG18"]
1696
1685
  result.DG22 = jsonObject["DG22"]
@@ -1742,6 +1731,7 @@ class RFIDScenario {
1742
1731
  result.proceedReadingAlways = jsonObject["proceedReadingAlways"]
1743
1732
  result.readDTC = jsonObject["readDTC"]
1744
1733
  result.mrzStrictCheck = jsonObject["mrzStrictCheck"]
1734
+ result.loadCRLFromRemote = jsonObject["loadCRLFromRemote"]
1745
1735
  result.readingBuffer = jsonObject["readingBuffer"]
1746
1736
  result.onlineTAToSignDataType = jsonObject["onlineTAToSignDataType"]
1747
1737
  result.defaultReadingBufferSize = jsonObject["defaultReadingBufferSize"]
@@ -1761,7 +1751,7 @@ class RFIDScenario {
1761
1751
  result.eDLDataGroups = EDLDataGroups.fromJson(jsonObject["eDLDataGroups"])
1762
1752
  result.ePassportDataGroups = EPassportDataGroups.fromJson(jsonObject["ePassportDataGroups"])
1763
1753
  result.eIDDataGroups = EIDDataGroups.fromJson(jsonObject["eIDDataGroups"])
1764
- result.dtcDataGroups = DTCDataGroups.fromJson(jsonObject["dtcDataGroups"])
1754
+ result.dtcDataGroups = DTCDataGroup.fromJson(jsonObject["dtcDataGroups"])
1765
1755
 
1766
1756
  return result
1767
1757
  }
@@ -2384,6 +2374,7 @@ const ViewContentMode = {
2384
2374
 
2385
2375
  const BarcodeResult = {
2386
2376
  NO_ERR: 0,
2377
+ INVALID_RESULT: 140,
2387
2378
  NULL_PTR_ERR: -6001,
2388
2379
  BAD_ARG_ERR: -6002,
2389
2380
  SIZE_ERR: -6003,
@@ -2552,6 +2543,7 @@ const eCheckDiagnose = {
2552
2543
  OCR_QUALITY_INVALID_FONT: 221,
2553
2544
  OCR_QUALITY_INVALID_BACKGROUND: 222,
2554
2545
  LAS_INK_INVALID_LINES_FREQUENCY: 230,
2546
+ DOC_LIVENESS_DOCUMENT_NOT_LIVE: 238,
2555
2547
  CHD_DOC_LIVENESS_BLACK_AND_WHITE_COPY_DETECTED: 239,
2556
2548
  DOC_LIVENESS_ELECTRONIC_DEVICE_DETECTED: 240,
2557
2549
  DOC_LIVENESS_INVALID_BARCODE_BACKGROUND: 241,
@@ -4358,7 +4350,7 @@ DocumentReader.setTCCParams = (params, successCallback, errorCallback) => cordov
4358
4350
  DocumentReader.addPKDCertificates = (certificates, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["addPKDCertificates", certificates])
4359
4351
  DocumentReader.clearPKDCertificates = (successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["clearPKDCertificates"])
4360
4352
  DocumentReader.startNewSession = (successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["startNewSession"])
4361
- DocumentReader.connectBluetoothDevice = (successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["connectBluetoothDevice"])
4353
+ DocumentReader.connectBluetoothDevice = (btDeviceName, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["connectBluetoothDevice", btDeviceName])
4362
4354
  DocumentReader.setLocalizationDictionary = (dictionary, successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["setLocalizationDictionary", dictionary])
4363
4355
  DocumentReader.getLicense = (successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["getLicense"])
4364
4356
  DocumentReader.getAvailableScenarios = (successCallback, errorCallback) => cordova.exec(successCallback, errorCallback, "DocumentReader", "exec", ["getAvailableScenarios"])
@@ -4478,7 +4470,7 @@ DocumentReaderPlugin.Customization = Customization
4478
4470
  DocumentReaderPlugin.EDLDataGroups = EDLDataGroups
4479
4471
  DocumentReaderPlugin.EPassportDataGroups = EPassportDataGroups
4480
4472
  DocumentReaderPlugin.EIDDataGroups = EIDDataGroups
4481
- DocumentReaderPlugin.DTCDataGroups = DTCDataGroups
4473
+ DocumentReaderPlugin.DTCDataGroup = DTCDataGroup
4482
4474
  DocumentReaderPlugin.RFIDScenario = RFIDScenario
4483
4475
  DocumentReaderPlugin.PrepareProgress = PrepareProgress
4484
4476