Skip to main content

Native SDK

Package : dojah_kyc_sdk_flutter Example Application: https://github.com/dojah-inc/Dojah-flutter-sdk

Installation

 $ flutter pub add dojah_kyc_sdk_flutter

Android Setup

Requirements
  • Minimum Android SDK version - 21
  • Supported targetSdkVersion - 35
In your android root/build.gradle file set maven path:
...
allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
Or Set maven path in your root/settings.gradle file:
...
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
Permissions For Android you don’t need to declare permissions, its already included in the Package.

ProGuard / R8 Configuration (Android)

If you have ProGuard or R8 minification and shrinking enabled for your Android release builds, you must add keep rules so that the Dojah SDK classes and its dependencies are not stripped or obfuscated. Without these rules, the SDK may crash at runtime with ClassNotFoundException, NoSuchMethodError, or silent WebView/JavaScript bridge failures.
1

Enable minification in build.gradle

In your android/app/build.gradle, make sure ProGuard (R8) is enabled for release builds:
android {
    ...
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
2

Add Dojah ProGuard rules

Create or open the file android/app/proguard-rules.pro and add the following rules:
# ── Dojah SDK ──
-keep class com.dojah.** { *; }
-keep class com.dojah_inc.** { *; }
-keepclassmembers class com.dojah.** { *; }
-dontwarn com.dojah.**

# ── Android WebView JavaScript bridge ──
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}
-keepattributes JavascriptInterface

# ── Retrofit (used internally by the SDK) ──
-keepattributes Signature,InnerClasses,EnclosingMethod
-keepattributes RuntimeVisibleAnnotations,RuntimeVisibleParameterAnnotations
-keepattributes AnnotationDefault
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*

# ── OkHttp / Okio ──
-dontwarn okhttp3.**
-dontwarn okio.**

# ── Gson ──
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.** { *; }

# ── Glide (image loading) ──
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
    <init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
    **[] $VALUES;
    public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
    *** rewind();
}

# ── Misc ──
-dontwarn javax.annotation.**
-dontwarn kotlin.Unit
-dontwarn org.codehaus.mojo.animal_sniffer.*
Failing to add these rules when ProGuard/R8 is enabled will cause the Dojah SDK to malfunction in release builds. Common symptoms include blank screens, crashes on SDK launch, and network call failures. If you encounter issues, run a release build with --no-shrink temporarily to confirm ProGuard is the cause.

iOS Setup

Requirements
  • Minimum iOS version - 14
Add the following POD dependencies in your Podfile app under your App target
  pod 'Realm', '~> 10.52.2', :modular_headers => true
  pod 'DojahWidget', :git => 'https://github.com/dojah-inc/sdk-swift.git', :branch => 'pod-package'
target 'Example' do
  ...
  pod 'Realm', '~> 10.52.2', :modular_headers => true
  pod 'DojahWidget', :git => 'https://github.com/dojah-inc/sdk-swift.git', :branch => 'pod-package'
  ...
end
and run pod install in your iOS folder:
cd iOS
pod install
Permissions For iOS, Add the following keys to your Info.plist file: NSCameraUsageDescription - describe why your app needs access to the camera. This is called Privacy - Camera Usage Description in the visual editor. NSMicrophoneUsageDescription - describe why your app needs access to the microphone, if you intend to record videos. This is called Privacy - Microphone Usage Description in the visual editor. NSLocationWhenInUseUsageDescription - describe why your app needs access to the location, if you intend to verify address/location. This is called Privacy - Location Usage Description in the visual editor.

Usage

To start KYC, import DojahKyc in your Flutter code, and launch Dojah Screen
import 'package:dojah_kyc_sdk_flutter/dojah_kyc_sdk_flutter.dart';

DojahKyc.launch(
  "{Required: Your_WidgetID}",
  referenceId: "{Optional: Reference_ID}",
  email: "{Optional: Email_Address}"
)



//Example (If you're not passing WidgetID, Reference_ID and Email_Address values)

DojahKyc.launch("1234678901234",  referenceId: "DJ-123456",  email: "abc@gmail.com")


//Example (If you're not passing Reference_ID and Email_Address values)

DojahKyc.launch("1234678901234",  referenceId: null, email: null)

SDK Parameters
  • WidgetID - a REQUIRED parameter. You get this ID when you sign up on the Dojah platform, follow the next step to generate your WidgetId.
  • Reference ID - an OPTIONAL parameter that allows you to initialize the SDK for an ongoing verification.
  • Email Address - an OPTIONAL parameter that allows you to initialize the SDK for an ongoing verification.

How to Get a Widget ID

To use the SDK, you need a WidgetID, which is a required parameter for initializing the SDK. You can obtain this by creating a flow on the Dojah platform. Follow these steps to configure and get your Widget ID:
1. Log in to your Dojah Dashboard: If you don’t have an account, sign up on the Dojah platform.

2. Navigate to the EasyOnboard Feature: Once logged in, find the EasyOnboard section on your dashboard.

3. Create a Flow:

    - Click on the 'Create a Flow' button.
    - Name Your Flow: Choose a meaningful name for your flow, which will help you identify it later.

4. Add an Application:

    - Either create a new application or add an existing one.
    - Customise your widget with your brand logo and color by selecting an application.

5. Configure the Flow:

    - Select a Country: Choose the country or countries relevant to your verification process.
    - Select a Preview Process: Decide between automatic or manual verification.
    - Notification Type: Choose how you’d like to receive notifications for updates (email, SMS, etc.).
    - Add Verification Pages: Customize the verification steps in your flow (e.g., ID verification, address verification, etc.).
    
6. Publish Your Widget: After configuring your flow, publish the widget. Once published, your flow is live.

7. Copy Your Widget ID: After publishing, the platform will generate a Widget ID. Copy this Widget ID as you will need it to initialize the SDK as stated above.

Example Application

Contributing
  • KYC WIDGET Repository
  • Fork it!
  • Create your feature branch: git checkout -b feature/feature-name
  • Commit your changes: git commit -am 'Some commit message'
  • Push to the branch: git push origin feature/feature-name
  • Submit a pull request 😉😉

Webview SDK

Package : flutter_dojah_kyc Example Application: https://github.com/dojah-inc/Flutter-SDK

Installation

 $ flutter pub add flutter_dojah_kyc

iOS

Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:
  • NSCameraUsageDescription - describe why your app needs access to the camera. This is called Privacy - Camera Usage Description in the visual editor.
  • NSMicrophoneUsageDescription - describe why your app needs access to the microphone, if you intend to record videos. This is called Privacy - Microphone Usage Description in the visual editor.
  • NSLocationWhenInUseUsageDescription - describe why your app needs access to the location, if you intend to verify address/location. This is called Privacy - Location Usage Description in the visual editor.

Podfile

Kindly include this in Podfile set up. dart: PermissionGroup.camera PERMISSION_CAMERA=1, dart: PermissionGroup.microphone PERMISSION_MICROPHONE=1, dart: PermissionGroup.location PERMISSION_LOCATION=1,

Android

// Add the camera permission: 

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

// For newer Android versions
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

// Add the modify audio settings permission:
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
// Add the Internet settings permission:
<uses-permission android:name="android.permission.INTERNET"/>
// Add the Location settings permission :
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Usage

final Map<String,dynamic> config = {
  debug: true,
  otp: true, //for verification type
  selfie: true //for verification type
};


  final userData = {
          "first_name": "John",
          "last_name": "Doe",
          "dob": "1990-04-16", //YYYY-MM-DD
          "residence_country": "Nigeria",
          "email": "abc@gmail.com"
        };


     final configObj = {
      "widget_id": "Your Widget ID"
      };

    final metaData = {
       "user_id": "81828289191919193882",
       "many_other_custom_fields": "",
    };


  final govData = {
                  "bvn": "",
                  "nin": "",
                  "dl": "",
                  "mobile": ""
  };


    final govId = {
         "passport": "https://d.jpeg",  
         "national": "https://d.jpeg",    //National ID card/ NIN Slip
         "dl": "https://d.jpeg",         //Driver's license
         "permit": "https://d.jpeg", 
         "voter": "https://d.jpeg",
         "custom": "https://d.jpeg",

};

 final DojahKYC _dojahKYC = DojahKYC(
    appId: appId,
    publicKey: publicKey,
    type: "custom",
    userData: userData, //Optional 
    metaData: metaData, //Optional 
    config: configObj, 
    govData: govData, //Optional 
    govId: govId, //Optional 
    referenceId: referenceId //Optional  
                );


  _dojahKYC.open(context, onSuccess: (result) {
    print('$result');
  }, 
  onClose: (close) => print('Widget Closed'),
  onError: (err) {
    print('error: $err');
  });
Important Security Update: Proper Handling of SDK Verification CallbacksThe final verification decision should never rely on SDK callbacks (onSuccess, onError, onClose) alone. Always retrieve the actual verification status from your backend using the reference ID before granting access or approving onboarding.
The onSuccess callback is triggered when the user has completed all the verification steps configured in the widget flow. This confirms that every step — such as document capture, liveness check, government data entry, etc. — has been submitted by the user.Important: onSuccess confirms flow completion, not that the user passed all checks. A user may complete every step but still fail backend validation (e.g., document mismatch, failed liveness). Always verify the final result from your backend using the reference ID.
The onError callback is triggered when an error occurs before all verification steps are completed. This prevents the user from finishing the flow. Common causes include:
  • Network connectivity issues
  • SDK initialization or configuration errors
  • Provider-side failures during a verification step
  • Unexpected interruptions during the flow
When onError fires, the verification is incomplete. Your application should handle this gracefully — for example, by prompting the user to retry.
The onClose callback is triggered when the user terminates the widget using the close button. This indicates the user chose to exit the verification flow before completing all steps.The verification is considered abandoned when this occurs. If a redirect URL is configured, the user will be redirected there after the widget closes. The final verification status will be delivered through the webhook notification.
Recommended ImplementationAfter the widget interaction, create a backend flow or confirmation page that retrieves the actual verification result using the reference ID generated during the verification process. You can retrieve the final verification details through:
Possible Verification Statuses The verification result returned by the webhook or API may contain any of the following statuses:
StatusDescription
OngoingThe verification process is currently in progress.
CompletedThe verification has been successfully completed and passed all checks.
PendingThe verification is awaiting further action or review.
FailedThe verification was completed but did not pass one or more verification checks.
AbandonedThe verification was started but not completed by the user.

Deployment

REMEMBER TO CHANGE THE APP ID and PUBLIC KEY WHEN DEPLOYING TO A LIVE (PRODUCTION) ENVIRONMENT Contributing
  • KYC WIDGET Repository
  • Fork it!
  • Create your feature branch: git checkout -b feature/feature-name
  • Commit your changes: git commit -am 'Some commit message'
  • Push to the branch: git push origin feature/feature-name
  • Submit a pull request 😉😉

Android File Upload crash fixed

Here’s a fix for Android Device crashing during file upload Kindly do the following: The error message indicates that the Android file provider authority is not properly configured in your Flutter mobile application. The file provider authority is necessary for Android devices to access files using a content URI. To resolve this issue, you need to make sure that you have properly configured the file provider in your AndroidManifest.xml file. Here are the steps to configure the file provider:
  1. Open the AndroidManifest.xml file located in the android/app/src/main directory of your Flutter project.
  2. Inside the <application> tag, add the following code: Make sure to replace com.example.dojah_kyc with your application’s package name.
  3. Create a new file named provider_paths.xml in the android/app/src/main/res/xml directory (create the xml directory if it doesn’t exist). Add the following code to the provider_paths.xml file:
  1. Save the changes and rebuild your Flutter application. By following these steps, you should be able to properly configure the file provider and resolve the “Couldn’t find meta-data for provider” error when selecting files with the file picker in your Flutter application on Android devices.