• 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

iOS 4.0.x UI only

OVERVIEW

TrustVision SDK is an iOS SDK for TrustVision Engine. It provides these features:

  • eKYC Platform.

Specifications

  • Xcode version 14.2+
  • target iOS version 11+
  • swift version: 5

Integration Steps

1. Adding the SDK to your project

  • Adding *. framework and *.bundle by "Add Files to {your_name_project}"

    alt text

Note: Set up the optional status for TrustVisionNFC.xcframework

  • Add key to info.plist:
groovy
<key>NSCameraUsageDescription</key>
<string>Open camera</string>
  • Add dependencies
    • Use CocoaPods, add these lines to podfile
 pod 'TensorFlowLiteSwift', '~> 2.11.0'
 pod 'PromiseKit', '~> 6.8'
 pod 'CocoaLumberjack/Swift'
 pod 'OpenSSL-Universal', '1.1.180' # if you are using module NFC
 pod 'CryptoSwift', '~> 1.4.0'
  • Those lines are added at the end of podfile
 post_install do |installer|
   installer.pods_project.targets.each do |target|
   // If when compiling your project, "Undefined symbol" occurs, please add the module name which is having the error here
   // add OpenSSL-Universal if you are using module NFC
     if ['CocoaLumberjack', 'TensorFlowLiteC', 'TensorFlowLiteSwift', 'PromiseKit', 'OpenSSL-Universal', 'CryptoSwift'].include? "#{target}"
       target.build_configurations.each do |config|
          config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
          config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
       end
     end
   end
 end
  • If not, add manually:

    • Add these frameworks and chose Embed & Sign
      • CocoaLumberjack.framework
      • PromiseKit.framework
    • Add these frameworks and chose Do Not Embed
      • TensorFlowLite.framework
      • TensorFlowLiteC.framework
      • Add key Validate Workspace in Build Settings
  • If host app is using Objective-C, please follow these additional steps:

    • add a empty swift file and create bridging file (to force project create key SWIFT_VERSION)
    • add flag -lc++ and -ObjC in Other linker flags

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

swift
let config = TVPlatformConfigurationBuilder()
                .setUserIdentityToken(yourUserIdentityToken)
                .setBaseUrl(yourBaseUrl)
                .setEnableSound(true)
                .setCardTypes([TVCardType.defaultVnCardType()])
                .setFlowId(yourFlowId)
                .setSingleStep(yourSingleStep)
                .build()

Configuration Options:

NameTypeRequiredDescription
userIdentityTokenStringyesIdentify user to the eKYC platform.
baseUrlStringyesThe eKYC platform base URL
enableSoundBoolnoEnable SDK sound, default: false
cardTypes[TVCardType]noAllowed card types
flowIdStringnoOptional flow control
singleStepStringnoOptional Single Step mode
Single Step Mode

You can configure SDK to run a specific step directly by setting singleStep.

Supported values for singleStep:

ValueDescription
"ekyc.id_card"Only ID Card capture
"ekyc.selfie"Only Selfie capture

Example usage:

swift
let config = TVPlatformConfigurationBuilder()
                .setUserIdentityToken(yourUserIdentityToken)
                .setBaseUrl(yourBaseUrl)
                .setSingleStep("ekyc.selfie")
                .setFlowId("id_selfie")
                .build()

If setSingleStep() is not used, SDK defaults to full eKYC flow based on flowId.

Available flowId values:

flowIdDescription
id_selfieID -> Selfie
selfie_idSelfie -> ID
id_nfc_selfieID -> NFC -> Selfie
qr_nfc_selfieQR -> NFC -> Selfie

2.1.2 Start eKYC Platform

swift
let vc = TrustVisionSdk.shared.startEkycPlatform(withConfig: config, completion: { (result) in

}, failure: { (error) in

}, cancellation: {
    // sdk is canceled
})

where:

  • config: TVPlatformConfiguration
  • completion: (TVPlatformResult) -> Void method that will be called in case success. Parameters:
    • result: TVPlatformResult.ResultType. The result enum of the eKYC platform.
      • .success: Success
      • .failure: Failure/Rejection
    • fullyCompleted: bool. SDK internal flag for fully completed state
  • failure: FailureCallback
  • cancellation: () -> Void

2.2. eKYC Platform Webview

2.2.1. Start eKYC Platform Webview

swift
let vc = TrustVisionSdk.shared.startEkycPlatformWebview(withUrl: yourUrl, completion: { (result) in

}, failure: { (error) in

}, cancellation: {
    // sdk is canceled
})

where:

  • url: String. The URL of the eKYC platform webview.
  • completion: method that will be called in case success. Parameters:
    • status: Int. The status of the eKYC platform webview.
      • 0: Success
      • 1: Failure
  • failure: (String) -> Void
  • cancellation: () -> Void