@regulaforensics/cordova-plugin-document-reader-api 5.4.0 → 5.8.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 the demo application
15
- 1. Get a trial license for demo application at [licensing.regulaforensics.com](https://licensing.regulaforensics.com/) (`regula.license` file).
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.
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
@@ -22,13 +22,14 @@ $ cordova prepare
22
22
  ```
23
23
 
24
24
  4. Copy the `regula.license` file to the `example/www` folder.
25
- 5. Android:
25
+ 5. Change the application ID to the one you have specified during the registration at [licensing.regulaforensics.com](https://licensing.regulaforensics.com).
26
+ 6. Android:
26
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.
27
28
 
28
29
  **Note**: if the gallery doesn't open, check if the following line is presented in the AndroidManifest.xml inside the `application` tag:
29
30
  `<activity android:label="@string/multi_app_name" android:name="com.synconset.MultiImageChooserActivity" android:theme="@android:style/Theme.Holo.Light" />`
30
31
 
31
- 6. iOS:
32
+ 7. iOS:
32
33
  * Run `cordova run ios` inside `example` folder - this is just one way to run the app. You can also run it directly from within Xcode.
33
34
 
34
35
  ### Troubleshooting license issues
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <widget android-packageName="com.regula.documentreader" ios-CFBundleIdentifier="regula.DocumentReader" version="1.0.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
2
+ <widget android-packageName="com.regula.documentreader" ios-CFBundleIdentifier="com.regula.dr.fullrfid" version="1.0.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3
3
  <name>DocumentReader</name>
4
4
  <description>
5
5
  A sample Regula Document Reader application for reading and validation of identification documents.
@@ -16,11 +16,12 @@
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": "^5.4.0",
20
- "@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "^5.4.0",
19
+ "@regulaforensics/cordova-plugin-document-reader-api": "^5.8.0",
20
+ "@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "^5.8.0",
21
21
  "cordova-plugin-file": "^6.0.2",
22
22
  "cordova-plugin-image-picker": "^1.1.3",
23
- "cordova-plugin-android-permissions": "1.1.0"
23
+ "cordova-plugin-android-permissions": "1.1.0",
24
+ "cordova-plugin-advanced-http": "3.2.1"
24
25
  },
25
26
  "cordova": {
26
27
  "plugins": {
@@ -34,7 +35,8 @@
34
35
  "PHOTO_LIBRARY_USAGE_DESCRIPTION": " "
35
36
  },
36
37
  "cordova-plugin-whitelist": {},
37
- "cordova-plugin-android-permissions": {}
38
+ "cordova-plugin-android-permissions": {},
39
+ "cordova-plugin-advanced-http": {}
38
40
  },
39
41
  "platforms": [
40
42
  "android",
@@ -44,4 +46,4 @@
44
46
  "devDependencies": {
45
47
  "cordova-plugin-whitelist": "^1.3.4"
46
48
  }
47
- }
49
+ }
@@ -43,7 +43,7 @@
43
43
 
44
44
  <div>
45
45
  <div id="scenariosRadioGroup"
46
- style="position: absolute; bottom: 100px; top: 225px; left: 75px; width:225px; padding: 5px; text-align:left; overflow: auto"/>
46
+ style="position: absolute; bottom: 140px; top: 225px; left: 75px; width:225px; padding: 5px; text-align:left; overflow: auto"/>
47
47
  </div>
48
48
 
49
49
  <div style="position: absolute; bottom: 10px; width: 100%; text-align: center; align-items: center">
@@ -52,6 +52,11 @@
52
52
  id="rfidCheckboxText"
53
53
  style="color: lightgrey"> Process rfid reading(unavailable)</span><br>
54
54
  </div>
55
+ <div id="encryptionDiv" style="flex-direction: row; padding: 5px">
56
+ <input id="encryptionCheckbox" type="checkbox" name="rfid" disabled><span
57
+ id="encryptionCheckboxText"
58
+ style="color: lightgrey"> Data encryption(unavailable)</span><br>
59
+ </div>
55
60
  <div style="flex-direction: row; padding: 10px">
56
61
  <button id="showScannerButton" style="margin-right: 20px">scan doc</button>
57
62
  <button id="showImagePicker" style="margin-left: 20px">scan image</button>
@@ -7,10 +7,13 @@ var app = {
7
7
  this.receivedEvent('deviceready')
8
8
  document.getElementById("status").innerHTML = "loading......"
9
9
  document.getElementById("status").style.backgroundColor = "grey"
10
+ var http = cordova.plugin.http
10
11
  var DocumentReaderResults = DocumentReader.DocumentReaderResults
11
- var Scenario = DocumentReader.Scenario
12
+ var DocumentReaderScenario = DocumentReader.DocumentReaderScenario
12
13
  var Enum = DocumentReader.Enum
13
14
  var doRfid = false
15
+ var encryption = false
16
+ const ENCRYPTED_RESULT_SERVICE = "https://api.regulaforensics.com/api/process"
14
17
  var isReadingRfid = false
15
18
  var rfidUIHeader = "Reading RFID"
16
19
  var rfidUIHeaderColor = "black"
@@ -29,14 +32,14 @@ var app = {
29
32
  var input = document.createElement("input")
30
33
  input.type = "radio"
31
34
  input.name = "scenario"
32
- input.value = Scenario.fromJson(typeof scenarios[index] === "string" ? JSON.parse(scenarios[index]) : scenarios[index]).name
35
+ input.value = DocumentReaderScenario.fromJson(typeof scenarios[index] === "string" ? JSON.parse(scenarios[index]) : scenarios[index]).name
33
36
  if (index == 0)
34
37
  input.checked = true
35
38
  input.onclick = function () { DocumentReader.setConfig({ processParams: { scenario: this.value } }, function (m) { }, function (e) { }) }
36
39
  input.style.display = "inline-block"
37
40
  document.getElementById("scenariosRadioGroup").appendChild(input)
38
41
  var label = document.createElement("span")
39
- label.innerHTML = Scenario.fromJson(typeof scenarios[index] === "string" ? JSON.parse(scenarios[index]) : scenarios[index]).name
42
+ label.innerHTML = DocumentReaderScenario.fromJson(typeof scenarios[index] === "string" ? JSON.parse(scenarios[index]) : scenarios[index]).name
40
43
  label.style.display = "inline-block"
41
44
  label.style.width = "200px"
42
45
  label.radioButton = input
@@ -47,10 +50,15 @@ var app = {
47
50
  if (canRfid) {
48
51
  document.getElementById("rfidCheckbox").disabled = false
49
52
  document.getElementById("rfidCheckboxText").style.color = "black"
50
- document.getElementById("rfidCheckboxText").innerHTML = "Process rfid reading"
53
+ document.getElementById("rfidCheckboxText").innerHTML = " Process rfid reading"
51
54
  document.getElementById("rfidCheckboxText").onclick = function () { document.getElementById("rfidCheckbox").click() }
52
55
  document.getElementById("rfidCheckbox").onchange = function () { doRfid = this.checked }
53
56
  }
57
+ document.getElementById("encryptionCheckbox").disabled = false
58
+ document.getElementById("encryptionCheckboxText").style.color = "black"
59
+ document.getElementById("encryptionCheckboxText").innerHTML = " Data encryption"
60
+ document.getElementById("encryptionCheckboxText").onclick = function () { document.getElementById("encryptionCheckbox").click() }
61
+ document.getElementById("encryptionCheckbox").onchange = function () { encryption = this.checked }
54
62
  }
55
63
 
56
64
  function scan() {
@@ -168,7 +176,26 @@ var app = {
168
176
 
169
177
  function usualRFID() {
170
178
  doRfid = false
171
- DocumentReader.startRFIDReader(function (m) { handleCompletion(DocumentReader.DocumentReaderCompletion.fromJson(JSON.parse(m))) }, function (e) { })
179
+ var notification = "rfidNotificationCompletionEvent"
180
+ var paCert = "paCertificateCompletionEvent"
181
+ var taCert = "taCertificateCompletionEvent"
182
+ var taSig = "taSignatureCompletionEvent"
183
+ DocumentReader.startRFIDReader(function (m) {
184
+ if (m.substring(0, notification.length) === notification) {
185
+ m = m.substring(notification.length, m.length)
186
+ console.log(notification + ": " + m)
187
+ } else if (m.substring(0, paCert.length) === paCert) {
188
+ m = m.substring(paCert.length, m.length)
189
+ console.log(paCert + ": " + m)
190
+ } else if (m.substring(0, taCert.length) === taCert) {
191
+ m = m.substring(taCert.length, m.length)
192
+ console.log(taCert + ": " + m)
193
+ } else if (m.substring(0, taSig.length) === taSig) {
194
+ m = m.substring(taSig.length, m.length)
195
+ console.log(taSig + ": " + m)
196
+ } else
197
+ handleCompletion(DocumentReader.DocumentReaderCompletion.fromJson(JSON.parse(m)))
198
+ }, function (e) { })
172
199
  }
173
200
 
174
201
  function handleResults(results) {
@@ -186,7 +213,33 @@ var app = {
186
213
  //customRFID()
187
214
  usualRFID()
188
215
  } else
189
- displayResults(results)
216
+ if (encryption) {
217
+ var input = JSON.parse(results.rawResult)
218
+ var processParam = {
219
+ alreadyCropped: true,
220
+ scenario: "FullProcess"
221
+ }
222
+ var body = {
223
+ List: input["ContainerList"]["List"],
224
+ processParam: processParam
225
+ }
226
+ postRequest(body)
227
+ } else
228
+ displayResults(results)
229
+ }
230
+
231
+ function postRequest(body) {
232
+ document.getElementById("status").innerHTML = "Getting results from server......"
233
+ document.getElementById("status").style.backgroundColor = "grey"
234
+ http.setDataSerializer('utf8')
235
+ http.post(ENCRYPTED_RESULT_SERVICE, JSON.stringify(body), { "content-type": "application/json; utf-8" }, function (response) {
236
+ DocumentReader.parseCoreResults(response.data, function (m) {
237
+ displayResults(DocumentReader.DocumentReaderResults.fromJson(JSON.parse(m))) }, function (e) { })
238
+ }, function (response) {
239
+ console.error(response.error)
240
+ document.getElementById("status").innerHTML = "Something went wrong!"
241
+ document.getElementById("status").style.backgroundColor = "red"
242
+ })
190
243
  }
191
244
 
192
245
  function displayResults(results) {
@@ -274,7 +327,8 @@ var app = {
274
327
  DocumentReader.getAvailableScenarios(function (s) {
275
328
  DocumentReader.isRFIDAvailableForUse(function (r) { postInitialize(JSON.parse(s), r) }, function (e) { })
276
329
  }, function (e) { })
277
- addCertificates()
330
+ DocumentReader.setRfidDelegate(Enum.RFIDDelegate.NO_PA, function (r) { }, function (e) { })
331
+ // addCertificates()
278
332
  }, function (error) {
279
333
  console.log(error)
280
334
  document.getElementById("status").innerHTML = error
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/cordova-plugin-document-reader-api",
3
- "version": "5.4.0",
3
+ "version": "5.8.0",
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="5.4.0"
2
+ <plugin id="cordova-plugin-document-reader-api" version="5.8.0"
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>
@@ -18,14 +18,14 @@
18
18
  </config-file>
19
19
  <header-file src="src/ios/RGLDocumentReader.h" />
20
20
  <source-file src="src/ios/RGLDocumentReader.m" />
21
- <header-file src="src/ios/JSONConstructor.h" />
22
- <source-file src="src/ios/JSONConstructor.m" />
21
+ <header-file src="src/ios/RGLWJSONConstructor.h" />
22
+ <source-file src="src/ios/RGLWJSONConstructor.m" />
23
23
  <header-file src="src/ios/RegulaConfig.h" />
24
24
  <source-file src="src/ios/RegulaConfig.m" />
25
25
  <podspec>
26
26
  <config/>
27
27
  <pods>
28
- <pod name="DocumentReader" spec="~> 5.4.1661" />
28
+ <pod name="DocumentReader" spec="~> 5.8.2215" />
29
29
  </pods>
30
30
  </podspec>
31
31
  </platform>
@@ -40,5 +40,6 @@
40
40
  <source-file src="src/android/DocumentReader.java" target-dir="src/cordova.plugin.documentreader" />
41
41
  <source-file src="src/android/JSONConstructor.java" target-dir="src/cordova.plugin.documentreader" />
42
42
  <source-file src="src/android/RegulaConfig.java" target-dir="src/cordova.plugin.documentreader" />
43
+ <source-file src="src/android/Helpers.java" target-dir="src/cordova.plugin.documentreader" />
43
44
  </platform>
44
45
  </plugin>