0.1.0 • Published 11 months ago

react-native-accurascan-liveness-fm v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

React Native Accura Scan KYC

Accura Scan OCR is used for Optical character recognition.

Accura Scan Face Match is used for Matching 2 Faces, Source face and Target face. It matches the User Image from a Selfie vs User Image in document.

Accura Scan Authentication is used for your customer verification and authentication. Unlock the True Identity of Your Users with 3D Selfie Technology

Below steps to setup Accura Scan's SDK to your project.

Note:-

yarn add 'react-native-accurascan-liveness-fm'

OR

npm i react-native-accurascan-liveness-fm

Usage Import npm library into file. import AccurascanLivenessFm from 'react-native-accurascan-liveness-fm';

1.Setup Android

Add it in your root build.gradle at the end of repositories.

allprojects {
   repositories {
       google()
       jcenter()
       maven {
           url 'https://jitpack.io'
           credentials { username 'jp_ssguccab6c5ge2l4jitaj92ek2' }
       }
    }
}

Add it in your app/build.gradle file.

packagingOptions {
   pickFirst 'lib/arm64-v8a/libcrypto.so'
   pickFirst 'lib/arm64-v8a/libssl.so'

   pickFirst 'lib/armeabi-v7a/libcrypto.so'
   pickFirst 'lib/armeabi-v7a/libssl.so'

   pickFirst 'lib/x86/libcrypto.so'
   pickFirst 'lib/x86/libssl.so'

   pickFirst 'lib/x86_64/libcrypto.so'
   pickFirst 'lib/x86_64/libssl.so'

}
splits {
  abi {
    enable true
    reset()
    include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
    universalApk true
  }
}

2.Setup iOS

1.Install Git LFS using command install git-lfs

2.Add the following in your podfile use_frameworks! below prepare_react_native_project!

3.Run pod install

Add this permissions into iOS Info.plist file.

<key>NSCameraUsageDescription</key>
<string>App usage camera for scan documents.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App usage photos for get document picture.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>App usage photos for save document picture.</string>

3.Setup Accura Scan licenses into your projects

Accura Scan has one license for Facematch. Generate your own Accura license from here using your bundle id.

accuraface.license

This license is use for get face match percentages between two face pictures.

For Android

Create "assets" folder under app/src/main and Add license file in to assets folder.
- accuraface.license // for Accura Scan Face Match
Generate your Accura Scan license from https://accurascan.com/developer/dashboard

For iOS

Place the license in your project's Runner directory, and add the licenses to the target.

4.Method for liveness check.

onPressStartLiveness = () => {
 var accuraConfs = {
   face_uri: this.facematchURI,
 };

 var lconfig = {
   backGroundColor: '#FFC4C4C5',
   closeIconColor: '#FF000000',
   feedbackBackGroundColor: '#FFC4C4C5',
   feedbackTextColor: '#FF000000',
   setFeedbackTextSize: 18,
   setFeedBackframeMessage: 'Frame Your Face',
   setFeedBackAwayMessage: 'Move Phone Away',
   setFeedBackOpenEyesMessage: 'Keep Your Eyes Open',
   setFeedBackCloserMessage: 'Move Phone Closer',
   setFeedBackCenterMessage: 'Move Phone Center',
   setFeedbackMultipleFaceMessage: 'Multiple Face Detected',
   setFeedBackFaceSteadymessage: 'Keep Your Head Straight',
   setFeedBackBlurFaceMessage: 'Blur Detected Over Face',
   setFeedBackGlareFaceMessage: 'Glare Detected',
   setBlurPercentage: 80,
   setGlarePercentage_0: -1,
   setGlarePercentage_1: -1,
   setLivenessURL: 'Your URL',
   setFeedBackLowLightMessage: 'Low light detected',
   feedbackLowLightTolerence: 39,
   feedbackDialogMessage: 'Loading...',
   feedBackProcessingMessage: 'Processing...',
   isShowLogo: 1,
 };

 let passArgs = [accuraConfs, lconfig];

 AccurascanKyc.startLiveness(passArgs, (error, response) => {
   if (error != null) {
     console.log('Failure!', error);
     this.showAlert('Failure!', error);
   } else {
     console.log('Success!', response);
   }
 });
};

Success: JSON Response { detect: URI?, Face_score: Float, score: Float, }

Error: String

5.Method for Only Facematch.(The following are Optional methods, Use if you need only FaceMatch)

To Open Gallery 1 and 2:-

For gallery 1

openGallery = () => {
 var accuraConfs = {
   face1: this.state.FirstFMImageURI,
   face2: this.state.SecondFMImageURI,
 };

 AccurascanKyc.openGallery1([accuraConfs], (error, response) => {
   if (error != null) {
     console.log('Failure!', error);
   } else {
     console.log('Success!', response);
   }
 });
};

For gallery 2

  openGallery2 = () => {
    var accuraConfs = {
      face1: this.state.FirstFMImageURI,
      face2: this.state.SecondFMImageURI,
    };

    AccurascanKyc.openGallery2([accuraConfs], (error, response) => {
      if (error != null) {
        console.log('Failure!', error);
      } else {
        console.log('Success!', response);
      }
    });
  };

To Open Camera for Facematch 1 and 2:

For Facematch 1:

 onPressFaceMatch1 = () => {
    var accuraConfs = {
      face1: this.state.FirstFMImageURI,
      face2: this.state.SecondFMImageURI,
    };
    var fconfig = {
      backGroundColor: '#FFC4C4C5',
      closeIconColor: '#FF000000',
      feedbackBackGroundColor: '#FFC4C4C5',
      feedbackTextColor: '#FF000000',
      setFeedbackTextSize: 18,
      setFeedBackframeMessage: 'Frame Your Face',
      setFeedBackAwayMessage: 'Move Phone Away',
      setFeedBackOpenEyesMessage: 'Keep Your Eyes Open',
      setFeedBackCloserMessage: 'Move Phone Closer',
      setFeedBackCenterMessage: 'Move Phone Center',
      setFeedbackMultipleFaceMessage: 'Multiple Face Detected',
      setFeedBackFaceSteadymessage: 'Keep Your Head Straight',
      setFeedBackLowLightMessage: 'Low light detected',
      setFeedBackBlurFaceMessage: 'Blur Detected Over Face',
      setFeedBackGlareFaceMessage: 'Glare Detected',
      setBlurPercentage: 80,
      setGlarePercentage_0: -1,
      setGlarePercentage_1: -1,
      feedbackDialogMessage: 'Loading...',
      feedBackProcessingMessage: 'Processing...',
      isShowLogo: 1,
    };
    let passArgs = [accuraConfs, fconfig];

    AccurascanKyc.startFaceMatch1(passArgs, (error, response) => {
      if (error != null) {
        console.log('Failure!', error);
      } else {
        console.log('Success!', response);
      }
    });
  };

For Facematch 2

  onPressFaceMatch2 = () => {
    var accuraConfs = {
      face1: this.state.FirstFMImageURI,
      face2: this.state.SecondFMImageURI,
    };
    var fconfig = {
      backGroundColor: '#FFC4C4C5',
      closeIconColor: '#FF000000',
      feedbackBackGroundColor: '#FFC4C4C5',
      feedbackTextColor: '#FF000000',
      setFeedbackTextSize: 18,
      setFeedBackframeMessage: 'Frame Your Face',
      setFeedBackAwayMessage: 'Move Phone Away',
      setFeedBackOpenEyesMessage: 'Keep Your Eyes Open',
      setFeedBackCloserMessage: 'Move Phone Closer',
      setFeedBackCenterMessage: 'Move Phone Center',
      setFeedbackMultipleFaceMessage: 'Multiple Face Detected',
      setFeedBackFaceSteadymessage: 'Keep Your Head Straight',
      setFeedBackLowLightMessage: 'Low light detected',
      setFeedBackBlurFaceMessage: 'Blur Detected Over Face',
      setFeedBackGlareFaceMessage: 'Glare Detected',
      setBlurPercentage: 80,
      setGlarePercentage_0: -1,
      setGlarePercentage_1: -1,
      feedbackDialogMessage: 'Loading...',
      feedBackProcessingMessage: 'Processing...',
      isShowLogo: 1,
    };
    let passArgs = [accuraConfs, fconfig];

    AccurascanKyc.startFaceMatch2(passArgs, (error, response) => {
      if (error != null) {
        console.log('Failure!', error);
      } else {
        console.log('Success!', response);
      }
    });
  };

accuraConfs: JSON Object Face1: 'uri of face1' Face2: ’uri of face2’

Success: JSON Response { Image: URI?, score: String, }

Error: String

6.Method for get face match percentages between two face.

onPressFaceMatch = () => {
 var accuraConfs = {
   face_uri: this.facematchURI,
 };
 var fconfig = {
   backGroundColor: '#FFC4C4C5',
   closeIconColor: '#FF000000',
   feedbackBackGroundColor: '#FFC4C4C5',
   feedbackTextColor: '#FF000000',
   setFeedbackTextSize: 18,
   setFeedBackframeMessage: 'Frame Your Face',
   setFeedBackAwayMessage: 'Move Phone Away',
   setFeedBackOpenEyesMessage: 'Keep Your Eyes Open',
   setFeedBackCloserMessage: 'Move Phone Closer',
   setFeedBackCenterMessage: 'Move Phone Center',
   setFeedbackMultipleFaceMessage: 'Multiple Face Detected',
   setFeedBackFaceSteadymessage: 'Keep Your Head Straight',
   setFeedBackLowLightMessage: 'Low light detected',
   setFeedBackBlurFaceMessage: 'Blur Detected Over Face',
   setFeedBackGlareFaceMessage: 'Glare Detected',
   setBlurPercentage: 80,
   setGlarePercentage_0: -1,
   setGlarePercentage_1: -1,
   feedbackDialogMessage: 'Loading...',
   feedBackProcessingMessage: 'Processing...',
   isShowLogo: 1,
 };
 let passArgs = [accuraConfs, fconfig];

 AccurascanKyc.startFaceMatch(passArgs, (error, response) => {
   if (error != null) {
     console.log('Failur!', error);
   } else {
     console.log('Success!', response);
   }
 });
};

Success: JSON Response { detect: URI? score: Float }

Error: String

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

License: MIT

0.1.0

11 months ago