• About TrustVision
  • Android SDK
  • Flutter SDK
  • React Native SDK
  • Web SDK
  • API Client Libraries
  • eKYC Platform
  • Integration Case Studies
  • TS eKYC/FA App
TrustVision API Documentation

iOS 1.x.x UI only

OVERVIEW

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

  • ID and selfie matching.
  • Liveness checking.

Specifications

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

Integration Steps

1. Adding the SDK to your project

  • Add required frameworks to project under Frameworks, Libraries, and Embedded Content with embed mode is set to Do Not Embed
    • TrustVIsionSDK.framework
  • Add TrustVisionSDK.bundle bundle to Copy Bundle Resources
alt text
  • Add key to info.plist:

    <key>NSCameraUsageDescription</key>
    <string>Open camera</string>
    

2. Start the SDK

The SDK provides some built in Activities example activity to capture id, selfie, liveness...

2.1. Capture the ID

The id capturing activity will show the camera to capture image, preview the image. To start the id capturing activity.

2.1.1. Set config parameters

swift
let config: TVIdCardConfiguration = TVIdCardConfig()
config.idCardSide = TVCardSide.front
config.cardType = selectedCardType
confg.isEnableSound = false

Options:

  • cardType: TVCardType. List of supported cards can be found by let cardTypes: [TSCardType] = try TrustVisionSdk.getCardTypes()
  • cardSide: TVCardSide. Card side to capture
  • isEnableSound: Bool. Sound should be played or not
  • isSanityRequired: Bool. Check id card sanity or not
  • isReadBothSide: Bool. If true then the sdk will capture both side if possible; otherwise, then the card side defined in cardSide will be used
  • isIdCardTamperingDetectionEnable: Bool. Check id card tampering or not
2.1.2. Start id capturing from configuration
swift
let vc = TrustVisionSdk.startIdCapturing(configuration: config, success: { (result) in

}, failure: { (error) in

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

where:

  • configuration: TVIdCardConfiguration
  • success method that will be called in case success. Parameters:
    • result : TVDetectionResult. Use the following fields:
      • frontIdImage
      • backIdImage
  • failure: FailureCallback
  • cancellation: CancellationCallback

2.2. Capture the selfie

The selfie capturing activity will show the camera to capture image, preview the image and verify active liveness in local. To start the selfie capturing activity.

2.2.1. Set config parameters

swift
let config: TVSelfieConfiguration = TVSelfieConfiguration()
config.cameraOption = TVCameraOption.front
confg.isEnableSound = false
config.livenessMode = TVLivenessMode.passive

Options:

  • cameraOption: set the camera mode TVCameraOption.
  • isEnableSound: Sound should be played or not.
  • livenessMode: set the liveness verification mode TVLivenessMode
  • isSanityRequired: The sanity verification should required or not. (white background check)
2.2.2. Start selfie capturing from configuration
swift
let vc = TrustVisionSdk.startSelfieCapturing(configuration: config, success: { (result) in

}, failure: { (error) in

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

where:

  • configuration: TVSelfieConfiguration
  • success method that will be called in case success. Parameters:
    • result : TVDetectionResult . Use the following fields:
      • selfieImages
  • failure: FailureCallback
  • cancellation: CancellationCallback

API references

1. TVDetectionResult

MethodTypedescription
frontIdImageTVEncryptedImageImage of id card's front side (use field rawImage)
backIdImage TVEncryptedImageImage of id card's back side (use field rawImage)
selfieImages [TVGestureImage]Images of selfie
isLive BoolSelfie images are live or not

2. TVGestureImage

  • gestureType: GestureType
  • frontalImage: TVEncryptedImage
  • gestureImage: TVEncryptedImage

3. TVGestureImage.GestureType

  • up
  • down
  • left
  • ight
  • frontal

4. TVCameraOption (Enum)

  • TVCameraOption.front: Use front camera
  • TVCameraOption.back: Use back camera
  • TVCameraOption.both: The screen will have a button to switch between front & back camera

5. TVLivenessMode (Enum)

  • TVLivenessMode.none: no liveness verification. Just capture the selfie and verify sanity.
  • TVLivenessMode.passive: Use texture-based approach.
  • TVLivenessMode.active: Use challenge-response approach. User needs to follow and finish all steps when capturing selfie like turn left, right, up, smile, open mouth...

6. FailureCallback (Callback)

Will be called in case failed. Parameters:

  • error: TVError.
    • errorCode: the specific error code.
    • description: the human-readable error description can be show to end user

7. CancellationCallback (Callback)

Will be called in case the sdk is cancelled. No parameters