@regulaforensics/document-reader 9.1.485-nightly → 9.1.493-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.
- package/RNDocumentReader.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/cordova.gradle +2 -2
- package/android/src/main/java/com/regula/plugin/documentreader/Config.kt +8 -0
- package/android/src/main/java/com/regula/plugin/documentreader/JSONConstructor.kt +346 -40
- package/android/src/main/java/com/regula/plugin/documentreader/Main.kt +62 -8
- package/android/src/main/java/com/regula/plugin/documentreader/Utils.kt +62 -0
- package/examples/capacitor/ios/App/App/Info.plist +2 -0
- package/examples/capacitor/package.json +1 -1
- package/examples/ionic/config.xml +2 -0
- package/examples/ionic/package-lock.json +5257 -2650
- package/examples/ionic/package.json +10 -10
- package/examples/react_native/app.config.ts +3 -1
- package/examples/react_native/package-lock.json +3 -3
- package/examples/react_native/package.json +1 -1
- package/ios/RGLWConfig.m +9 -2
- package/ios/RGLWJSONConstructor.h +19 -0
- package/ios/RGLWJSONConstructor.m +349 -0
- package/ios/RGLWMain.m +49 -0
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/test/json.tsx +200 -95
- package/test/package-lock.json +1 -1
- package/test/test.tsx +12 -2
- package/www/capacitor/engagement/DataRetrieval.js +55 -0
- package/www/capacitor/engagement/DeviceEngagement.js +30 -0
- package/www/capacitor/engagement/DeviceRetrievalMethod.js +41 -0
- package/www/capacitor/engagement/DocumentRequestMDL.js +212 -0
- package/www/capacitor/engagement/NameSpaceMDL.js +33 -0
- package/www/capacitor/index.js +54 -2
- package/www/capacitor/info/DocReaderException.js +2 -0
- package/www/capacitor/params/Functionality.js +16 -0
- package/www/capacitor/params/customization/Customization.js +8 -0
- package/www/capacitor/params/process_params/ProcessParams.js +16 -0
- package/www/capacitor/results/Results.js +8 -1
- package/www/capacitor/results/status/AgeStatus.js +35 -0
- package/www/capacitor/results/status/ResultsStatus.js +13 -0
- package/www/capacitor/results/visible_digital_seals/DocFeature.js +23 -0
- package/www/capacitor/results/visible_digital_seals/VDSData.js +75 -0
- package/www/capacitor/results/visual_results/FieldType.js +3 -0
- package/www/capacitor/rfid/PKDCertificate.js +3 -0
- package/www/cordova.js +951 -177
- package/www/react-native/engagement/DataRetrieval.js +55 -0
- package/www/react-native/engagement/DeviceEngagement.js +30 -0
- package/www/react-native/engagement/DeviceRetrievalMethod.js +41 -0
- package/www/react-native/engagement/DocumentRequestMDL.js +212 -0
- package/www/react-native/engagement/NameSpaceMDL.js +33 -0
- package/www/react-native/index.js +54 -2
- package/www/react-native/info/DocReaderException.js +2 -0
- package/www/react-native/params/Functionality.js +16 -0
- package/www/react-native/params/customization/Customization.js +8 -0
- package/www/react-native/params/process_params/ProcessParams.js +16 -0
- package/www/react-native/results/Results.js +8 -1
- package/www/react-native/results/status/AgeStatus.js +35 -0
- package/www/react-native/results/status/ResultsStatus.js +13 -0
- package/www/react-native/results/visible_digital_seals/DocFeature.js +23 -0
- package/www/react-native/results/visible_digital_seals/VDSData.js +75 -0
- package/www/react-native/results/visual_results/FieldType.js +3 -0
- package/www/react-native/rfid/PKDCertificate.js +3 -0
- package/www/types/engagement/DataRetrieval.d.ts +28 -0
- package/www/types/engagement/DeviceEngagement.d.ts +16 -0
- package/www/types/engagement/DeviceRetrievalMethod.d.ts +18 -0
- package/www/types/engagement/DocumentRequestMDL.d.ts +61 -0
- package/www/types/engagement/NameSpaceMDL.d.ts +16 -0
- package/www/types/index.d.ts +35 -2
- package/www/types/info/DocReaderException.d.ts +2 -0
- package/www/types/params/Functionality.d.ts +7 -0
- package/www/types/params/customization/Customization.d.ts +5 -0
- package/www/types/params/process_params/ProcessParams.d.ts +13 -0
- package/www/types/results/Results.d.ts +9 -1
- package/www/types/results/status/AgeStatus.d.ts +14 -0
- package/www/types/results/status/ResultsStatus.d.ts +9 -0
- package/www/types/results/visible_digital_seals/DocFeature.d.ts +9 -0
- package/www/types/results/visible_digital_seals/VDSData.d.ts +32 -0
- package/www/types/results/visible_digital_seals/VDSNCData.d.ts +1 -1
- package/www/types/results/visual_results/FieldType.d.ts +6 -0
- package/www/types/rfid/PKDCertificate.d.ts +7 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@file:SuppressLint("MissingPermission")
|
|
2
|
+
@file:Suppress("EnumValuesSoftDeprecate")
|
|
2
3
|
|
|
3
4
|
package com.regula.plugin.documentreader
|
|
4
5
|
|
|
@@ -30,12 +31,14 @@ import com.regula.documentreader.api.enums.LCID
|
|
|
30
31
|
import com.regula.documentreader.api.enums.eImageQualityCheckType
|
|
31
32
|
import com.regula.documentreader.api.enums.eLDS_ParsingErrorCodes
|
|
32
33
|
import com.regula.documentreader.api.enums.eLDS_ParsingNotificationCodes
|
|
34
|
+
import com.regula.documentreader.api.enums.eMDLDeviceEngagement
|
|
33
35
|
import com.regula.documentreader.api.enums.eRFID_DataFile_Type
|
|
34
36
|
import com.regula.documentreader.api.enums.eRFID_ErrorCodes
|
|
35
37
|
import com.regula.documentreader.api.enums.eVisualFieldType
|
|
36
38
|
import com.regula.documentreader.api.errors.DocReaderRfidException
|
|
37
39
|
import com.regula.documentreader.api.errors.DocumentReaderException
|
|
38
40
|
import com.regula.documentreader.api.internal.core.CoreScenarioUtil
|
|
41
|
+
import com.regula.documentreader.api.params.mdl.DataRetrieval
|
|
39
42
|
import com.regula.documentreader.api.results.DocumentReaderNotification
|
|
40
43
|
import com.regula.documentreader.api.results.DocumentReaderResults
|
|
41
44
|
import com.regula.documentreader.api.results.DocumentReaderResults.fromRawResults
|
|
@@ -45,7 +48,7 @@ import org.json.JSONObject
|
|
|
45
48
|
import com.regula.plugin.documentreader.Convert.toBase64
|
|
46
49
|
import com.regula.plugin.documentreader.Convert.toByteArray
|
|
47
50
|
|
|
48
|
-
fun methodCall(method: String, callback: (Any?) -> Unit): Any
|
|
51
|
+
fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
|
|
49
52
|
"getDocumentReaderIsReady" -> getDocumentReaderIsReady(callback)
|
|
50
53
|
"getDocumentReaderStatus" -> getDocumentReaderStatus(callback)
|
|
51
54
|
"getRfidSessionStatus" -> getRfidSessionStatus(callback)
|
|
@@ -95,6 +98,13 @@ fun methodCall(method: String, callback: (Any?) -> Unit): Any? = when (method) {
|
|
|
95
98
|
"btDeviceRequestFlashing" -> btDeviceRequestFlashing()
|
|
96
99
|
"btDeviceRequestFlashingFullIR" -> btDeviceRequestFlashingFullIR()
|
|
97
100
|
"btDeviceRequestTurnOffAll" -> btDeviceRequestTurnOffAll()
|
|
101
|
+
"startReadMDl" -> startReadMDl(args(0), args(1), callback)
|
|
102
|
+
"startEngageDevice" -> startEngageDevice(args(0), callback)
|
|
103
|
+
"engageDeviceNFC" -> engageDeviceNFC(callback)
|
|
104
|
+
"engageDeviceData" -> engageDeviceData(args(0), callback)
|
|
105
|
+
"startRetrieveData" -> startRetrieveData(args(0), args(1), callback)
|
|
106
|
+
"retrieveDataNFC" -> retrieveDataNFC(args(0), callback)
|
|
107
|
+
"retrieveDataBLE" -> retrieveDataBLE(args(0), args(1), callback)
|
|
98
108
|
"setLocalizationDictionary" -> setLocalizationDictionary(args(0))
|
|
99
109
|
"getLicense" -> getLicense(callback)
|
|
100
110
|
"getAvailableScenarios" -> getAvailableScenarios(callback)
|
|
@@ -253,7 +263,7 @@ fun readRFID(onRequestPACertificates: Boolean, onRequestTACertificates: Boolean,
|
|
|
253
263
|
onRequestTACertificates,
|
|
254
264
|
onRequestTASignature
|
|
255
265
|
)
|
|
256
|
-
startForegroundDispatch()
|
|
266
|
+
startForegroundDispatch("readRFID")
|
|
257
267
|
}
|
|
258
268
|
|
|
259
269
|
fun stopRFIDReader() {
|
|
@@ -287,6 +297,47 @@ fun clearPKDCertificates() = Instance().clearPKDCertificates()
|
|
|
287
297
|
|
|
288
298
|
fun startNewSession() = Instance().startNewSession()
|
|
289
299
|
|
|
300
|
+
fun startReadMDl(type: Int, dataRetrieval: JSONObject, callback: Callback) {
|
|
301
|
+
stopBackgroundRFID()
|
|
302
|
+
Instance().startReadMDL(activity, eMDLDeviceEngagement.values()[type], dataRetrievalFromJSON(dataRetrieval)!!) { v1, v2, v3 -> callback(generateCompletion(v1, v2, v3)) }
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
fun startEngageDevice(type: Int, callback: Callback) {
|
|
306
|
+
stopBackgroundRFID()
|
|
307
|
+
Instance().startEngageDevice(activity, eMDLDeviceEngagement.values()[type]) { v1, v2 -> callback(generateDeviceEngagementCompletion(v1, v2)) }
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
lateinit var engageDeviceNFCCallback: Callback
|
|
311
|
+
fun engageDeviceNFC(callback: Callback) {
|
|
312
|
+
engageDeviceNFCCallback = callback
|
|
313
|
+
stopBackgroundRFID()
|
|
314
|
+
startForegroundDispatch("engageDeviceNFC")
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
fun engageDeviceData(data: String, callback: Callback) {
|
|
318
|
+
stopBackgroundRFID()
|
|
319
|
+
Instance().engageDeviceData(data) { v1, v2 -> callback(generateDeviceEngagementCompletion(v1, v2)) }
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
fun startRetrieveData(dataRetrieval: JSONObject, deviceEngagement: JSONObject, callback: Callback) {
|
|
323
|
+
stopBackgroundRFID()
|
|
324
|
+
Instance().startRetrieveData(activity, deviceEngagementFromJSON(deviceEngagement)!!, dataRetrievalFromJSON(dataRetrieval)!!){ v1, v2, v3 -> callback(generateCompletion(v1, v2, v3)) }
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
lateinit var retrieveDataNFCCallback: Callback
|
|
328
|
+
lateinit var retrieveDataNFCProp: DataRetrieval
|
|
329
|
+
fun retrieveDataNFC(dataRetrieval: JSONObject, callback: Callback) {
|
|
330
|
+
retrieveDataNFCCallback = callback
|
|
331
|
+
retrieveDataNFCProp = dataRetrievalFromJSON(dataRetrieval)!!
|
|
332
|
+
stopBackgroundRFID()
|
|
333
|
+
startForegroundDispatch("retrieveDataNFC")
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
fun retrieveDataBLE(dataRetrieval: JSONObject, deviceEngagement: JSONObject, callback: Callback) {
|
|
337
|
+
stopBackgroundRFID()
|
|
338
|
+
Instance().retrieveDataBLE(context, deviceEngagementFromJSON(deviceEngagement)!!, dataRetrievalFromJSON(dataRetrieval)!!){ v1, v2, v3 -> callback(generateCompletion(v1, v2, v3)) }
|
|
339
|
+
}
|
|
340
|
+
|
|
290
341
|
fun setLocalizationDictionary(dictionary: JSONObject) {
|
|
291
342
|
localizationCallbacks = LocalizationCallbacks { if (dictionary.has(it)) dictionary.getString(it) else null }
|
|
292
343
|
Instance().setLocalizationCallback(localizationCallbacks)
|
|
@@ -527,19 +578,22 @@ var requestType = RfidReaderRequestType(
|
|
|
527
578
|
@Suppress("DEPRECATION", "MissingPermission")
|
|
528
579
|
fun newIntent(intent: Intent): Boolean {
|
|
529
580
|
if (intent.action != NfcAdapter.ACTION_TECH_DISCOVERED) return false
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
rfidReaderCompletion,
|
|
533
|
-
|
|
534
|
-
|
|
581
|
+
val isoDep = IsoDep.get(intent.getParcelableExtra(NfcAdapter.EXTRA_TAG))
|
|
582
|
+
when (nfcFunction) {
|
|
583
|
+
"readRFID" -> Instance().readRFID(isoDep, rfidReaderCompletion, requestType.getRfidReaderRequest())
|
|
584
|
+
"engageDeviceNFC" -> Instance().engageDeviceNFC(isoDep) { v1, v2 -> engageDeviceNFCCallback(generateDeviceEngagementCompletion(v1, v2)) }
|
|
585
|
+
"retrieveDataNFC" -> Instance().retrieveDataNFC(isoDep, retrieveDataNFCProp) { v1, v2, v3 -> retrieveDataNFCCallback(generateCompletion(v1, v2, v3)) }
|
|
586
|
+
}
|
|
535
587
|
return true
|
|
536
588
|
}
|
|
537
589
|
|
|
538
590
|
var backgroundRFIDEnabled = false
|
|
591
|
+
var nfcFunction = ""
|
|
539
592
|
lateinit var lifecycleObserver: LifecycleEventObserver
|
|
540
593
|
|
|
541
|
-
fun startForegroundDispatch() {
|
|
594
|
+
fun startForegroundDispatch(tag: String) {
|
|
542
595
|
backgroundRFIDEnabled = true
|
|
596
|
+
nfcFunction = tag
|
|
543
597
|
val filters: Array<IntentFilter?> = arrayOfNulls(1)
|
|
544
598
|
filters[0] = IntentFilter()
|
|
545
599
|
filters[0]!!.addAction(NfcAdapter.ACTION_TECH_DISCOVERED)
|
|
@@ -12,7 +12,9 @@ import android.util.Base64
|
|
|
12
12
|
import org.json.JSONArray
|
|
13
13
|
import org.json.JSONObject
|
|
14
14
|
import java.io.ByteArrayOutputStream
|
|
15
|
+
import java.lang.reflect.Constructor
|
|
15
16
|
import kotlin.math.sqrt
|
|
17
|
+
import kotlin.reflect.KClass
|
|
16
18
|
|
|
17
19
|
fun List<*>.toJson(): JSONArray {
|
|
18
20
|
val result = JSONArray()
|
|
@@ -105,6 +107,18 @@ fun IntArray?.toJson() = this?.let {
|
|
|
105
107
|
result
|
|
106
108
|
}
|
|
107
109
|
|
|
110
|
+
fun JSONArray.toLongArray(): LongArray {
|
|
111
|
+
val result = LongArray(length())
|
|
112
|
+
for (i in 0 until length()) result[i] = getLong(i)
|
|
113
|
+
return result
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
fun LongArray.toJson(): JSONArray {
|
|
117
|
+
val result = JSONArray()
|
|
118
|
+
for (i in indices) result.put(i, this[i])
|
|
119
|
+
return result
|
|
120
|
+
}
|
|
121
|
+
|
|
108
122
|
fun JSONObject.forEach(action: (String, Any) -> Unit) {
|
|
109
123
|
val keys: Iterator<String> = keys()
|
|
110
124
|
while (keys.hasNext()) {
|
|
@@ -123,6 +137,11 @@ fun JSONObject.getIntOrNull(name: String): Int? {
|
|
|
123
137
|
return null
|
|
124
138
|
}
|
|
125
139
|
|
|
140
|
+
fun JSONObject.getLongOrNull(name: String): Long? {
|
|
141
|
+
if (has(name) && get(name).toString() != "null") return getLong(name)
|
|
142
|
+
return null
|
|
143
|
+
}
|
|
144
|
+
|
|
126
145
|
fun JSONObject.getDoubleOrNull(name: String): Double? {
|
|
127
146
|
if (has(name) && get(name).toString() != "null") return getDouble(name)
|
|
128
147
|
return null
|
|
@@ -138,6 +157,49 @@ fun JSONObject.getStringOrNull(name: String): String? {
|
|
|
138
157
|
return null
|
|
139
158
|
}
|
|
140
159
|
|
|
160
|
+
fun <T : Any> KClass<T>.constructor(vararg argTypes: KClass<*>): Constructor<T> {
|
|
161
|
+
val types = mutableListOf<Class<*>>()
|
|
162
|
+
for (argType in argTypes) types.add(argType.java)
|
|
163
|
+
return java.getDeclaredConstructor(*types.toTypedArray())
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
fun <T : Any> Constructor<T>.instantiate(vararg args: Any?): T {
|
|
167
|
+
isAccessible = true
|
|
168
|
+
return newInstance(*args)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
fun <T : Any> T.setPrivateProperty(varName: String, data: Any?) {
|
|
172
|
+
try {
|
|
173
|
+
setPrivateProperty(javaClass, varName, data)
|
|
174
|
+
} catch (_: java.lang.Exception) {
|
|
175
|
+
try {
|
|
176
|
+
setPrivateProperty(javaClass.superclass!!, varName, data)
|
|
177
|
+
} catch (_: java.lang.Exception) {
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
fun <T : Any> T.setPrivateProperty(clazz: Class<T>, varName: String, data: Any?) = clazz.getDeclaredField(varName).let {
|
|
183
|
+
it.isAccessible = true
|
|
184
|
+
it.set(this, data)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
fun <T : Any> T.getPrivateProperty(varName: String): Any? {
|
|
188
|
+
var clazz: Class<*>? = this.javaClass
|
|
189
|
+
while (clazz != null) {
|
|
190
|
+
try {
|
|
191
|
+
val field = clazz.getDeclaredField(varName)
|
|
192
|
+
field.isAccessible = true
|
|
193
|
+
return field.get(this)
|
|
194
|
+
} catch (_: NoSuchFieldException) {
|
|
195
|
+
clazz = clazz.superclass
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
throw NoSuchFieldException(
|
|
199
|
+
"Field '$varName' not found in class hierarchy of ${this.javaClass.name}"
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
|
|
141
203
|
internal object Convert {
|
|
142
204
|
fun String?.toByteArray(): ByteArray? {
|
|
143
205
|
var str = this ?: return null
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"android": "scripts/android.sh"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@regulaforensics/document-reader": "9.1.
|
|
9
|
+
"@regulaforensics/document-reader": "9.1.493-beta",
|
|
10
10
|
"@regulaforensics/document-reader-core-fullauthrfid": "8.4.787",
|
|
11
11
|
"@regulaforensics/document-reader-btdevice": "8.4.31",
|
|
12
12
|
"@awesome-cordova-plugins/file": "6.6.0",
|
|
@@ -44,7 +44,9 @@
|
|
|
44
44
|
<string>A0000002480100</string>
|
|
45
45
|
<string>A0000002480200</string>
|
|
46
46
|
<string>A0000002480300</string>
|
|
47
|
+
<string>A0000002480400</string>
|
|
47
48
|
<string>A00000045645444C2D3031</string>
|
|
49
|
+
<string>D2760000850101</string>
|
|
48
50
|
</array>
|
|
49
51
|
</config-file>
|
|
50
52
|
<config-file parent="com.apple.developer.nfc.readersession.formats" target="*-Debug.plist">
|