@digiotech/react-native

中文文档
2.0.20发布于 2026/11/10MITTypeScriptESM + CJS零依赖近 30 天下载 6231

Digio React Native SDK for invoking client-side journeys such as KYC, Selfie, Mandate, RPD, and other Digio workflows.

原始使用文档
文档目录15 节
  1. Installation
  2. Documentation
  3. Basic Usage
  4. Consuming gateway events [Optional]
  5. Complete Usage
  6. Android
  7. SDK Reference
  8. DigioConfig
  9. DigioResponse [Response received from Gateway]
  10. Android Permissions
  11. You get a build error due to a theme issue.
  12. You get a build error due to a duplicate class android.supp…
  13. IOS Permission
  14. Add LSApplicationQueriesSchemes in your iOS app's Info.plis…
  15. Proguard:

Digio React Native SDK

npm version Release Notes

Official React Native SDK for Digio Gateway Integration

Installation

yarn install @digiotech/react-native

Documentation

Documentation of Digio Gateway Integration and their usage

Basic Usage

Instantiate the Digio instance with environment & other options

import { Digio, DigioConfig, DigioResponse, ServiceMode } from '@digiotech/react-native';

const config: DigioConfig = { environment: Environment.PRODUCTION, serviceMode: ServiceMode.OTP, isGlobal: false  };
const digio = new Digio(config);
const documentId = "<document_id>";
const identifier = "<email_or_phone>";
const digioResponse: DigioResponse = await digio.start(documentId, identifier);

Consuming gateway events [Optional]

You can consume events and understand the flow or the journey of the user as he is performing it.

For a complete list of events and the payload associated with it, refer here

import { useEffect } from 'react';
import { Digio, DigioConfig, GatewayEvent, ServiceMode } from '@digiotech/react-native';

function YourComponent() {
  useEffect(() => {
    const gatewayEventListener = digio.addGatewayEventListener(
      (event: GatewayEvent) => {
        // Do some operation on the received events
      }
    );

    return () => {
      gatewayEventListener.remove();
    }
  }, []);
}

Complete Usage

import { useEffect } from 'react';
import { Digio, DigioConfig, GatewayEvent, ServiceMode } from '@digiotech/react-native';

function YourComponent() {
  useEffect(() => {
    const gatewayEventListener = digio.addGatewayEventListener(
      (event: GatewayEvent) => {
        // Do some operation on the received events
      }
    );

    return () => {
      gatewayEventListener.remove();
    }
  }, []);

  const triggerDigioGateway = async () => {
    const config: DigioConfig = { environment: Environment.PRODUCTION, serviceMode: ServiceMode.OTP, isGlobal: false };
    const digio = new Digio(config);
    const documentId = "<document_id>";
    const identifier = "<email_or_phone>";
    const tokenId = "<gateway_token_id";
    const digioResponse: DigioResponse = await digio.start(documentId, identifier, tokenId);

  }
}

Android

  • Digio SDK supports android version 8 (SDK level 26) and above
  • Add below in your project under build.gradle (module:app)file inside dependencies
// Required for esign/mandate sign
implementation 'com.github.digio-tech:protean-esign:v3.12'
// under android {} of build.gradle(module:app)
 buildFeatures {
    viewBinding true
    dataBinding true
  }

// Make sure your project using
    compileSdkVersion = 35
    targetSdkVersion = 35

SDK Reference

DigioConfig

Parameters:

NameTypeDescription
environment*stringEnvironment for which you want to open gateway. One of sandbox or production
logostringPass an URL of your brand logo. Note: Pass an optimised image url for best results
themestringOptions for changing the appearance of the gateway. See below for options under it.
serviceMode*stringServiceMode can be OTP/FACE/IRIS/FP <Default it's OTP> you can set based on your requirment

Theme:

NameTypeDescription
primaryColorstringYour brand colour's HEX code to alter CTA (call-to-action) button colors
secondaryColorstringHEX Code to alter text colors
fontFamilystringFont Family of your choice. For eg: Crimson Pro
fontFormatstringFormat of the Font Family Provided. For eg: ’woff2’,’ot’,’tt’
fontUrlstringFont Family URL. For eg: '{font_family_url}.woff2'

DigioResponse [Response received from Gateway]

NameTypeDescription
code*numberSUCCESS = 1001
FAIL = 1002
CANCEL = -1000
WEBVIEW_CRASH = 1003
WEBVIEW_ERROR = 10017
SDK_CRASH = 1004
Location/Camera/MicroPhone Permission Denied By User = 1008
documentIdstringDocument ID Passed from the parent app. For eg: KID22040413040490937VNTC6LAP8KWD
messagestringError message in case of crash or failure
permissionsArrayList of mandatory permissions which are not given during kyc journey

Android Permissions

Add required permissions in the manifest file. Note - This is the common SDK for various KYC flows

<!--RECORD_AUDIO and MODIFY_AUDIO_SETTINGS Permission required for Video KYC -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
/** Required for geotagging */
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

/** Required for ID card analysis, selfie and face match**/
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus"   android:required="false" />

<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />


A fintech Android app can't access the following permission

  • Read_external_storage
  • Read_media_images
  • Read_contacts
  • Access_fine_location
  • Read_phone_numbers
  • Read_media_videos

You get a build error due to a theme issue.

  • Please add tools:replace="android:theme" under your android manifest.
 <application
      ....
      tools:replace="android:theme"
      ...
      >
      .....
    </application>

You get a build error due to a duplicate class android.support.v4

  • Check your gradle.properties below should be added.
android.enableJetifier=true
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64

IOS Permission

  • Digio SDK supports iOS 15.6 and above Permissions need to add in your info.plist
  /**  Camera permission incase of selfie/video KYC/ capture document  **/
  <key>NSCameraUsageDescription</key>
  <string>$(PRODUCT_NAME) would like to access your camera.</string>
  <key>NSPhotoLibraryUsageDescription</key>
  <string>$(PRODUCT_NAME) would like to access your photo.</string>
  /**  Microphone permission incase of video KYC  **/
  <key>NSMicrophoneUsageDescription</key>
  <string>$(PRODUCT_NAME) would like to access your microphone to capture video.</string>
  /** Location permission for geo tagging for camera/video kyc/ selfie **/
  <key>NSLocationWhenInUseUsageDescription</key>
  <string>$(PRODUCT_NAME) would like to access your location.</string>
  <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
  <string>$(PRODUCT_NAME) would like to access your location.</string>

Note : All permissions should be checked and taken before triggering Digio SDK

Add LSApplicationQueriesSchemes in your iOS app's Info.plist file

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>phonepe</string>
        <string>gpay</string>
        <string>paytmmp</string>
        <string>bhim</string>
        <string>upi</string>
        <string>ppe</string>
    </array>

Proguard:

It is required to test the release build for possible proguard exceptions before prod releases.

-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}
-keepattributes JavascriptInterface
-keepattributes *Annotation*
-keepattributes Signature
-optimizations !method/inlining/*
-keeppackagenames
-keepnames class androidx.navigation.fragment.NavHostFragment
-keep class * extends androidx.fragment.app.Fragment{}
-keepnames class * extends android.os.Parcelable
-keepnames class * extends java.io.Serializable
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-dontwarn androidx.databinding.**
-keep class androidx.databinding.** { *; }
-keepclassmembers class * extends androidx.databinding.** { *; }
-dontwarn org.json.**
-keep class org.json** { *; }
-keep public class org.simpleframework.**{ *; }
-keep class org.simpleframework.xml.**{ *; }
-keep class org.simpleframework.xml.core.**{ *; }
-keep class org.simpleframework.xml.util.**{ *; }
-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.** { *; }
-keep class com.google.android.material.** { *; }
-dontwarn org.simpleframework.**
-keepattributes ElementList, Root
-keepclassmembers class * {
    @org.simpleframework.xml.* *;
}
-keep class org.spongycastle.** { *; }
-keep class com.ecs.rdlibrary.request.** { *; }
-keep class com.ecs.rdlibrary.response.** { *; }
-keep class com.ecs.rdlibrary.utils.** { *; }
-keep class com.ecs.rdlibrary.ECSBioCaptureActivity { *; }
-keep class org.simpleframework.xml.** { *; }
-keepattributes Exceptions, InnerClasses
-keep class com.google.android.gms.location.LocationSettingsRequest$Builder { *; }
-keepnames class ** { *; }
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
-keepattributes AnnotationDefault
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}
-dontwarn javax.annotation.**
-dontwarn kotlin.Unit
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface * extends <1>
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
-keep,allowobfuscation,allowshrinking class retrofit2.Response
-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz
-dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.**
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**
-keep class * extends androidx.databinding.DataBinderMapper
-dontwarn kotlin.jvm.internal.SourceDebugExtension

-dontwarn org.xmlpull.v1.**
-keep class org.xmlpull.v1.** { *; }
-keep class in.digio.sdk.gateway.interfaces.FeatureRegistrationInterface$DefaultImpls { *; }

-keep class javax.xml.bind.annotation.** { *; }
-dontwarn javax.xml.bind.annotation.**
-keep class com.ecs.cdslxsds.ESignProcessorResponse { *; }

-dontwarn org.xmlpull.v1.XmlPullParser
-dontwarn android.content.res.XmlResourceParser

-keep class in.digio.sdk.gateway.interfaces.FeatureRegistrationInterface$DefaultImpls { *; }
-dontwarn java.lang.invoke.StringConcatFactory
-keep public class com.digio.two_way_sdk.** {
    public *;
}
-keep class com.digio.two_way_sdk.** { *; }
-keep class androidx.databinding.** { *; }
-keep class androidx.viewbinding.** { *; }
-keep public class * extends androidx.**
-keep public class com.google.android.material.** { *; }
-keep public class androidx.** { public *; }


#emudhra
-keep class com.emudhra.** { *; }
-keep interface com.emudhra.** { *; }
-keepclassmembers class com.emudhra.** {
    native <methods>;
}
-dontwarn com.emudhra.**

# Jackson dataformat XML (used by emudhra at runtime via XmlMapper)
-keep class com.fasterxml.jackson.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-dontwarn com.fasterxml.jackson.**

# Woodstox - StAX implementation backing jackson-dataformat-xml.
# FactoryFinder uses Class.forName via META-INF/services lookup; the impl
# classes must not be obfuscated or shrunk away.
-keep class com.ctc.wstx.** { *; }
-keep class org.codehaus.stax2.** { *; }
-dontwarn com.ctc.wstx.**
-dontwarn org.codehaus.stax2.**

# StAX API surfaces referenced via reflection
-keep class javax.xml.stream.** { *; }
-dontwarn javax.xml.stream.**
-keep class * implements javax.xml.stream.XMLInputFactory
-keep class * implements javax.xml.stream.XMLOutputFactory
-keep class * implements javax.xml.stream.XMLEventFactory

-keepattributes Signature, *Annotation*, EnclosingMethod, InnerClasses

版本与发布记录

@digiotech/react-native 共发布 50 个版本,首次发布于 2023/10/27;过去 12 个月发布了 23 个版本。

版本发布日期距今
2.0.20latest2026/11/101 天前
2.0.192026/11/056 天前
2.0.182026/10/1230 天前
2.0.172026/10/1230 天前
2.0.162026/10/1230 天前
2.0.152026/06/194 个月前

其他发布通道:beta → 2.0.11-beta.5。

关于 @digiotech/react-native 的常见问题

@digiotech/react-native 是什么?

Digio React Native SDK for invoking client-side journeys such as KYC, Selfie, Mandate, RPD, and other Digio workflows.

如何安装 @digiotech/react-native?

在项目目录运行 npm install @digiotech/react-native,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@digiotech/react-native 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@digiotech/react-native 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@digiotech/react-native 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@digiotech/react-native 可以商用吗?

@digiotech/react-native 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@digiotech/react-native 的下载量有多少?

根据 npm 官方下载统计,@digiotech/react-native 在 2026/10/12 – 2026/11/10 这 30 天内被下载 6,231 次,日均约 208 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@digiotech/react-native 还在维护吗?

最新版本 2.0.20 发布于 2026/11/10(1 天前);至今共发布 50 个版本,其中过去 12 个月发布了 23 个;首次发布于 2023/10/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。