GitHub Repository
View source code and examples on GitHub
npm Package
@didit-protocol/sdk-react-native
Native SDK: This is the recommended approach for React Native and Expo apps. The SDK wraps the native iOS and Android SDKs for the best user experience, optimized camera handling, and full NFC support.
Requirements
Platform Requirements
Installation
Expo (Recommended)
app.json (or app.config.js). NFC is enabled by default:
- Android: Adds the Didit Maven repository to Gradle, sets the
diditSdkAndroidNfcEnabledGradle property, and applies BouncyCastle dependency/packaging rules - iOS: Adds the DiditSDK podspec to the Podfile (pinned to iOS 15 when NFC is enabled)
Disabling NFC dependencies
To build without NFC support (smaller binary, no NFC capability required), pass plugin options:React Native CLI
iOS Setup
Add the DiditSDK pod to yourPodfile (it’s not on CocoaPods trunk). The block below honours an DIDIT_SDK_IOS_NFC_ENABLED environment variable so you can toggle the no-NFC subspec (DiditSDK/Core) at install time:
Android Setup
Add the Didit Maven repository to your project-levelsettings.gradle:
android/app/build.gradle (inside the android { ... } block) to resolve BouncyCastle duplicate-class conflicts and the OSGI MANIFEST.MF duplicate that the DiditSDK transitive dependencies can trigger:
me.didit:didit-sdk-core artifact instead of me.didit:didit-sdk), add this to android/gradle.properties:
true, to use the full Android SDK with NFC.
Permissions
iOS
Add the following keys to your app’sInfo.plist. Missing required iOS privacy keys will cause iOS to terminate the app as soon as the SDK accesses that protected resource.
NFC Configuration
To enable NFC reading for passports and ID cards with chips:-
Add NFC Capability in Xcode:
- Select your target > Signing & Capabilities > + Capability > Near Field Communication Tag Reading
-
Add ISO7816 Identifiers to
Info.plist:
- Add an entitlements file with NFC tag reading enabled:
Android
The following permissions are declared in the SDK’sAndroidManifest.xml and merged automatically:
Camera and NFC hardware features are declared as optional (
android:required="false"), so your app can be installed on devices without these features.
Quick Start
Integration Methods
The SDK supports two integration methods:Method 1: Session Token (Recommended for Production)
Create a session on your backend using the Create Verification Session API, then pass the token to the SDK:- Associating sessions with your users (
vendor_data) - Setting custom metadata
- Configuring callbacks per session
Method 2: Workflow ID (Simpler Integration)
For simpler integrations, the SDK can create sessions directly using your workflow ID:Configuration
Customize the SDK behavior by passing aDiditConfig object:
startVerificationWithWorkflow, pass config inside options.config:
Configuration Options
Theming & Colors: Colors, backgrounds, and intro screen settings are configured through your White Label settings in the Didit Console, not in the SDK configuration. This ensures consistent branding across all platforms.
Language Support
The SDK supports 53 languages. If no language is specified, the SDK uses the device locale with English as fallback.Advanced Options
These options are only available withstartVerificationWithWorkflow, where the SDK creates the session on your behalf.
Contact Details (Prefill & Notifications)
Provide contact details to prefill verification forms and enable email notifications:Expected Details (Cross-Validation)
Provide expected user details for automatic cross-validation with extracted document data:ExpectedDetails fields are optional. See src/types.ts for the full type.
Custom Metadata
Store custom JSON metadata with the session (not displayed to user):Handling Results
BothstartVerification and startVerificationWithWorkflow return a Promise<VerificationResult>. The result is a discriminated union — use the type field to determine the outcome.
Result Cases
SessionData Properties
Error Types
Complete Result Handling Example
End-to-End Example (Backend Session → React Native SDK → Webhook)
The production-ready integration: your backend creates the session, your RN app receives thesession_token, and the SDK runs the flow. The final decision is delivered to your backend via webhook — never trust the client-side result alone.