• About TrustVision
  • Android SDK
  • iOS SDK
  • Flutter SDK
  • React Native SDK
  • Web SDK
  • API Client Libraries
  • Integration Case Studies
  • TS eKYC/FA App
TrustVision API Documentation

React Native 4.0.x

1 Installation

1.1. Add Trust Vision React Native lib

Add to package.json file under dependencies group:

"react-native-trust-vision-SDK": "git+https://<github_token>:[email protected]/tsocial/<repo_name>#<version_tag_name>"

1.2. Run

$ yarn

1.3 iOS

1.3.1. Add to podfile

...
pod 'RNTrustVisionRnsdkFramework', path: '../node_modules/react-native-trust-vision-SDK'

...

# Add below lines to the end of podfile
post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
        end

        // you can add more modules which have the error "Undefined symbol" into the list
         if ['CocoaLumberjack', 'TensorFlowLiteC', 'TensorFlowLiteSwift', 'PromiseKit', 'OpenSSL-Universal', 'CryptoSwift'].include? "#{target}"
            target.build_configurations.each do |config|
                config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
            end
        end
    end
end

1.3.2. Run

$ pod install

1.4 Android

Add to root-level build.gradle file (host app):

maven {
     url("$rootDir/../node_modules/react-native-trust-vision-SDK/android/repo")
}

eg:

allprojects {
    repositories {
        mavenLocal()
        ...
        maven {
             url("$rootDir/../node_modules/react-native-trust-vision-SDK/android/repo")
        }
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

Add to app/build.gradle

android {
    ...
    aaptOptions {
        noCompress "tflite"
        noCompress "lite"
    }
}

1.5 Usage

javascript
import { NativeEventEmitter } from "react-native";

import RNTrustVisionRnsdkFramework, {
  TVConst,
  TVErrorCode,
  TVThemeCustomization,
} from "react-native-trust-vision-SDK";

2. Start the SDK

The SDK provides some built in Activities example activity to eKYC journey.

2.1. eKYC Platform

2.1.1. eKYC Platform Configuration

javascript
const config = {
  baseUrl: "your_value",
  token: "your_value",
  enableSound: true,
  language: "en",
  flowId: "your_value",
  cardTypes: "your_value",
  singleStep: "your_value",
};

Where:

  • token: String This is the authentication token required to call the eKYC platform API within the SDK. Obtain this token from TrustingSocial eKYC Platform.
  • baseUrl: String The base URL for the eKYC platform API. This is also provided by TrustingSocial eKYC Platform.
  • language: String?, that specifies the language for SDK display. Set this to your preferred language code (e.g., "en" for English, "vi" for Vietnamese)
  • isEnableSound: bool that enables or disables guiding sound during the eKYC process. Set to true to enable sound or false to disable it
  • flowId : String?, that identifies the specific eKYC flow you want to execute. Choose from the following options:
- ID → Selfie: flowId=id_selfie
- Selfie → ID: flowId=selfie_id
- ID → NFC → Selfie: flowId=id_nfc_selfie
- QR → NFC → Selfie: flowId=qr_nfc_selfie
  • singleStep : String?, Optional Single Step mode:
ValueDescription
"ekyc.id_card"Only ID Card capture
"ekyc.selfie"Only Selfie capture
  • cardType: TVCardType? object that specifies the type of card being used in the eKYC process. The card type is defined as follows:
javascript
const cardType = {
  id: "vn.national_id",
  name: "CMND cũ / CMND mới / CCCD",
  orientation: TVConst.Orientation.HORIZONTAL,
  hasBackSide: true,
  frontQr: {
    exist: true,
    type: "qr_code",
    widthHeightRatio: 1,
  },
};

2.1.2. Start eKYC Platform

javascript
const startEKYCPlatformNative = async () => {
  try {
    const cardType = {
      id: "vn.national_id",
      name: "CMND cũ / CMND mới / CCCD",
      orientation: TVConst.Orientation.HORIZONTAL,
      hasBackSide: true,
      frontQr: {
        exist: true,
        type: "qr_code",
        widthHeightRatio: 1,
      },
    };

    const config = {
      baseUrl: inputEndpoint,
      token: inputToken,
      enableSound: false,
      language: "vi",
      flowId: "",
      cardTypes: [cardType],
    };

    const result = await RNTrustVisionRnsdkFramework.startEKYCPlatform(config);
    // Handle successfull
  } catch (e) {
    // Handle error
  }
};

2.2. eKYC Platform in webview mode

javascript
const startEKYCPlatformWebview = async () => {
  try {
    const result = await RNTrustVisionRnsdkFramework.startEKYCPlatformWebview(
      "your_url"
    );
    // Handle successfull
  } catch (e) {
    // Handle error
  }
};