Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@getyoti/react-native-yoti-doc-scan

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getyoti/react-native-yoti-doc-scan

Yoti Doc Scan for React Native

  • 1.13.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
157
increased by115.07%
Maintainers
3
Weekly downloads
 
Created
Source

YotiBanner

Yoti Doc Scan SDK for React Native

GitHub tag (latest SemVer) Publish Release

Yoti is an identity checking platform that allows organisations to verify who people are, online and in person. The Yoti Doc Scan SDK allows the user to take a photo of their identifying document which we verify instantly and prepare a response which your system can then retrieve. Further information can be found in the documentation.

Prerequisites

A supporting Yoti Doc Scan SDK backend installation is required. Learn more about the backend SDK in the Getting Started guide.

React Native >= 0.60.0 installation

yarn add @getyoti/react-native-yoti-doc-scan

Navigate to your iOS folder and update pods with:

pod install

React Native autolinking will handle the rest of the native configuration. Should autolinking fail, consult the troubleshooting instructions.

React Native 0.59.x installation

Install the library with:

yarn add @getyoti/react-native-yoti-doc-scan

Link the library:

react-native link @getyoti/react-native-yoti-doc-scan

If you're using CocoaPods, navigate to your ios and update your Podfile:

  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
+ `pod 'react-native-yoti-doc-scan', :path => '../node_modules/@getyoti/react-native-yoti-doc-scan/react-native-yoti-doc-scan.podspec'`
end

And then your pods with:

pod install

If autolinking fails, refer to the troubleshooting instructions.

Android configuration

Add microblink to your repositories in the root build.gradle file (android/build.gradle):

allprojects {
    repositories {
        mavenCentral()
        maven { url 'https://maven.microblink.com' }
        maven { url "https://jitpack.io" }
        ...
    }
    ...
}

Debug build configuration

Add this configuration for the debug build type to your buildTypes block (android/app/build.gradle):

buildTypes {
    debug {
        matchingFallbacks = ['release']
      ...
    }
    ...
}

If you're using Firebase Performance Monitoring you'll need to disable it for debug built variant. One way to do this is including this flag in your gradle.properties file:

firebasePerformanceInstrumentationEnabled=false

And update your release build command line to enable it:

./gradlew assembleRelease -PfirebasePerformanceInstrumentationEnabled=true

Release build configuration

If you're using Proguard or other obfuscation tool, add the following configuration rules to your proguard-rules.pro file:

-keep class com.yoti.** { *; }
-keep class com.microblink.** { *; }
-keep class com.microblink.**$* { *; }
-dontwarn com.microblink.**
-keep class com.facetec.zoom.** { *; }
-dontwarn javax.annotation.Nullable

Depending on your Android project setup and version of React Native, you may encounter the following error during your build process:

More than one files produce libc++_shared.so

Resolve by adding the following packaging options to your android block (android/app/build.gradle):

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    
    packagingOptions {
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libjsc.so'
        pickFirst 'lib/arm64-v8a/libjsc.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
    }
    ...

Running out of memory space: java.lang.OutOfMemoryError: Java heap space

Resolve by increasing the daemon memory settings in your gradle.properties file:

org.gradle.jvmargs=-Xmx4608m

Usage

The SDK exposes a single method, startSession(), which handles communication between your app and the Yoti app on a user's device.

Import the SDK with:

import YotiDocScan from '@getyoti/react-native-yoti-doc-scan';

Call the startSession method with your session ID and client session token. The method accepts two callbacks: one invoked on success, and the other when the result is a failure.

function onSuccess (code, description) {
    // handle success scenario
}
function onError (code, description) {
    // handle error scenario
}
YotiDocScan.startSession(
    sessionId,
    clientSessionToken,
    onSuccess,
    onError
);

In addition, you can choose to also specify an Android request code, or set the primary color of the iOS SDK using an RGB value. E.g.:

YotiDocScan.setRequestCode(8888); // default: 9001
YotiDocScan.setPrimaryColorRGB(0, 0, 0); // default: (34, 157, 255)

To customize the colors of the Android SDK, please refer to its documentation here.

Your callbacks will receive a consistent response with two parameters: code (number) and description (string). The code is always populated with one of the values in the results table below. The description is not guaranteed to always have a value and as such your business logic should not rely on it.

CodeMessageRetry possible for the same session
0Result with successNo
1000No error occurred - the end-user cancelled the session for an unknown reasonYes
2000Unauthorised request (wrong or expired session token)Yes
2001Session not foundYes
2003SDK launched without session TokenYes
2004SDK launched without session IDYes
3000Yoti's services are down or unable to process the requestYes
3001An error occurred during a network requestYes
3002User has no networkYes
4000The user did not grant permissions to the cameraYes
5000No camera (when user's camera was not found and file upload is not allowed)No
5002No more local tries for the liveness flowYes
5003SDK is out-of-date - please update the SDK to the latest versionNo
5004Unexpected internal errorNo
5005Unexpected document scanning errorNo
5006Unexpected liveness errorNo
6000Document Capture dependency not found errorNo
6001Liveness Zoom dependency not found errorNo
6002Supplementary document dependency not found errorNo

Troubleshooting

Resolving autolinking failures on Android and iOS

iOS

Linker errors pertaining to Swift libraries such as swiftFoundation can be resolved with one or more of the solutions mentioned in this oft-quoted StackOverflow discussion, depending on your React Native version and project setup.

Android

Android linking is performed in 3 steps:

android/settings.gradle

Add the following to your settings.gradle file as a new entry before the last line which has include ':app':

    include ':react-native-yoti-doc-scan'
    project(':react-native-yoti-doc-scan').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-yoti-doc-scan/src/android')

    include ':app'
android/app/build.gradle

Find the dependencies block in your build.gradle file and add implementation project(':react-native-yoti-doc-scan'):

dependencies {
    ...
    implementation project(':react-native-yoti-doc-scan')
}
android/app/src/main/java/..../MainApplication.java

Add this import for the package:

import android.app.Application;
import com.facebook.react.ReactApplication;
+ import com.yoti.reactnative.RNYotiDocScanPackage;

Find the getPackages function and add new RNYotiDocScanPackage() to the list of packages.

@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
+       new RNYotiDocScanPackage(),
        ...

Support

If you have any other questions please do not hesitate to contact clientsupport@yoti.com. Once we have answered your question we may contact you again to discuss Yoti products and services. If you'd prefer us not to do this, please let us know when you e-mail.

Licence

Please find the licence for the SDK here.

FAQs

Package last updated on 30 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc