1.2.0 • Published 4 months ago

react-native-rdservice-fingerprintscanner v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

react-native-rdservice-fingerprintscanner

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.

As per UIDAI (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.

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.

For reference, you may check out the (Aadhaar Registered Devices by UIDAI).

Installation

npm install react-native-rdservice-fingerprintscanner

Add jitpack in your root build.gradle file at the end of repositories: android/build.gradle

allprojects {
  repositories {
    // ...
    maven { url 'https://jitpack.io' }
  }
}

Usage

import {
  getDeviceInfo,
  captureFinger,
  isDriverFound,
  openFingerPrintScanner,
  AVAILABLE_PACKAGES,
  DEFAULT_PID_OPTIONS,
} from 'react-native-rdservice-fingerprintscanner';

// ...

getDeviceInfo()
  .then((response) => {
    console.log(response, 'DEVICE DRIVER FOUND'); // Response about Device Driver
  })
  .catch((error) => {
    console.log(error, 'DEVICE DRIVER NOT FOUND'); //Failed to get device information
  });

captureFinger(pidOptions) //you can pass pidOptions (optional) to "captureFinger(pidOptions)"" method otherwise it takes DEFAULT_PID_OPTIONS
  .then((response) => {
    console.log(response, 'FINGER CAPTURE'); // FingerPrint Response
  })
  .catch((e) => {
    console.log(e, 'ERROR_FINGER_CAPTURE'); // Failed to capture the Fingerprint
  });

isDriverFound(PACKAGE_NAME) // you can use AVAILABLE_PACKAGES for PACKAGE_NAME
  .then((res) => {
    console.log(res, 'DRIVER CHECK');
  })
  .catch((error) => {
    console.log(error, 'ERROR_DRIVER CHECK');
  });

openFingerPrintScanner(PACKAGE_NAME, pidOptions) //you can pass pidOptions (optional) to "openFingerPrintScanner(pidOptions)"" method otherwise it takes DEFAULT_PID_OPTIONS
  .then((res) => {
    console.log(res, 'FINGER CAPTURE');
  })
  .catch((e) => {
    console.log(e, 'ERROR_FINGER_CAPTURE');
  });

pidOptions is an XML String that you have to pass to captureFinger and openFingerPrintScanner methods. Refer UIDAI Document

DEFAULT_PID_OPTIONS is used when you not passed the pidOptions to the captureFinger() Method.

PACKAGE_NAME is required to check the rd service. (eg) The Package name of StarTek Device is com.acpl.registersdk

You can use AVAILABLE_PACKAGES for PACKAGE_NAME.

Note : Call captureFinger() Method after getting response from getDeviceInfo() method. Calling of captureFinger() method before getDeviceInfo() method, only returns Error in catch block. Refer Example Code. Call openFingerPrintScanner() method once the isDriverFound() method returns true value, if the driver is not found then the openFingerPrintScanner() method returns driver not found error. These added two methods (isDriverFound() and openFingerPrintScanner()) are used to find the selected RD Service which is passed as an argument (device driver package name) to these methods.

Response JSON Object

getDeviceInfo() Method Reponse

KeyValueDescription
status-1 or 1 or 0-1 - Device Driver not Found, 1 - READY, 0 - NOTREADY
isWhitelistedtrue or falseiT is about the Device is Approved or not. true - Approved, false - Not Approved
rdServiceInfoJsonJSON DATAThe device returns XML DATA of Device Information. this parameter contains converted JSON DATA of XML DATA
rdServiceInfoXMLXML DATADevice Information
rdServicePackageDevice Package
messageMessage about Success or Failure

captureFinger() and openFingerPrintScanner() Methods Reponse

KeyValueDescription
status1 or 01 - Fingerprint Captured Successfully, 0 - FingerPrint not Captured (Check Connection of Device and OTG Connection Settings in Mobile)
errorCodeERROR CODE from RD ServiceRefer UIDAI Document and RDService Error Details
errInfoError Message according to the ERROR CODERefer UIDAI Document and RDService Error Details
pidDataJsonJSON DATAThe device returns PID DATA of Captured Fingerprint. this parameter contains converted JSON pidData of XML pidData
pidDataXMLXML DATApidData Captured Fingerprint
rdServicePackageDevice Package
messageMessage about Success or Failure

isDriverFound() Method Response

KeyValueDescription
isDeviceDriverFoundtrue or falsetrue - Driver Found, false - Driver not found
messageMessage about the driver found or not

Tested Devices

Device NameResult
Startek FM220:white_check_mark:
MORPHO:white_check_mark:
MANTRA:white_check_mark:
Tatvik TMF20:white_check_mark:
PB510:white_check_mark:

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Would you like to support me?

1.2.0

4 months ago

1.1.12

12 months ago

1.1.11

12 months ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.10

1 year ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago