Getting Started


Requirements

Android

Minimum SDK Version

Ensure that your Android project has minSdkVersion set to 21 in your android/app/build.gradle file

android {  
  defaultConfig {  
  ...  
  minSdkVersion 21  
  ...  
  }  
}

Required Permissions

NameDescription
CAMERARequired to capture KTP and Selfie images.
INTERNETRequired to connect to backend services and upload documents
ACCESS_WIFI_STATEAllows the application to check the state of Wi-Fi connectivity, ensuring smooth operation in network-dependent tasks.
ACCESS_NETWORK_STATEEnables the application to monitor the device's overall network connectivity, allowing fallback mechanisms if the network state changes.

Extract SDK

Extract the digital_identity_sdk.zip file. It contains:

  • Flutter plugin in the digital_identity_sdk_flutter directory.
  • Android-specific SDK in the digital-identity-goto-220124.aar file.

Add Android AAR

  1. In your Flutter application, open the android/app directory.
  2. Create a libs directory inside android/app.
  3. Open the project-level build.gradle file and register the libs directory as a local repository:
allprojects {
  repositories {
    flatDir {
    dirs 'libs'
  }

  google()
  mavenCentral()
  }
}
  1. Open the app-level build.gradle file and add the AAR dependency:
dependencies {
  implementation files('libs/digital-identity-goto-220124.aar')
}
  1. Perform a Gradle sync.

iOS

Minimum iOS Version

Ensure that your iOS project supports iOS 12 or higher. Update your ios/Podfile to include the
following configuration:

platform :ios, '12.0'

Info.plist Changes

Update the following keys in your Info.plist file:

  1. Camera Usage Description

To enable camera access

<key>NSCameraUsageDescription</key>
<string>Camera access is required for face and ID verification</string>
  1. LSApplicationQueriesSchemes

For security and jailbreak detection, add:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>zbra</string>
  <string>cydia</string>
  <string>undecimus</string>
  <string>Sileo</string>
  <string>filza</string>
</array>

Modify Client iOS Podfile

In the client app’s Podfile, merge the post_install block to include specific configurations for certain
targets. Add the following to the Podfile

# Merged post_install block
post_install do |installer|
  installer.pods_project.targets.each do |target|
    # Add additional flutter build settings
    flutter_additional_ios_build_settings(target)

    # Set BUILD_LIBRARY_FOR_DISTRIBUTION to YES for specific targets
    if ["SwiftProtobuf", "ReachabilitySwift", "GRDB.swift", "Clickstream"].include?(target.name)
      target.build_configurations.each do |config|
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
      end
    end
    
    # Set IPHONEOS_DEPLOYMENT_TARGET for the Starscream target
    if ["Starscream"].include?(target.name)
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
      end
    end
  end
end

This ensures the correct settings for the BUILD_LIBRARY_FOR_DISTRIBUTION and
IPHONEOS_DEPLOYMENT_TARGET for specific pods.


Add the Script to Copy Digital Identity Resources

  1. Create a new Run Script Phase in Xcode:
    1. Open your Runner.xcworkspace project in Xcode.
    2. Go to the Runner target.
    3. Select Build Phases.
    4. Click the + button and select New Run Script Phase.
    5. Name the script Copy Digital Identity Resources (or any name you prefer).
  2. Add the following script:

Developer Note: Replace the following line with the actual path to Digital Identity resources:

SOURCE_BUNDLE_PATH="/Users/shantaramkokate/Workspace/digital_identity_sdk_flutter  
/ios/Frameworks/DigitalIdentityResources.bundle" # \<-- Update this path

Make sure to update the path with the correct location of DigitalIdentityResources.bundle in your
local development environment. This path is crucial for copying the bundle to the final build
during the iOS app's build process.

Script:

echo "DigitalIdentity: Starting build process"

# Developer Note: Replace the following line with the actual path to the Digital Identity
resources
SOURCE_BUNDLE_PATH="/Users/shantaramkokate/Workspace/digital_identity_sdk_flutter/ios/Frameworks/DigitalIdentityResources.bundle" # <-- Update this path

# Define the target path where the .bundle will be copied
RESOURCE_BUNDLE_PATH="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/DigitalIdentityResources.bundle"

# Debug prints for paths
echo "DigitalIdentity: RESOURCE_BUNDLE_PATH = $RESOURCE_BUNDLE_PATH"
echo "DigitalIdentity: SOURCE_BUNDLE_PATH = $SOURCE_BUNDLE_PATH"

# Check if SOURCE_BUNDLE_PATH exists
if [ ! -e "$SOURCE_BUNDLE_PATH" ]; then
  echo "DigitalIdentity: ERROR - Source bundle does not exist at $SOURCE_BUNDLE_PATH"
  exit 1 # Exit the script with an error code
fi

# Check if RESOURCE_BUNDLE_PATH exists
if [ ! -e "$RESOURCE_BUNDLE_PATH" ]; then
  echo "DigitalIdentity: DigitalIdentityResources.bundle not found at $RESOURCE_BUNDLE_PATH"
  cp -R "$SOURCE_BUNDLE_PATH" "$RESOURCE_BUNDLE_PATH"
  echo "DigitalIdentity: DigitalIdentityResources.bundle successfully copied to$RESOURCE_BUNDLE_PATH"
else
  echo "DigitalIdentity: DigitalIdentityResources.bundle already exists at $RESOURCE_BUNDLE_PATH"
fi

Ensure the script is executed after the resources are copied.

  1. Place this script in the Copy Bundle Resources phase to ensure the .bundle is included in the
    final build.
  2. Final Steps
    1. Ensure that all resources are added to the target's Resources folder during the build.
    2. Test the integration by building the app and verifying that the .bundle file is included in
      the final build output.

Installation Guide

Adding Dependencies:

To integrate the Digital Identity Sdk into your project, follow these steps:

  • Copy the digital_identity_sdk_flutter directory into your Flutter application
  • Open your project's pubspec.yaml file and add the following dependency:
dependencies:  
  digital_identity_sdk_flutter:
    path: ../path_to_sdk

Initialize Digital Identity SDK

var digitalIdentitySdk = DigitalIdentitySdk(
  environment: DigitalIdentitySdkEnvironment.staging, // Set the environment
  analyticsCallback: _onEventFromDigitalIdentitySDK, // Analytics callback function
  language: UserLanguage.indonesia, // Set the preferred language
);

Key Components

  • environment: SDK supports different environments, staging or production environments.
  • analyticsCallback: To track events from the SDK, implement the analyticsCallback function:
  • language: The language setting of the KYC SDK, defined by the UserLanguage type.

Clear SDK Instance

Usage:

Future<bool> dispose() async { }

Call this method to release the SDK instance and free up resources. Reinitialization will be needed before
calling SDK launch methods.


Clear SDK Cache Data

Usage:

Future<bool> clearSdkCache() async { }

Call this method to clear the cache of the SDK. It is possible to call this method after dispose.


Documentations