react-native-rdservice-fingerprintscanner 0.1.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/LICENSE +21 -0
- package/README.md +67 -0
- package/android/build.gradle +59 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativerdservicefingerprintscanner/RDServiceEvents.java +46 -0
- package/android/src/main/java/com/reactnativerdservicefingerprintscanner/RDServiceManager.java +276 -0
- package/android/src/main/java/com/reactnativerdservicefingerprintscanner/RdserviceFingerprintscannerModule.java +108 -0
- package/android/src/main/java/com/reactnativerdservicefingerprintscanner/RdserviceFingerprintscannerPackage.java +28 -0
- package/lib/commonjs/index.js +29 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +18 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/index.test.d.ts +0 -0
- package/package.json +146 -0
- package/react-native-rdservice-fingerprintscanner.podspec +19 -0
- package/src/index.js +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Senthalan S
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# react-native-rdservice-fingerprintscanner
|
|
2
|
+
|
|
3
|
+
React Native library to easily integrate Fingerprint Device support in your app (for UIDAI Aadhaar based secure authentication in India). It is only for Android Devices.
|
|
4
|
+
|
|
5
|
+
As per [UIDAI](https://uidai.gov.in/) (Aadhaar) guidelines, only registered biometric devices can be used for Aadhaar Authentication. These devices come with RDService drivers (usually available on PlayStore) that exposes a standard API.
|
|
6
|
+
|
|
7
|
+
This library makes it easy to work with all such devices so that your app can search for installed drivers and get the fingerprint data after a scan.
|
|
8
|
+
|
|
9
|
+
For reference, you may check out the ([Aadhaar Registered Devices by UIDAI](https://uidai.gov.in/images/resource/Aadhaar_Registered_Devices_2_0_4.pdf)).
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install react-native-rdservice-fingerprintscanner
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Add jitpack in your root build.gradle file at the end of repositories: ```android/build.gradle```
|
|
21
|
+
|
|
22
|
+
```java
|
|
23
|
+
allprojects {
|
|
24
|
+
repositories {
|
|
25
|
+
// ...
|
|
26
|
+
maven { url 'https://jitpack.io' }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import { getDeviceInfo, captureFinger } from "react-native-rdservice-fingerprintscanner";
|
|
35
|
+
|
|
36
|
+
// ...
|
|
37
|
+
|
|
38
|
+
getDeviceInfo()
|
|
39
|
+
.then((response) => {
|
|
40
|
+
console.log(response, 'DEVICE DRIVER FOUND'); // Either The Device connected or not connected response here
|
|
41
|
+
})
|
|
42
|
+
.catch((error) => {
|
|
43
|
+
console.log(error, 'DEVICE DRIVER NOT FOUND'); //Failed to get device information
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
captureFinger(pidOptions)
|
|
47
|
+
.then((response) => {
|
|
48
|
+
console.log(response, 'FINGER CAPTURE'); // Either The Device Connected or Not Connected Response here
|
|
49
|
+
})
|
|
50
|
+
.catch((e) => {
|
|
51
|
+
console.log(e, 'ERROR_FINGER_CAPTURE'); // Failed to capture the Fingerprint
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```pidOptions``` is an XML String that you have to pass to ```captureFinger``` method. Refer [UIDAI Document](https://uidai.gov.in/images/resource/Aadhaar_Registered_Devices_2_0_4.pdf)
|
|
56
|
+
|
|
57
|
+
## Contributing
|
|
58
|
+
|
|
59
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
|
64
|
+
|
|
65
|
+
## Would you like to support me?
|
|
66
|
+
|
|
67
|
+
<a href="https://www.buymeacoffee.com/senthalan2" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-red.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
if (project == rootProject) {
|
|
3
|
+
repositories {
|
|
4
|
+
google()
|
|
5
|
+
mavenCentral()
|
|
6
|
+
jcenter()
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
dependencies {
|
|
10
|
+
classpath 'com.android.tools.build:gradle:3.5.3'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
apply plugin: 'com.android.library'
|
|
16
|
+
|
|
17
|
+
def safeExtGet(prop, fallback) {
|
|
18
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
android {
|
|
22
|
+
compileSdkVersion safeExtGet('RdserviceFingerprintscanner_compileSdkVersion', 29)
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion safeExtGet('RdserviceFingerprintscanner_minSdkVersion', 16)
|
|
25
|
+
targetSdkVersion safeExtGet('RdserviceFingerprintscanner_targetSdkVersion', 29)
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
buildTypes {
|
|
32
|
+
release {
|
|
33
|
+
minifyEnabled false
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
disable 'GradleCompatible'
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
repositories {
|
|
46
|
+
mavenLocal()
|
|
47
|
+
maven {
|
|
48
|
+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
49
|
+
url("$rootDir/../node_modules/react-native/android")
|
|
50
|
+
}
|
|
51
|
+
google()
|
|
52
|
+
mavenCentral()
|
|
53
|
+
jcenter()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
dependencies {
|
|
57
|
+
//noinspection GradleDynamicVersion
|
|
58
|
+
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
59
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
package com.reactnativerdservicefingerprintscanner;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An interface to implement RDServiceManager callback functions.
|
|
8
|
+
* @author https://github.com/manustays
|
|
9
|
+
*/
|
|
10
|
+
public interface RDServiceEvents {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An RDService driver is discovered. For each installed driver, this function will be called separately with the current status and package-name of that driver.
|
|
14
|
+
* @param rdServiceInfo Status response as XML string from the discovered RDService device driver
|
|
15
|
+
* @param rdServicePackage The discovered RDService device driver package name
|
|
16
|
+
* @param isWhitelisted True if the discovered package is whitelisted, false otherwise
|
|
17
|
+
*/
|
|
18
|
+
void onRDServiceDriverDiscovery(String rdServiceInfo, String rdServicePackage, Boolean isWhitelisted);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A fingerprint scan data is received from the RDService.
|
|
22
|
+
* @param pidData The fingerprint scan PID data as XML string
|
|
23
|
+
*/
|
|
24
|
+
void onRDServiceCaptureResponse(String pidData, String rdServicePackage);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* No installed RDService driver was found.
|
|
28
|
+
*/
|
|
29
|
+
void onRDServiceDriverNotFound();
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An installed RDService driver did not return a proper status.
|
|
33
|
+
* @param resultCode The resultCode returned by the RDServiver driver activity
|
|
34
|
+
* @param data The data returned by the RDServiver driver activity
|
|
35
|
+
* @param rdServicePackage The package name of the RDService driver
|
|
36
|
+
*/
|
|
37
|
+
void onRDServiceDriverDiscoveryFailed(int resultCode, Intent data, String rdServicePackage, String reason);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Captured request sent to an RDService driver failed.
|
|
41
|
+
* @param resultCode The resultCode returned by the RDServiver driver activity
|
|
42
|
+
* @param data The data returned by the RDServiver driver activity
|
|
43
|
+
* @param rdServicePackage The package name of the RDService driver
|
|
44
|
+
*/
|
|
45
|
+
void onRDServiceCaptureFailed(int resultCode, Intent data, String rdServicePackage);
|
|
46
|
+
}
|
package/android/src/main/java/com/reactnativerdservicefingerprintscanner/RDServiceManager.java
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
package com.reactnativerdservicefingerprintscanner;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import android.app.Activity;
|
|
5
|
+
import android.content.Intent;
|
|
6
|
+
import android.content.pm.ResolveInfo;
|
|
7
|
+
import android.os.Bundle;
|
|
8
|
+
import android.util.Log;
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.NonNull;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import java.util.HashMap;
|
|
14
|
+
import java.util.List;
|
|
15
|
+
import java.util.Map;
|
|
16
|
+
|
|
17
|
+
import static android.app.Activity.RESULT_OK;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Helper class to help capture fingerprint data by using RDService drivers for fingerprint-devices.
|
|
21
|
+
* @author https://github.com/manustays
|
|
22
|
+
*/
|
|
23
|
+
public class RDServiceManager {
|
|
24
|
+
|
|
25
|
+
private static final String TAG = "RDServiceManager";
|
|
26
|
+
private RDServiceEvents mRDEvent;
|
|
27
|
+
|
|
28
|
+
private static final int RC_RDSERVICE_DISCOVER_START_INDEX = 8500;
|
|
29
|
+
private static final int RC_RDSERVICE_CAPTURE_START_INDEX = 8300;
|
|
30
|
+
|
|
31
|
+
private static final Map<String, Integer> mapRDDriverRCIndex = new HashMap<String, Integer>();
|
|
32
|
+
private static final Map<Integer, String> mapRDDiscoverRC = new HashMap<Integer, String>();
|
|
33
|
+
private static final Map<Integer, String> mapRDCaptureRC = new HashMap<Integer, String>();
|
|
34
|
+
|
|
35
|
+
private static final Map<String, String> mapRDDriverWhitelist = new HashMap<String, String>() {
|
|
36
|
+
{
|
|
37
|
+
put("com.secugen.rdservice", "Secugen");
|
|
38
|
+
put("com.scl.rdservice", "Morpho");
|
|
39
|
+
put("com.mantra.rdservice", "Mantra");
|
|
40
|
+
put("com.acpl.registersdk", "Startek FM220");
|
|
41
|
+
put("com.rd.gemalto.com.rdserviceapp", "Gemalto 3M Cogent CSD200");
|
|
42
|
+
|
|
43
|
+
put("com.tatvik.bio.tmf20", "Tatvik TMF20");
|
|
44
|
+
put("com.evolute.rdservice", "Evolute");
|
|
45
|
+
put("com.precision.pb510.rdservice", "PB510");
|
|
46
|
+
put("com.mantra.mis100v2.rdservice", "MIS100V2 by Mantra");
|
|
47
|
+
put("com.nextbiometrics.rdservice", "NEXT Biometrics NB-3023");
|
|
48
|
+
put("com.iritech.rdservice", "IriTech IriShield");
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
private static final Map<String, String> mapRDDriverBlacklist = new HashMap<String, String>();
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
private RDServiceManager(@NonNull final Builder builder) {
|
|
56
|
+
mRDEvent = builder._rdevent;
|
|
57
|
+
mapRDDriverWhitelist.putAll(builder.mapNewWhitelistedRDDrivers);
|
|
58
|
+
mapRDDriverBlacklist.putAll(builder.mapBlacklistedRDDrivers);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Builder class to create a configured instance of RDServiceManager.
|
|
64
|
+
*/
|
|
65
|
+
public static class Builder {
|
|
66
|
+
private RDServiceEvents _rdevent = null;
|
|
67
|
+
private Map<String, String> mapNewWhitelistedRDDrivers = new HashMap<String, String>();
|
|
68
|
+
private Map<String, String> mapBlacklistedRDDrivers = new HashMap<String, String>();
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Constructor for the builder.
|
|
72
|
+
*
|
|
73
|
+
* @param eventActivity Reference to Activity that has implemented RDServiceEvents interface so that it can receive callback when RDService drivers are discovered or when fingerprint is captured.
|
|
74
|
+
*/
|
|
75
|
+
public Builder(@NonNull final RDServiceEvents eventActivity) {
|
|
76
|
+
_rdevent = eventActivity;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whitelist one or more RDService drivers. The response after driver discovery will contain a flag whether the discovered driver is whitelisted or not. However, it does not stop you from using a driver that is not already whitelisted. Note that a few popular drivers (eg: Morpho, Mantra, Secugen, Startek, 3M) are already whitelisted.
|
|
81
|
+
* @param mapNewWhitelistedRDDrivers A Map of new whitelisted drivers containing PlayStore package names and an optional label for each driver.
|
|
82
|
+
* @return A reference to this builder to easily chain other builder methods.
|
|
83
|
+
*/
|
|
84
|
+
public Builder whitelistRDDrivers(@NonNull final Map<String, String> mapNewWhitelistedRDDrivers) {
|
|
85
|
+
this.mapNewWhitelistedRDDrivers = mapNewWhitelistedRDDrivers;
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Blacklist one or more RDService drivers. These drivers will be ignored during driver discovery and will not be allowed to capture from.
|
|
91
|
+
* @param mapBlacklistedRDDrivers A Map of blacklisted drivers containing PlayStore package names and an optional label for each driver.
|
|
92
|
+
* @return A reference to this builder to easily chain other builder methods.
|
|
93
|
+
*/
|
|
94
|
+
public Builder blacklistRDDrivers(@NonNull final Map<String, String> mapBlacklistedRDDrivers) {
|
|
95
|
+
this.mapBlacklistedRDDrivers = mapBlacklistedRDDrivers;
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Create and return a configured instance of RDServiceManager.
|
|
101
|
+
* @return An instance of RDServiceManager.
|
|
102
|
+
*/
|
|
103
|
+
public RDServiceManager create() {
|
|
104
|
+
if (_rdevent == null) {
|
|
105
|
+
throw new IllegalStateException("First set your Activity that implements RDServiceEvent by calling setRDServiceEventActivity()");
|
|
106
|
+
}
|
|
107
|
+
return new RDServiceManager(this);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Dispatch onActivityResult here from the implementing Activity.
|
|
114
|
+
*/
|
|
115
|
+
public void onActivityResult(@NonNull int requestCode, @NonNull int resultCode, @NonNull Intent data) {
|
|
116
|
+
|
|
117
|
+
Log.i(TAG, "onActivityResult: " + requestCode + ", " + resultCode + " ~~ " + mapRDDiscoverRC.toString());
|
|
118
|
+
|
|
119
|
+
if (mapRDDiscoverRC.containsKey(requestCode)) {
|
|
120
|
+
String rdservice_pkg_name = mapRDDiscoverRC.get(requestCode);
|
|
121
|
+
if (resultCode == RESULT_OK) {
|
|
122
|
+
onRDServiceInfoResponse(data, rdservice_pkg_name); // RDService Info Received
|
|
123
|
+
} else {
|
|
124
|
+
mRDEvent.onRDServiceDriverDiscoveryFailed(resultCode, data, rdservice_pkg_name, ""); // RDService Info Failed
|
|
125
|
+
}
|
|
126
|
+
} else if (mapRDCaptureRC.containsKey(requestCode)) {
|
|
127
|
+
String rdservice_pkg_name = mapRDCaptureRC.get(requestCode);
|
|
128
|
+
if (resultCode == RESULT_OK) {
|
|
129
|
+
onRDServiceCaptureIntentResponse(data, rdservice_pkg_name); // Fingerprint Captured
|
|
130
|
+
} else {
|
|
131
|
+
mRDEvent.onRDServiceCaptureFailed(resultCode, data, rdservice_pkg_name); // Fingerprint Capture Failed
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Initiate discovery of installed RDService drivers on current device. For every discovered driver, the onRDServiceDriverDiscovery() will be called.
|
|
139
|
+
*/
|
|
140
|
+
public void discoverRdService(Activity activity) {
|
|
141
|
+
Intent intentServiceList = new Intent("in.gov.uidai.rdservice.fp.INFO");
|
|
142
|
+
List<ResolveInfo> resolveInfoList = activity.getPackageManager().queryIntentActivities(intentServiceList, 0);
|
|
143
|
+
// String packageNamesStr = "";
|
|
144
|
+
|
|
145
|
+
if (resolveInfoList.isEmpty()) {
|
|
146
|
+
mRDEvent.onRDServiceDriverNotFound();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
int iInfo = 0;
|
|
151
|
+
for (ResolveInfo resolveInfo : resolveInfoList) {
|
|
152
|
+
String _pkg = resolveInfo.activityInfo.packageName;
|
|
153
|
+
|
|
154
|
+
if (!mapRDDriverBlacklist.containsKey(_pkg)) {
|
|
155
|
+
try {
|
|
156
|
+
// Assign an index to current RDService driver
|
|
157
|
+
int next_rdservice_index = mapRDDriverRCIndex.size() + 1;
|
|
158
|
+
mapRDDriverRCIndex.put(_pkg, next_rdservice_index);
|
|
159
|
+
|
|
160
|
+
// Calculate and map request-code for the current RDService GetInfo Intent
|
|
161
|
+
int next_discover_rc_index = getRDServiceDiscoverRC(next_rdservice_index);
|
|
162
|
+
mapRDDiscoverRC.put(next_discover_rc_index, _pkg);
|
|
163
|
+
|
|
164
|
+
// Calculate and map request-code for the current RDService Capture Intent
|
|
165
|
+
int next_capture_rc_index = getRDServiceCaptureRC(next_rdservice_index);
|
|
166
|
+
mapRDCaptureRC.put(next_capture_rc_index, _pkg);
|
|
167
|
+
|
|
168
|
+
// Get RD Service Info..
|
|
169
|
+
Intent intentInfo = new Intent("in.gov.uidai.rdservice.fp.INFO");
|
|
170
|
+
intentInfo.setPackage(_pkg);
|
|
171
|
+
activity.startActivityForResult(intentInfo, next_discover_rc_index);
|
|
172
|
+
|
|
173
|
+
Log.e(TAG, "RD SERVICE Package Found: (" + next_rdservice_index + ") " + next_discover_rc_index + " ~ " + _pkg + " ~~ " + mapRDDriverRCIndex + " ~ " + mapRDDiscoverRC);
|
|
174
|
+
} catch (Exception e) {
|
|
175
|
+
e.printStackTrace();
|
|
176
|
+
mRDEvent.onRDServiceDriverDiscoveryFailed(0, null, _pkg, e.getMessage());
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
mRDEvent.onRDServiceDriverDiscoveryFailed(0, null, _pkg, "Package not whitelisted");
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
++iInfo;
|
|
184
|
+
|
|
185
|
+
// Limit max installed driver discovery count
|
|
186
|
+
if (iInfo > 10) {
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Initiate fingerprint capture.
|
|
195
|
+
* @param rd_service_package The package name of the active RDService driver to be used for capture.
|
|
196
|
+
* @param pid_options The PID-Options XML string to configure the RDService driver as per Aadhaar Registered Devices Specification v2.0 by UIDAI (https://uidai.gov.in/images/resource/Aadhaar_Registered_Devices_2_0_4.pdf).
|
|
197
|
+
*/
|
|
198
|
+
public void captureRdService(@NonNull String rd_service_package, @NonNull String pid_options,Activity activity) {
|
|
199
|
+
|
|
200
|
+
if (mapRDDriverRCIndex.containsKey(rd_service_package)) {
|
|
201
|
+
int capture_rc_index = mapRDDriverRCIndex.get(rd_service_package);
|
|
202
|
+
int capture_rc = getRDServiceCaptureRC(capture_rc_index);
|
|
203
|
+
|
|
204
|
+
Log.d(TAG, "RDSERVICE BEFORE CAPTURE: pid_options: (" + capture_rc_index + ") " + capture_rc + " ~ " + pid_options);
|
|
205
|
+
|
|
206
|
+
// Capture fingerprint using RD Service
|
|
207
|
+
Intent intentCapture = new Intent("in.gov.uidai.rdservice.fp.CAPTURE");
|
|
208
|
+
intentCapture.setPackage(rd_service_package);
|
|
209
|
+
intentCapture.putExtra("PID_OPTIONS", pid_options);
|
|
210
|
+
activity.startActivityForResult(intentCapture, capture_rc);
|
|
211
|
+
} else {
|
|
212
|
+
mRDEvent.onRDServiceDriverDiscoveryFailed(0, null, rd_service_package, "Package not found or not whitelisted");
|
|
213
|
+
Log.d(TAG, "RDSERVICE CAPTURE ERROR: package not found or not whitelisted: " + rd_service_package);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Process response RDService driver status info.
|
|
220
|
+
* TODO: return parsed data
|
|
221
|
+
* @param data Intent response returned from RDService driver activity
|
|
222
|
+
* @param rd_service_package The package name of the RDService driver
|
|
223
|
+
*/
|
|
224
|
+
private void onRDServiceInfoResponse(@NonNull Intent data, @NonNull String rd_service_package) {
|
|
225
|
+
|
|
226
|
+
Bundle b = data.getExtras();
|
|
227
|
+
|
|
228
|
+
if (b != null) {
|
|
229
|
+
// sendWebViewResponse("rdservice_info", b.getString("RD_SERVICE_INFO", "") + "<RD_SERVICE_ANDROID_PACKAGE=\"" + rd_service_package + "\" />");
|
|
230
|
+
|
|
231
|
+
Log.d(TAG, "onRDServiceInfoResponse: " + b.getString("RD_SERVICE_INFO", "") + " //// " + rd_service_package);
|
|
232
|
+
|
|
233
|
+
mRDEvent.onRDServiceDriverDiscovery(b.getString("RD_SERVICE_INFO", ""), rd_service_package, mapRDDriverWhitelist.containsKey(rd_service_package));
|
|
234
|
+
|
|
235
|
+
Log.i(TAG, "onRDServiceInfoResponse: Device Info: \n\n Device = " + b.getString("DEVICE_INFO", "") + " \n\nRDService = " + b.getString("RD_SERVICE_INFO", ""));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Process response RDService driver status info.
|
|
242
|
+
* @param data Intent response returned from RDService driver activity
|
|
243
|
+
* @param rd_service_package The package name of the RDService driver
|
|
244
|
+
*/
|
|
245
|
+
private void onRDServiceCaptureIntentResponse(@NonNull Intent data, @NonNull String rd_service_package) {
|
|
246
|
+
|
|
247
|
+
Bundle b = data.getExtras();
|
|
248
|
+
|
|
249
|
+
if (b != null) {
|
|
250
|
+
// sendWebViewResponse("rdservice_resp", b.getString("PID_DATA", ""));
|
|
251
|
+
mRDEvent.onRDServiceCaptureResponse(b.getString("PID_DATA", ""), rd_service_package);
|
|
252
|
+
|
|
253
|
+
Log.i(TAG, "onRDServiceCaptureIntentResponse: Capture Info: \n\n PID-DATA = " + b.getString("PID_DATA", "") + " \n\nDeviceNotConnected = " + b.getString("DNC", ""));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Generate and return the next result-code for RDService driver discovery
|
|
260
|
+
* @param index Index of the RDService driver. Usually last used index + 1.
|
|
261
|
+
* @return The result-code
|
|
262
|
+
*/
|
|
263
|
+
private int getRDServiceDiscoverRC(@NonNull int index) {
|
|
264
|
+
return RC_RDSERVICE_DISCOVER_START_INDEX + index;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Generate and return the next result-code for RDService fingerprint capture
|
|
269
|
+
* @param index Index of the RDService driver. Usually last used index + 1.
|
|
270
|
+
* @return The result-code
|
|
271
|
+
*/
|
|
272
|
+
private int getRDServiceCaptureRC(@NonNull int index) {
|
|
273
|
+
return RC_RDSERVICE_CAPTURE_START_INDEX + index;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
package com.reactnativerdservicefingerprintscanner;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.widget.Toast;
|
|
6
|
+
|
|
7
|
+
import androidx.annotation.NonNull;
|
|
8
|
+
|
|
9
|
+
import com.facebook.react.bridge.Arguments;
|
|
10
|
+
import com.facebook.react.bridge.BaseActivityEventListener;
|
|
11
|
+
import com.facebook.react.bridge.Promise;
|
|
12
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
14
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
15
|
+
import com.facebook.react.bridge.WritableMap;
|
|
16
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
17
|
+
|
|
18
|
+
@ReactModule(name = RdserviceFingerprintscannerModule.NAME)
|
|
19
|
+
public class RdserviceFingerprintscannerModule extends ReactContextBaseJavaModule implements RDServiceEvents {
|
|
20
|
+
public static final String NAME = "RdserviceFingerprintscanner";
|
|
21
|
+
public Promise promise;
|
|
22
|
+
|
|
23
|
+
private RDServiceManager rdServiceManager;
|
|
24
|
+
String servicePackage = "";
|
|
25
|
+
|
|
26
|
+
public RdserviceFingerprintscannerModule(ReactApplicationContext reactContext) {
|
|
27
|
+
super(reactContext);
|
|
28
|
+
reactContext.addActivityEventListener(new RDServiceActivityEventListener());
|
|
29
|
+
rdServiceManager = new RDServiceManager.Builder(this).create();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Override
|
|
33
|
+
@NonNull
|
|
34
|
+
public String getName() {
|
|
35
|
+
return NAME;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@ReactMethod
|
|
39
|
+
public void getDeviceInfo( Promise promise) {
|
|
40
|
+
final Activity activity = getCurrentActivity();
|
|
41
|
+
rdServiceManager.discoverRdService(activity);
|
|
42
|
+
this.promise = promise;
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@ReactMethod
|
|
47
|
+
public void captureFinger(String pidOptions, Promise promise) {
|
|
48
|
+
final Activity activity = getCurrentActivity();
|
|
49
|
+
|
|
50
|
+
rdServiceManager.captureRdService(servicePackage,pidOptions,activity);
|
|
51
|
+
this.promise = promise;
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@Override
|
|
56
|
+
public void onRDServiceDriverDiscovery(String rdServiceInfo, String rdServicePackage, Boolean isWhitelisted) {
|
|
57
|
+
// Called when an installed driver is discovered
|
|
58
|
+
servicePackage = rdServicePackage;
|
|
59
|
+
|
|
60
|
+
WritableMap responseData = Arguments.createMap();
|
|
61
|
+
responseData.putInt("status",1);
|
|
62
|
+
responseData.putString("rdServiceInfo", rdServiceInfo);
|
|
63
|
+
responseData.putString("rdServicePackage", rdServicePackage);
|
|
64
|
+
responseData.putBoolean("isWhitelisted",isWhitelisted);
|
|
65
|
+
promise.resolve(responseData);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Override
|
|
69
|
+
public void onRDServiceCaptureResponse(String pidData, String rdServicePackage) {
|
|
70
|
+
// Called when fingerprint is successfully captured
|
|
71
|
+
WritableMap responseData = Arguments.createMap();
|
|
72
|
+
responseData.putInt("status",1);
|
|
73
|
+
responseData.putString("pidData", pidData);
|
|
74
|
+
responseData.putString("rdServicePackage", rdServicePackage);
|
|
75
|
+
promise.resolve(responseData);
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@Override
|
|
80
|
+
public void onRDServiceDriverNotFound() {
|
|
81
|
+
// Called when no installed driver is found
|
|
82
|
+
WritableMap responseData = Arguments.createMap();
|
|
83
|
+
responseData.putInt("status",0);
|
|
84
|
+
responseData.putString("message","Driver Not Found");
|
|
85
|
+
promise.resolve(responseData);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@Override
|
|
89
|
+
public void onRDServiceDriverDiscoveryFailed(int resultCode, Intent data, String rdServicePackage, String reason) {
|
|
90
|
+
// Called when a discovered driver fails to provide a proper status information
|
|
91
|
+
promise.reject("DRIVER_DISCOVERY_FAILED","Driver Discovery Failed");
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@Override
|
|
96
|
+
public void onRDServiceCaptureFailed(int resultCode, Intent data, String rdServicePackage) {
|
|
97
|
+
// Called when fingerprint capture fails
|
|
98
|
+
promise.reject("FINGERPRINT_CAPTURE__FAILED","FingerPrint Capture Failed");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private class RDServiceActivityEventListener extends BaseActivityEventListener {
|
|
102
|
+
@Override
|
|
103
|
+
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
|
|
104
|
+
super.onActivityResult(activity, requestCode, resultCode, data);
|
|
105
|
+
rdServiceManager.onActivityResult(requestCode, resultCode, data);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.reactnativerdservicefingerprintscanner;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.ReactPackage;
|
|
6
|
+
import com.facebook.react.bridge.NativeModule;
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
9
|
+
|
|
10
|
+
import java.util.ArrayList;
|
|
11
|
+
import java.util.Collections;
|
|
12
|
+
import java.util.List;
|
|
13
|
+
|
|
14
|
+
public class RdserviceFingerprintscannerPackage implements ReactPackage {
|
|
15
|
+
@NonNull
|
|
16
|
+
@Override
|
|
17
|
+
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
18
|
+
List<NativeModule> modules = new ArrayList<>();
|
|
19
|
+
modules.add(new RdserviceFingerprintscannerModule(reactContext));
|
|
20
|
+
return modules;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@NonNull
|
|
24
|
+
@Override
|
|
25
|
+
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
26
|
+
return Collections.emptyList();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.captureFinger = captureFinger;
|
|
7
|
+
exports.getDeviceInfo = getDeviceInfo;
|
|
8
|
+
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
|
|
11
|
+
const LINKING_ERROR = `The package 'react-native-rdservice-fingerprintscanner' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
12
|
+
ios: "- You have run 'pod install'\n",
|
|
13
|
+
default: ''
|
|
14
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
15
|
+
const RdserviceFingerprintscanner = _reactNative.NativeModules.RdserviceFingerprintscanner ? _reactNative.NativeModules.RdserviceFingerprintscanner : new Proxy({}, {
|
|
16
|
+
get() {
|
|
17
|
+
throw new Error(LINKING_ERROR);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
function getDeviceInfo() {
|
|
23
|
+
return RdserviceFingerprintscanner.getDeviceInfo();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function captureFinger() {
|
|
27
|
+
return RdserviceFingerprintscanner.captureFinger();
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.js"],"names":["LINKING_ERROR","Platform","select","ios","default","RdserviceFingerprintscanner","NativeModules","Proxy","get","Error","getDeviceInfo","captureFinger"],"mappings":";;;;;;;;AAAA;;AAEA,MAAMA,aAAa,GAChB,oGAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,2BAA2B,GAAGC,2BAAcD,2BAAd,GAChCC,2BAAcD,2BADkB,GAEhC,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;;AAWO,SAASU,aAAT,GAAyB;AAC9B,SAAOL,2BAA2B,CAACK,aAA5B,EAAP;AACD;;AAEM,SAASC,aAAT,GAAyB;AAC9B,SAAON,2BAA2B,CAACM,aAA5B,EAAP;AACD","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-rdservice-fingerprintscanner' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst RdserviceFingerprintscanner = NativeModules.RdserviceFingerprintscanner\n ? NativeModules.RdserviceFingerprintscanner\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport function getDeviceInfo() {\n return RdserviceFingerprintscanner.getDeviceInfo();\n}\n\nexport function captureFinger() {\n return RdserviceFingerprintscanner.captureFinger();\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package 'react-native-rdservice-fingerprintscanner' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
6
|
+
const RdserviceFingerprintscanner = NativeModules.RdserviceFingerprintscanner ? NativeModules.RdserviceFingerprintscanner : new Proxy({}, {
|
|
7
|
+
get() {
|
|
8
|
+
throw new Error(LINKING_ERROR);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
});
|
|
12
|
+
export function getDeviceInfo() {
|
|
13
|
+
return RdserviceFingerprintscanner.getDeviceInfo();
|
|
14
|
+
}
|
|
15
|
+
export function captureFinger() {
|
|
16
|
+
return RdserviceFingerprintscanner.captureFinger();
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.js"],"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","RdserviceFingerprintscanner","Proxy","get","Error","getDeviceInfo","captureFinger"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,MAAMC,aAAa,GAChB,oGAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,2BAA2B,GAAGN,aAAa,CAACM,2BAAd,GAChCN,aAAa,CAACM,2BADkB,GAEhC,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUP,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAWA,OAAO,SAASQ,aAAT,GAAyB;AAC9B,SAAOJ,2BAA2B,CAACI,aAA5B,EAAP;AACD;AAED,OAAO,SAASC,aAAT,GAAyB;AAC9B,SAAOL,2BAA2B,CAACK,aAA5B,EAAP;AACD","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-rdservice-fingerprintscanner' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst RdserviceFingerprintscanner = NativeModules.RdserviceFingerprintscanner\n ? NativeModules.RdserviceFingerprintscanner\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport function getDeviceInfo() {\n return RdserviceFingerprintscanner.getDeviceInfo();\n}\n\nexport function captureFinger() {\n return RdserviceFingerprintscanner.captureFinger();\n}\n"]}
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-rdservice-fingerprintscanner",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "FingerPrint Scanner RD Service",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"cpp",
|
|
16
|
+
"react-native-rdservice-fingerprintscanner.podspec",
|
|
17
|
+
"!lib/typescript/example",
|
|
18
|
+
"!android/build",
|
|
19
|
+
"!ios/build",
|
|
20
|
+
"!**/__tests__",
|
|
21
|
+
"!**/__fixtures__",
|
|
22
|
+
"!**/__mocks__"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "jest",
|
|
26
|
+
"typescript": "tsc --noEmit",
|
|
27
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
28
|
+
"release": "release-it",
|
|
29
|
+
"example": "yarn --cwd example",
|
|
30
|
+
"pods": "cd example && pod-install --quiet",
|
|
31
|
+
"bootstrap": "yarn example && yarn && yarn pods"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"react-native",
|
|
35
|
+
"ios",
|
|
36
|
+
"android"
|
|
37
|
+
],
|
|
38
|
+
"repository": "https://github.com/senthalan2/react-native-rdservice-fingerprintscanner",
|
|
39
|
+
"author": "Senthalan S <senthalan2@gmail.com> (https://github.com/senthalan2)",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/senthalan2/react-native-rdservice-fingerprintscanner/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/senthalan2/react-native-rdservice-fingerprintscanner#readme",
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"registry": "https://registry.npmjs.org/"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
50
|
+
"@react-native-community/eslint-config": "^2.0.0",
|
|
51
|
+
"@release-it/conventional-changelog": "^2.0.0",
|
|
52
|
+
"@types/jest": "^26.0.0",
|
|
53
|
+
"@types/react": "^16.9.19",
|
|
54
|
+
"@types/react-native": "0.62.13",
|
|
55
|
+
"commitlint": "^11.0.0",
|
|
56
|
+
"eslint": "^7.2.0",
|
|
57
|
+
"eslint-config-prettier": "^7.0.0",
|
|
58
|
+
"eslint-plugin-prettier": "^3.1.3",
|
|
59
|
+
"husky": "^6.0.0",
|
|
60
|
+
"jest": "^26.0.1",
|
|
61
|
+
"pod-install": "^0.1.0",
|
|
62
|
+
"prettier": "^2.0.5",
|
|
63
|
+
"react": "16.13.1",
|
|
64
|
+
"react-native": "0.63.4",
|
|
65
|
+
"react-native-builder-bob": "^0.18.0",
|
|
66
|
+
"release-it": "^14.2.2",
|
|
67
|
+
"typescript": "^4.1.3"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"react": "*",
|
|
71
|
+
"react-native": "*"
|
|
72
|
+
},
|
|
73
|
+
"jest": {
|
|
74
|
+
"preset": "react-native",
|
|
75
|
+
"modulePathIgnorePatterns": [
|
|
76
|
+
"<rootDir>/example/node_modules",
|
|
77
|
+
"<rootDir>/lib/"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"commitlint": {
|
|
81
|
+
"extends": [
|
|
82
|
+
"@commitlint/config-conventional"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"release-it": {
|
|
86
|
+
"git": {
|
|
87
|
+
"commitMessage": "chore: release ${version}",
|
|
88
|
+
"tagName": "v${version}"
|
|
89
|
+
},
|
|
90
|
+
"npm": {
|
|
91
|
+
"publish": true
|
|
92
|
+
},
|
|
93
|
+
"github": {
|
|
94
|
+
"release": true
|
|
95
|
+
},
|
|
96
|
+
"plugins": {
|
|
97
|
+
"@release-it/conventional-changelog": {
|
|
98
|
+
"preset": "angular"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"eslintConfig": {
|
|
103
|
+
"root": true,
|
|
104
|
+
"extends": [
|
|
105
|
+
"@react-native-community",
|
|
106
|
+
"prettier"
|
|
107
|
+
],
|
|
108
|
+
"rules": {
|
|
109
|
+
"prettier/prettier": [
|
|
110
|
+
"error",
|
|
111
|
+
{
|
|
112
|
+
"quoteProps": "consistent",
|
|
113
|
+
"singleQuote": true,
|
|
114
|
+
"tabWidth": 2,
|
|
115
|
+
"trailingComma": "es5",
|
|
116
|
+
"useTabs": false
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"eslintIgnore": [
|
|
122
|
+
"node_modules/",
|
|
123
|
+
"lib/"
|
|
124
|
+
],
|
|
125
|
+
"prettier": {
|
|
126
|
+
"quoteProps": "consistent",
|
|
127
|
+
"singleQuote": true,
|
|
128
|
+
"tabWidth": 2,
|
|
129
|
+
"trailingComma": "es5",
|
|
130
|
+
"useTabs": false
|
|
131
|
+
},
|
|
132
|
+
"react-native-builder-bob": {
|
|
133
|
+
"source": "src",
|
|
134
|
+
"output": "lib",
|
|
135
|
+
"targets": [
|
|
136
|
+
"commonjs",
|
|
137
|
+
"module",
|
|
138
|
+
[
|
|
139
|
+
"typescript",
|
|
140
|
+
{
|
|
141
|
+
"project": "tsconfig.build.json"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "react-native-rdservice-fingerprintscanner"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => "10.0" }
|
|
14
|
+
s.source = { :git => "https://github.com/senthalan2/react-native-rdservice-fingerprintscanner.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
|
+
|
|
18
|
+
s.dependency "React-Core"
|
|
19
|
+
end
|
package/src/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package 'react-native-rdservice-fingerprintscanner' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo managed workflow\n';
|
|
8
|
+
|
|
9
|
+
const RdserviceFingerprintscanner = NativeModules.RdserviceFingerprintscanner
|
|
10
|
+
? NativeModules.RdserviceFingerprintscanner
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export function getDeviceInfo() {
|
|
21
|
+
return RdserviceFingerprintscanner.getDeviceInfo();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function captureFinger(pidOptions) {
|
|
25
|
+
return RdserviceFingerprintscanner.captureFinger(pidOptions);
|
|
26
|
+
}
|