react-native-rdservice 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 ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Somnath Kadam
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,319 @@
1
+ # react-native-rdservice
2
+
3
+ A React Native library for capturing biometric data (fingerprint and face) using RD (Registered Device) services on Android. This library integrates with UIDAI-compliant biometric devices for Aadhaar-based authentication and eKYC services.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install react-native-rdservice
9
+ ```
10
+
11
+ or
12
+
13
+ ```sh
14
+ yarn add react-native-rdservice
15
+ ```
16
+
17
+ ## Features
18
+
19
+ - Fingerprint biometric capture using RD services
20
+ - Face biometric capture using RD services
21
+ - Support for custom PID options
22
+ - TypeScript support with full type definitions
23
+ - Promise-based API for easy async/await usage
24
+
25
+ ## API Reference
26
+
27
+ ### Types
28
+
29
+ #### `RdServiceResponse`
30
+
31
+ Response object returned by both fingerprint and face capture methods.
32
+
33
+ ```typescript
34
+ interface RdServiceResponse {
35
+ status: string; // "SUCCESS" or "FAILURE"
36
+ message: string; // XML data on success, error message on failure
37
+ }
38
+ ```
39
+
40
+ ### Methods
41
+
42
+ ---
43
+
44
+ #### `getFingerPrint(deviceName, pidOption)`
45
+
46
+ Captures fingerprint biometric data using the specified RD service device.
47
+
48
+ **Parameters:**
49
+
50
+ | Parameter | Type | Required | Description |
51
+ |-----------|------|----------|-------------|
52
+ | `deviceName` | `string` | Yes | Package name of the RD service app (e.g., `"com.mantra.rdservice"`, `"com.precision.pb510.rdservice"`) |
53
+ | `pidOption` | `string` | No | XML string containing PID options. If empty or less than 10 characters, uses default configuration |
54
+
55
+ **Default PID Options:**
56
+ ```xml
57
+ <?xml version="1.0"?>
58
+ <PidOptions ver="1.0">
59
+ <Opts fCount="1" fType="2" iCount="0" pCount="0" format="0"
60
+ pidVer="2.0" timeout="10000" posh="UNKNOWN" env="P" />
61
+ <CustOpts></CustOpts>
62
+ </PidOptions>
63
+ ```
64
+
65
+ **Returns:** `Promise<RdServiceResponse>`
66
+
67
+ **Success Response:**
68
+ ```typescript
69
+ {
70
+ status: "SUCCESS",
71
+ message: "<?xml version='1.0'?><PidData>...</PidData>" // Biometric XML data
72
+ }
73
+ ```
74
+
75
+ **Error Response:**
76
+ ```typescript
77
+ {
78
+ status: "FAILURE",
79
+ message: "Device not ready" | "Selected device not found" | "RD services not available"
80
+ }
81
+ ```
82
+
83
+ **Example:**
84
+
85
+ ```typescript
86
+ import { getFingerPrint } from 'react-native-rdservice';
87
+
88
+ // Using default PID options
89
+ const captureFingerprint = async () => {
90
+ try {
91
+ const result = await getFingerPrint('com.mantra.rdservice', '');
92
+
93
+ if (result.status === 'SUCCESS') {
94
+ console.log('Fingerprint captured:', result.message);
95
+ // Process the biometric XML data
96
+ // result.message contains the PID XML with biometric information
97
+ } else {
98
+ console.error('Capture failed:', result.message);
99
+ }
100
+ } catch (error) {
101
+ console.error('Error:', error);
102
+ }
103
+ };
104
+
105
+ // Using custom PID options
106
+ const captureFingerprintCustom = async () => {
107
+ const customPidOptions = `<?xml version="1.0"?>
108
+ <PidOptions ver="1.0">
109
+ <Opts fCount="2" fType="2" iCount="0" pCount="0" format="0"
110
+ pidVer="2.0" timeout="15000" posh="UNKNOWN" env="P" />
111
+ <CustOpts>
112
+ <Param name="txnId" value="12345"/>
113
+ </CustOpts>
114
+ </PidOptions>`;
115
+
116
+ const result = await getFingerPrint('com.precision.pb510.rdservice', customPidOptions);
117
+
118
+ if (result.status === 'SUCCESS') {
119
+ // Handle success
120
+ console.log('Biometric data:', result.message);
121
+ }
122
+ };
123
+ ```
124
+
125
+ ---
126
+
127
+ #### `getFaceCapture(deviceName, pidOption)`
128
+
129
+ Captures face biometric data using the specified RD service device.
130
+
131
+ **Parameters:**
132
+
133
+ | Parameter | Type | Required | Description |
134
+ |-----------|------|----------|-------------|
135
+ | `deviceName` | `string` | Yes | Package name of the face RD service app (e.g., `"in.gov.uidai.facerd"`) |
136
+ | `pidOption` | `string` | No | XML string containing PID options for face capture. If empty or less than 10 characters, uses default configuration |
137
+
138
+ **Default PID Options:**
139
+ ```xml
140
+ <?xml version="1.0" encoding="UTF-8"?>
141
+ <PidOptions ver="1.0" env="P">
142
+ <Opts fCount="" fType="" iCount="" iType="" pCount="" pType=""
143
+ format="" pidVer="2.0" timeout="" otp=""
144
+ wadh="sgydIC09zzy6f8Lb3xaAqzKquKe9lFcNR9uTvYxFp+A=" posh="" />
145
+ <CustOpts>
146
+ <Param name="txnId" value="76435891"/>
147
+ <Param name="purpose" value="auth"/>
148
+ <Param name="language" value="en"/>
149
+ </CustOpts>
150
+ </PidOptions>
151
+ ```
152
+
153
+ **Returns:** `Promise<RdServiceResponse>`
154
+
155
+ **Success Response:**
156
+ ```typescript
157
+ {
158
+ status: "SUCCESS",
159
+ message: "<?xml version='1.0'?><PidData>...</PidData>" // Face biometric XML data
160
+ }
161
+ ```
162
+
163
+ **Error Response:**
164
+ ```typescript
165
+ {
166
+ status: "FAILURE",
167
+ message: "Device not ready" | "Selected device not found" | "Face RD services not available"
168
+ }
169
+ ```
170
+
171
+ **Example:**
172
+
173
+ ```typescript
174
+ import { getFaceCapture } from 'react-native-rdservice';
175
+
176
+ // Using default PID options
177
+ const captureFace = async () => {
178
+ try {
179
+ const result = await getFaceCapture('in.gov.uidai.facerd', '');
180
+
181
+ if (result.status === 'SUCCESS') {
182
+ console.log('Face captured:', result.message);
183
+ // Process the face biometric XML data
184
+ // result.message contains the PID XML with face biometric information
185
+ } else {
186
+ console.error('Capture failed:', result.message);
187
+ }
188
+ } catch (error) {
189
+ console.error('Error:', error);
190
+ }
191
+ };
192
+
193
+ // Using custom PID options
194
+ const captureFaceCustom = async () => {
195
+ const customPidOptions = `<?xml version="1.0" encoding="UTF-8"?>
196
+ <PidOptions ver="1.0" env="P">
197
+ <Opts fCount="" fType="" iCount="" iType="" pCount="" pType=""
198
+ format="" pidVer="2.0" timeout="20000" otp=""
199
+ wadh="your_wadh_value_here" posh="" />
200
+ <CustOpts>
201
+ <Param name="txnId" value="customTxnId123"/>
202
+ <Param name="purpose" value="ekyc"/>
203
+ <Param name="language" value="en"/>
204
+ </CustOpts>
205
+ </PidOptions>`;
206
+
207
+ const result = await getFaceCapture('in.gov.uidai.facerd', customPidOptions);
208
+
209
+ if (result.status === 'SUCCESS') {
210
+ // Handle success
211
+ console.log('Face biometric data:', result.message);
212
+ }
213
+ };
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Complete Usage Example
219
+
220
+ ```typescript
221
+ import React, { useState } from 'react';
222
+ import { View, Button, Text, Alert } from 'react-native';
223
+ import { getFingerPrint, getFaceCapture, type RdServiceResponse } from 'react-native-rdservice';
224
+
225
+ const BiometricCapture = () => {
226
+ const [fpData, setFpData] = useState<string>('');
227
+ const [faceData, setFaceData] = useState<string>('');
228
+
229
+ const handleFingerprintCapture = async () => {
230
+ try {
231
+ const result: RdServiceResponse = await getFingerPrint(
232
+ 'com.mantra.rdservice',
233
+ ''
234
+ );
235
+
236
+ if (result.status === 'SUCCESS') {
237
+ setFpData(result.message);
238
+ Alert.alert('Success', 'Fingerprint captured successfully');
239
+ } else {
240
+ Alert.alert('Error', result.message);
241
+ }
242
+ } catch (error) {
243
+ Alert.alert('Error', 'Failed to capture fingerprint');
244
+ console.error(error);
245
+ }
246
+ };
247
+
248
+ const handleFaceCapture = async () => {
249
+ try {
250
+ const result: RdServiceResponse = await getFaceCapture(
251
+ 'in.gov.uidai.facerd',
252
+ ''
253
+ );
254
+
255
+ if (result.status === 'SUCCESS') {
256
+ setFaceData(result.message);
257
+ Alert.alert('Success', 'Face captured successfully');
258
+ } else {
259
+ Alert.alert('Error', result.message);
260
+ }
261
+ } catch (error) {
262
+ Alert.alert('Error', 'Failed to capture face');
263
+ console.error(error);
264
+ }
265
+ };
266
+
267
+ return (
268
+ <View>
269
+ <Button title="Capture Fingerprint" onPress={handleFingerprintCapture} />
270
+ <Button title="Capture Face" onPress={handleFaceCapture} />
271
+
272
+ {fpData ? <Text>Fingerprint Data: {fpData.substring(0, 100)}...</Text> : null}
273
+ {faceData ? <Text>Face Data: {faceData.substring(0, 100)}...</Text> : null}
274
+ </View>
275
+ );
276
+ };
277
+
278
+ export default BiometricCapture;
279
+ ```
280
+
281
+ ## Common RD Service Package Names
282
+
283
+ **Fingerprint Devices:**
284
+ - Mantra: `com.mantra.rdservice`
285
+ - Morpho: `com.scl.rdservice`
286
+ - Precision: `com.precision.pb510.rdservice`
287
+ - Startek: `com.acpl.registersdk`
288
+ - Secugen: `com.secugen.rdservice`
289
+
290
+ **Face Devices:**
291
+ - UIDAI Face RD: `in.gov.uidai.facerd`
292
+
293
+ ## Requirements
294
+
295
+ - React Native 0.60 or higher
296
+ - Android SDK 24 or higher
297
+ - RD service app installed on the device
298
+
299
+ ## Platform Support
300
+
301
+ - Android: ✅ Supported
302
+ - iOS: ❌ Not supported (RD services are Android-only)
303
+
304
+ ## Error Handling
305
+
306
+ The library returns descriptive error messages in the `message` field when `status` is `"FAILURE"`:
307
+
308
+ - **"Device not ready"**: The biometric device is not connected or not ready
309
+ - **"Selected device not found"**: The specified RD service package is not installed
310
+ - **"RD services not available"**: The RD service app is not available on the device
311
+ - **"No action taken"**: User cancelled the operation
312
+
313
+ ## License
314
+
315
+ MIT
316
+
317
+ ## Contributing
318
+
319
+ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository.
@@ -0,0 +1,20 @@
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 = "Rdservice"
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 => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/SomnathKadam/react-native-rdservice.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+ install_modules_dependencies(s)
20
+ end
@@ -0,0 +1,79 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = {name ->
3
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Rdservice_' + name]
4
+ }
5
+
6
+ repositories {
7
+ google()
8
+ mavenCentral()
9
+ }
10
+
11
+ dependencies {
12
+ classpath "com.android.tools.build:gradle:8.7.2"
13
+ // noinspection DifferentKotlinGradleVersion
14
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
15
+ }
16
+ }
17
+
18
+
19
+ apply plugin: "com.android.library"
20
+ apply plugin: "kotlin-android"
21
+
22
+ if (project.parent != null) {
23
+ apply plugin: "com.facebook.react"
24
+ }
25
+
26
+ def getExtOrIntegerDefault(name) {
27
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Rdservice_" + name]).toInteger()
28
+ }
29
+
30
+ android {
31
+ namespace "com.rdservice"
32
+
33
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
34
+
35
+ defaultConfig {
36
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
37
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
38
+ }
39
+
40
+ buildFeatures {
41
+ buildConfig true
42
+ }
43
+
44
+ buildTypes {
45
+ release {
46
+ minifyEnabled false
47
+ }
48
+ }
49
+
50
+ lintOptions {
51
+ disable "GradleCompatible"
52
+ }
53
+
54
+ compileOptions {
55
+ sourceCompatibility JavaVersion.VERSION_1_8
56
+ targetCompatibility JavaVersion.VERSION_1_8
57
+ }
58
+
59
+ sourceSets {
60
+ main {
61
+ java.srcDirs += [
62
+ "generated/java",
63
+ "generated/jni"
64
+ ]
65
+ }
66
+ }
67
+ }
68
+
69
+ repositories {
70
+ mavenCentral()
71
+ google()
72
+ }
73
+
74
+ def kotlin_version = getExtOrDefault("kotlinVersion")
75
+
76
+ dependencies {
77
+ implementation 'com.facebook.react:react-android:0.83.0'
78
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
79
+ }
@@ -0,0 +1,5 @@
1
+ Rdservice_kotlinVersion=2.0.21
2
+ Rdservice_minSdkVersion=24
3
+ Rdservice_targetSdkVersion=34
4
+ Rdservice_compileSdkVersion=35
5
+ Rdservice_ndkVersion=27.1.12297006
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,184 @@
1
+ package com.rdservice
2
+
3
+ import android.app.Activity
4
+ import android.content.Intent
5
+ import com.facebook.react.bridge.ActivityEventListener
6
+ import com.facebook.react.bridge.Arguments
7
+ import com.facebook.react.bridge.BaseActivityEventListener
8
+ import com.facebook.react.bridge.Promise
9
+ import com.facebook.react.bridge.ReactApplicationContext
10
+ import com.facebook.react.bridge.WritableMap
11
+ import com.facebook.react.module.annotations.ReactModule
12
+
13
+ @ReactModule(name = RdserviceModule.NAME)
14
+ class RdserviceModule(reactContext: ReactApplicationContext) :
15
+ NativeRdserviceSpec(reactContext) {
16
+
17
+ companion object {
18
+ const val NAME = "Rdservice"
19
+ const val RDINFO_CODE = 1
20
+ const val RDCAPTURE_CODE = 2
21
+ const val FACE_CAPTURE_CODE = 9
22
+ }
23
+
24
+ private val SUCCESS = "SUCCESS"
25
+ private val FAILURE = "FAILURE"
26
+ private var pckName = ""
27
+ private var pidOption = ""
28
+ private var promise: Promise? = null
29
+
30
+ private val activityEventListener: ActivityEventListener = object : BaseActivityEventListener() {
31
+ override fun onActivityResult(activity: Activity?, requestCode: Int, resultCode: Int, data: Intent?) {
32
+ if (data == null) {
33
+ resolve(FAILURE, "No action taken")
34
+ return
35
+ }
36
+
37
+ when (requestCode) {
38
+ RDINFO_CODE -> {
39
+ val requiredValue = data.getStringExtra("RD_SERVICE_INFO")
40
+
41
+ if (requiredValue == null) {
42
+ resolve(FAILURE, "Device not ready")
43
+ return
44
+ }
45
+ if (requiredValue.length <= 10) {
46
+ resolve(FAILURE, "Device not ready")
47
+ return
48
+ }
49
+ if (requiredValue.lowercase().contains("notready")) {
50
+ resolve(FAILURE, "Device not ready")
51
+ return
52
+ }
53
+
54
+ captureData()
55
+ return
56
+ }
57
+
58
+ RDCAPTURE_CODE -> {
59
+ val captureXML = data.getStringExtra("PID_DATA")
60
+
61
+ if (captureXML == null || captureXML.length <= 10) {
62
+ resolve(FAILURE, "Device not ready")
63
+ return
64
+ }
65
+ if (captureXML.lowercase().contains("device not ready")) {
66
+ resolve(FAILURE, "Device not ready")
67
+ return
68
+ }
69
+ resolve(SUCCESS, captureXML)
70
+ }
71
+
72
+ FACE_CAPTURE_CODE -> {
73
+ val captureXML = data.getStringExtra("response")
74
+
75
+ if (captureXML == null || captureXML.length <= 10) {
76
+ resolve(FAILURE, "Device not ready")
77
+ return
78
+ }
79
+ if (captureXML.lowercase().contains("device not ready")) {
80
+ resolve(FAILURE, "Device not ready")
81
+ return
82
+ }
83
+ resolve(SUCCESS, captureXML)
84
+ }
85
+ }
86
+ }
87
+ }
88
+
89
+ init {
90
+ reactContext.addActivityEventListener(activityEventListener)
91
+ }
92
+
93
+ override fun getName(): String {
94
+ return NAME
95
+ }
96
+
97
+ private fun captureData() {
98
+ var finalPidOption = """<?xml version="1.0"?><PidOptions ver="1.0"><Opts fCount="1" fType="2" iCount="0" pCount="0" format="0" pidVer="2.0" timeout="10000" posh="UNKNOWN" env="P" /><CustOpts></CustOpts></PidOptions>"""
99
+
100
+ if (pidOption.length >= 10) {
101
+ finalPidOption = pidOption
102
+ }
103
+
104
+ val intent = Intent().apply {
105
+ action = "in.gov.uidai.rdservice.fp.CAPTURE"
106
+ putExtra("PID_OPTIONS", finalPidOption)
107
+ setPackage(pckName)
108
+ }
109
+
110
+ val currentActivity = currentActivity
111
+ try {
112
+ currentActivity?.startActivityForResult(intent, RDCAPTURE_CODE)
113
+ } catch (e: Exception) {
114
+ e.printStackTrace()
115
+ resolve(FAILURE, "Selected device not found")
116
+ }
117
+ }
118
+
119
+ private fun captureFaceData() {
120
+ var finalPidOption = """<?xml version="1.0" encoding="UTF-8"?> <PidOptions ver="1.0" env="P"><Opts fCount="" fType="" iCount="" iType="" pCount="" pType="" format="" pidVer="2.0" timeout="" otp="" wadh="sgydIC09zzy6f8Lb3xaAqzKquKe9lFcNR9uTvYxFp+A=" posh="" /> <CustOpts><Param name="txnId" value="76435891"/><Param name="purpose" value="auth"/><Param name="language" value="en"/></CustOpts></PidOptions>"""
121
+
122
+ if (pidOption.length >= 10) {
123
+ finalPidOption = pidOption
124
+ }
125
+
126
+ val intent = Intent().apply {
127
+ action = "in.gov.uidai.rdservice.face.CAPTURE"
128
+ putExtra("request", finalPidOption)
129
+ setPackage(pckName)
130
+ }
131
+
132
+ val currentActivity = currentActivity
133
+ try {
134
+ currentActivity?.startActivityForResult(intent, FACE_CAPTURE_CODE)
135
+ } catch (e: Exception) {
136
+ e.printStackTrace()
137
+ resolve(FAILURE, "Selected device not found")
138
+ }
139
+ }
140
+
141
+ override fun getFingerPrint(deviceName: String, pidOption: String, promise: Promise) {
142
+ try {
143
+ this.promise = promise
144
+ this.pckName = deviceName
145
+ this.pidOption = pidOption
146
+ captureData()
147
+ } catch (e: Exception) {
148
+ e.printStackTrace()
149
+ resolve(FAILURE, "RD services not available")
150
+ }
151
+ }
152
+
153
+ override fun getFaceCapture(deviceName: String, pidOption: String, promise: Promise) {
154
+ try {
155
+ this.promise = promise
156
+ this.pckName = deviceName
157
+ this.pidOption = pidOption
158
+ captureFaceData()
159
+ } catch (e: Exception) {
160
+ e.printStackTrace()
161
+ resolve(FAILURE, "Face RD services not available")
162
+ }
163
+ }
164
+
165
+ private fun parseBioMetricData(bioxml: String): String {
166
+ return bioxml
167
+ .replace("\"", "'")
168
+ .replace("\n ", " ")
169
+ .replace("\n ", " ")
170
+ }
171
+
172
+ private fun resolve(status: String, message: String) {
173
+ if (promise == null) {
174
+ return
175
+ }
176
+
177
+ val map: WritableMap = Arguments.createMap()
178
+ map.putString("status", status.uppercase())
179
+ map.putString("message", parseBioMetricData(message))
180
+
181
+ promise?.resolve(map)
182
+ promise = null
183
+ }
184
+ }
@@ -0,0 +1,33 @@
1
+ package com.rdservice
2
+
3
+ import com.facebook.react.BaseReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+ import java.util.HashMap
9
+
10
+ class RdservicePackage : BaseReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return if (name == RdserviceModule.NAME) {
13
+ RdserviceModule(reactContext)
14
+ } else {
15
+ null
16
+ }
17
+ }
18
+
19
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
+ return ReactModuleInfoProvider {
21
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
22
+ moduleInfos[RdserviceModule.NAME] = ReactModuleInfo(
23
+ RdserviceModule.NAME,
24
+ RdserviceModule.NAME,
25
+ false, // canOverrideExistingModule
26
+ false, // needsEagerInit
27
+ false, // isCxxModule
28
+ true // isTurboModule
29
+ )
30
+ moduleInfos
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,5 @@
1
+ #import <RdserviceSpec/RdserviceSpec.h>
2
+
3
+ @interface Rdservice : NSObject <NativeRdserviceSpec>
4
+
5
+ @end
@@ -0,0 +1,21 @@
1
+ #import "Rdservice.h"
2
+
3
+ @implementation Rdservice
4
+ - (NSNumber *)multiply:(double)a b:(double)b {
5
+ NSNumber *result = @(a * b);
6
+
7
+ return result;
8
+ }
9
+
10
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
11
+ (const facebook::react::ObjCTurboModule::InitParams &)params
12
+ {
13
+ return std::make_shared<facebook::react::NativeRdserviceSpecJSI>(params);
14
+ }
15
+
16
+ + (NSString *)moduleName
17
+ {
18
+ return @"Rdservice";
19
+ }
20
+
21
+ @end
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('Rdservice');
5
+ //# sourceMappingURL=NativeRdservice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeRdservice.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAYpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,WAAW,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ import Rdservice from "./NativeRdservice.js";
4
+ export function getFingerPrint(deviceName, pidOption) {
5
+ return Rdservice.getFingerPrint(deviceName, pidOption);
6
+ }
7
+ export function getFaceCapture(deviceName, pidOption) {
8
+ return Rdservice.getFaceCapture(deviceName, pidOption);
9
+ }
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Rdservice","getFingerPrint","deviceName","pidOption","getFaceCapture"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,SAAS,MAAkC,sBAAmB;AAIrE,OAAO,SAASC,cAAcA,CAC5BC,UAAkB,EAClBC,SAAiB,EACW;EAC5B,OAAOH,SAAS,CAACC,cAAc,CAACC,UAAU,EAAEC,SAAS,CAAC;AACxD;AAEA,OAAO,SAASC,cAAcA,CAC5BF,UAAkB,EAClBC,SAAiB,EACW;EAC5B,OAAOH,SAAS,CAACI,cAAc,CAACF,UAAU,EAAEC,SAAS,CAAC;AACxD","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,12 @@
1
+ import { type TurboModule } from 'react-native';
2
+ export interface RdServiceResponse {
3
+ status: string;
4
+ message: string;
5
+ }
6
+ export interface Spec extends TurboModule {
7
+ getFingerPrint(deviceName: string, pidOption: string): Promise<RdServiceResponse>;
8
+ getFaceCapture(deviceName: string, pidOption: string): Promise<RdServiceResponse>;
9
+ }
10
+ declare const _default: Spec;
11
+ export default _default;
12
+ //# sourceMappingURL=NativeRdservice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeRdservice.d.ts","sourceRoot":"","sources":["../../../src/NativeRdservice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAClF,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACnF;;AAED,wBAAmE"}
@@ -0,0 +1,5 @@
1
+ import { type RdServiceResponse } from './NativeRdservice';
2
+ export type { RdServiceResponse };
3
+ export declare function getFingerPrint(deviceName: string, pidOption: string): Promise<RdServiceResponse>;
4
+ export declare function getFaceCapture(deviceName: string, pidOption: string): Promise<RdServiceResponse>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtE,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,iBAAiB,CAAC,CAE5B;AAED,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,iBAAiB,CAAC,CAE5B"}
package/package.json ADDED
@@ -0,0 +1,179 @@
1
+ {
2
+ "name": "react-native-rdservice",
3
+ "version": "0.1.0",
4
+ "description": "Reading Finger print and Face data using RD services in Android",
5
+ "main": "./lib/module/index.js",
6
+ "types": "./lib/typescript/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.tsx",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "default": "./lib/module/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "android",
19
+ "ios",
20
+ "cpp",
21
+ "*.podspec",
22
+ "react-native.config.js",
23
+ "!ios/build",
24
+ "!android/build",
25
+ "!android/gradle",
26
+ "!android/gradlew",
27
+ "!android/gradlew.bat",
28
+ "!android/local.properties",
29
+ "!**/__tests__",
30
+ "!**/__fixtures__",
31
+ "!**/__mocks__",
32
+ "!**/.*"
33
+ ],
34
+ "scripts": {
35
+ "example": "yarn workspace react-native-rdservice-example",
36
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
37
+ "prepare": "bob build",
38
+ "typecheck": "tsc",
39
+ "test": "jest",
40
+ "release": "release-it --only-version",
41
+ "lint": "eslint \"**/*.{js,ts,tsx}\""
42
+ },
43
+ "keywords": [
44
+ "react-native",
45
+ "android",
46
+ "biometric",
47
+ "fingerprint",
48
+ "face-recognition",
49
+ "rd-service",
50
+ "uidai",
51
+ "aadhaar",
52
+ "ekyc",
53
+ "biometric-authentication",
54
+ "mantra",
55
+ "morpho",
56
+ "registered-device"
57
+ ],
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://github.com/SomnathKadam/react-native-rdservice.git"
61
+ },
62
+ "author": "Somnath Kadam <somnath.kadam@consisty.com> (https://github.com/SomnathKadam)",
63
+ "license": "MIT",
64
+ "bugs": {
65
+ "url": "https://github.com/SomnathKadam/react-native-rdservice/issues"
66
+ },
67
+ "homepage": "https://github.com/SomnathKadam/react-native-rdservice#readme",
68
+ "publishConfig": {
69
+ "registry": "https://registry.npmjs.org/"
70
+ },
71
+ "devDependencies": {
72
+ "@commitlint/config-conventional": "^19.8.1",
73
+ "@eslint/compat": "^1.3.2",
74
+ "@eslint/eslintrc": "^3.3.1",
75
+ "@eslint/js": "^9.35.0",
76
+ "@react-native/babel-preset": "0.83.0",
77
+ "@react-native/eslint-config": "0.83.0",
78
+ "@release-it/conventional-changelog": "^10.0.1",
79
+ "@types/jest": "^29.5.14",
80
+ "@types/react": "^19.2.0",
81
+ "commitlint": "^19.8.1",
82
+ "del-cli": "^6.0.0",
83
+ "eslint": "^9.35.0",
84
+ "eslint-config-prettier": "^10.1.8",
85
+ "eslint-plugin-prettier": "^5.5.4",
86
+ "jest": "^29.7.0",
87
+ "lefthook": "^2.0.3",
88
+ "prettier": "^2.8.8",
89
+ "react": "19.2.0",
90
+ "react-native": "0.83.0",
91
+ "react-native-builder-bob": "^0.40.13",
92
+ "release-it": "^19.0.4",
93
+ "turbo": "^2.5.6",
94
+ "typescript": "^5.9.2"
95
+ },
96
+ "peerDependencies": {
97
+ "react": "*",
98
+ "react-native": "*"
99
+ },
100
+ "workspaces": [
101
+ "example"
102
+ ],
103
+ "packageManager": "yarn@4.11.0",
104
+ "react-native-builder-bob": {
105
+ "source": "src",
106
+ "output": "lib",
107
+ "targets": [
108
+ [
109
+ "module",
110
+ {
111
+ "esm": true
112
+ }
113
+ ],
114
+ [
115
+ "typescript",
116
+ {
117
+ "project": "tsconfig.build.json"
118
+ }
119
+ ]
120
+ ]
121
+ },
122
+ "codegenConfig": {
123
+ "name": "RdserviceSpec",
124
+ "type": "modules",
125
+ "jsSrcsDir": "src",
126
+ "android": {
127
+ "javaPackageName": "com.rdservice"
128
+ }
129
+ },
130
+ "jest": {
131
+ "preset": "react-native",
132
+ "modulePathIgnorePatterns": [
133
+ "<rootDir>/example/node_modules",
134
+ "<rootDir>/lib/"
135
+ ]
136
+ },
137
+ "commitlint": {
138
+ "extends": [
139
+ "@commitlint/config-conventional"
140
+ ]
141
+ },
142
+ "release-it": {
143
+ "git": {
144
+ "commitMessage": "chore: release ${version}",
145
+ "tagName": "v${version}"
146
+ },
147
+ "npm": {
148
+ "publish": true
149
+ },
150
+ "github": {
151
+ "release": true
152
+ },
153
+ "plugins": {
154
+ "@release-it/conventional-changelog": {
155
+ "preset": {
156
+ "name": "angular"
157
+ }
158
+ }
159
+ }
160
+ },
161
+ "prettier": {
162
+ "quoteProps": "consistent",
163
+ "singleQuote": true,
164
+ "tabWidth": 2,
165
+ "trailingComma": "es5",
166
+ "useTabs": false
167
+ },
168
+ "create-react-native-library": {
169
+ "type": "turbo-module",
170
+ "languages": "kotlin-objc",
171
+ "tools": [
172
+ "jest",
173
+ "lefthook",
174
+ "release-it",
175
+ "eslint"
176
+ ],
177
+ "version": "0.56.0"
178
+ }
179
+ }
@@ -0,0 +1,13 @@
1
+ import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
+
3
+ export interface RdServiceResponse {
4
+ status: string;
5
+ message: string;
6
+ }
7
+
8
+ export interface Spec extends TurboModule {
9
+ getFingerPrint(deviceName: string, pidOption: string): Promise<RdServiceResponse>;
10
+ getFaceCapture(deviceName: string, pidOption: string): Promise<RdServiceResponse>;
11
+ }
12
+
13
+ export default TurboModuleRegistry.getEnforcing<Spec>('Rdservice');
package/src/index.tsx ADDED
@@ -0,0 +1,17 @@
1
+ import Rdservice, { type RdServiceResponse } from './NativeRdservice';
2
+
3
+ export type { RdServiceResponse };
4
+
5
+ export function getFingerPrint(
6
+ deviceName: string,
7
+ pidOption: string
8
+ ): Promise<RdServiceResponse> {
9
+ return Rdservice.getFingerPrint(deviceName, pidOption);
10
+ }
11
+
12
+ export function getFaceCapture(
13
+ deviceName: string,
14
+ pidOption: string
15
+ ): Promise<RdServiceResponse> {
16
+ return Rdservice.getFaceCapture(deviceName, pidOption);
17
+ }