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
2
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.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
157
increased by115.07%
Maintainers
2
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/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']
      ...
    }
    ...
}

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'
+   }

    ...

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
    );
  }}

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.

CodeDescriptionRetry possible (same session)
1000No error occurred. The user cancelled the sessionYes
2000Unauthorised request (wrong or expired session token)Yes
2001Session not foundYes
2002Session expiredYes
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 permission to the cameraYes
5000The user's camera was not found and file upload is not allowedNo
5002No more local tries for the liveness flowYes
5003SDK is out-of-date, please update the SDK to the latest versionNo
5004An unexpected internal error occurredNo
5005An unexpected document capture error occurredNo
5006An unexpected liveness capture error occurredNo

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 an 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 sdksupport@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 02 Jul 2020

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