• 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 4.0.x UI only

OVERVIEW

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

  • ID and selfie matching.
  • Liveness checking.

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. Initialize and config SDK

2.0. Initialize SDK

Method 1: Highly recommended:

swift
        let initConfiguration = TVInitializeConfigurationBuilder()
            .setAccessKeyId("accessKey")
            .setAccessKeySecret("secretKey")
            .setBaseUrl("endpoint")
            .setClientSettingsJsonString(nil)
            .setClientSettings(nil)
            .setFlowId(nil)
            .setLanguageCode(nil)
            .setSslCertificates(nil)
            .setXRequestId(nil)
            .setXRequestId2(nil)
            .setEnableDebuggingLog(false)
            .setImageEncryptionKey(nil)
            .setSecurityPublicKey(nil)
            .setHeaders(nil)
            .setEnableGetClientSetting(true)
            .setLogServerAccess("accessKey for log event")
            .setLogServerSecret("secretKey for log event")
            .setLogServerBaseUrl("endpoint for log event")
            .build()

        TrustVisionSdk.shared.initialize(
            config: initConfiguration,
            success: {
            // sdk is initialized
        }, failure: { (error) in
             // sdk is failed to initialize
        }) { (event) in
             // sdk is initialized with event
        }

Options:

  • setAccessKeyId(): String?. The access key id of the server.
  • setAccessKeySecret(): String?. The secret key of the server.
  • setBaseUrl(): String?. The endpoint of the server.
  • setClientSettingsJsonString(): String?. The client setting. It's the setting specialized for each client from TS server. It's the response json string get by API https://ekyc.trustingsocial.com/api-reference/customer-api/#get-client-settings. When it's null or unmatched with the expected type then the default setting in the SDK will be used.
  • setClientSettings(): TVClientSettingsResponse?. The client setting, same with setClientSettingsJsonString(), but in Object type instead of JSON string.
  • setFlowId(): String?, parameter to get client setting. Default is null
ValueFlow
face_authenFace Authen
onboardingOnboarding
  • setLanguageCode(): String?. Language code. vi or en
  • setSslCertificates(): [TVCertificate?]?. List of init SSL pining certificate files
  • setImageEncryptionKey(). String?. For image encrypt. Set nil to ignore encryption
  • setSecurityPublicKey(). String?. For public key. Set nil to use it default in TS
  • setXRequestId(): String? https://ekyc.trustingsocial.com/api-reference/customer-api#api-reconciliation
  • setXRequestId2(): String? another xRequestId
  • setHeaders(): [String :String?]?. The headers to be added to the request.
  • setEnableGetClientSetting(true) Bool, default is true. It allows the SDK to retrieve client settings internally when in Full mode. If set to false, please provide client settings using setClientSettings or setClientSettingsJsonString.
  • setLogServerAccess: String. The access key id of the log event server.
  • setLogServerSecret: String. The secret key of the log event server.
  • setLogServerBaseUrl: String. The URL of the log event server.
  • success: SuccessCallback
  • failure: FailureCallback
  • onEvent: EventCallback

Method 2: Not recommended (Deprecated)

swift
TrustVisionSdk.shared.initialize(
    accessKeyId: "your_access_key",
    accessKeySecret: "your_secret_key",
    baseUrl: "baseUrl",
    localizationFiles: nil,
    clientSettingsJsonString: nil,
    localizationFiles: nil,
    languageCode: "vi",
    theme: TVTheme(),
    xRequestId: nil,
    xRequestId2: nil,
    isForced: false,
    enableDebuggingLog: false,
    tvCertificate: TVCertificate(name:"your_name_ssl_pining_certificate_file", type: "your_name_ssl_pining_certificate_type"),
    imageEncryptionKey: "your_key",
    securityPublicKey: "your_security_public_key"
    success: {
        // sdk is initialized
    }, failure: { error in
        // sdk is failed to initialize
    }, onEvent: { event in
        // sdk is initialized with event
    }
)

Options:

  • accessKeyId: String. The access key id of the server.
  • accessKeySecret: String. The secret key of the server.
  • baseUrl: String. The endpoint of the server.
  • clientSettingsJsonString: String. The jsonConfigurationByServer is optional but recommended. It's the setting specialized for each client from TS server. It's the response json string get by API https://ekyc.trustingsocial.com/api-reference/customer-api/#get-client-settings. When it's null or unmatched with the expected type then the default setting in the SDK will be used.
  • languageCode: String. Language code. vi or en
  • theme: TVTheme. UI customization theme.
  • tvCertificate: TVCertificate?. init ssl pining certificate
  • imageEncryptionKey. String?. For image encrypt. Set nil to ignore encryption
  • securityPublicKey. String?. For public key. Set nil to use it default in TS
  • xRequestId: String (optional) https://ekyc.trustingsocial.com/api-reference/customer-api#api-reconciliation
  • xRequestId2: String (optional) another xRequestId
  • success: SuccessCallback
  • failure: FailureCallback
  • onEvent: EventCallback

2.1. Update and get sdk language

Allow user to change the sdk language after initialization

swift
TrustVisionSdk.shared.changeLanguageCode(languageCode: String)
TrustVisionSdk.shared.getLanguageCode() -> String?
TrustVisionSdk.shared.getSupportedLanguageCodes() -> []

3. Start the SDK

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

3.0. Capture the ID

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

3.0.1. Set config parameters

swift
let config = TVIdCardConfiguration(
    cardTypes: [TVCardType],
    cardSide: TVIdCardConfiguration.TVCardSide.front,
    isSoundEnable: false,
    isReadBothSide: false,
    idTamperingLevel: nil,
    skipConfirmScreen: false,
    idCaptureOnlyMode: false,
    isEnablePhotoGalleryPicker: false,
    isEnableScanQr: true,
    isEnableScanNfc: true,
    isEnableVerifyNfc: true,
    isSanityRequired: false,
    isIdCardTamperingDetectionEnable: false,
    isEnableReadCardInfo: false,
    isEnableUploadFrames: true,
    isEnableUploadImages: true,
    isEnableCallApiOcrNfc: true
)

Options:

- cardTypes: [TVCardType]. Card types are allowed to capture. List of supported cards can be found in this table:

card_typedescriptionsupported countries
TVCardType.defaultVnCardType()Any of Vietnam national ID versionsvietnam
TVCardType.cmnd()Chứng minh nhân dân cũvietnam
TVCardType.cmndNew()Chứng minh nhân dân mớivietnam
TVCardType.cccd()Căn cước công dânvietnam
TVCardType.cccdNew()Căn cước công dân gắn chipvietnam
TVCardType.passport()Vietnam passportvietnam
TVCardType.tcc()Thẻ căn cướcvietnam
  • cardSide: TVCardSide. Card side to capture
  • isSoundEnable: Bool. Sound should be played 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
  • idTamperingLevel: String?. Tampering level each side of id card
  • skipConfirmScreen: Bool. Skip id capturing confirmation screen nor not
  • idCaptureOnlyMode: Bool. Just take front and back id card, no further processing sanity, tampering, read id card.
  • isEnablePhotoGalleryPicker: Bool. Allow user select id card image from phone gallery
  • isEnableScanQr : Bool. Allow user select scan QR code of the id card or not
  • isEnableScanNfc : Bool. Allow user select scan NFC chip of the id card or not
  • isEnableVerifyNfc : Bool. Enable verify NFC or not. If it's true then the SDK will call the API to verify the NFC data.
  • isSanityRequired: Bool. Enable sanity check or not. If it's true then the SDK will call the API to check the sanity of the id card.
  • isIdCardTamperingDetectionEnable: Bool. Enable ID Tampering Verification or not. If it's true then the SDK will call the API to check the tampering of the id card.
  • isEnableReadCardInfo: Bool. Enable read card info or not. If it's true then the SDK will call the API to read the card info.
  • isEnableUploadFrames: Bool. Enable upload video frames or not. If it's false then the SDK won't call the API to upload the frames and the APIs that need the video frames will be skipped or called with empty frames data.
  • isEnableUploadImages: Bool. Enable upload images or not. If it's false then the SDK won't call the API to upload the images and the APIs that need the image will be skipped.
  • isEnableCallApiOcrNfc: Bool. Enable read card info or not. If it's true then the SDK will call the API to read the card image id, then go to verify NFC.

3.0.2. Start id capturing from configuration

swift
let vc = TrustVisionSdk.shared.startIdCapturing(configuration: config, framesRecordedCallback: { batchId, frames, metadata, currentBatchIds in

}, readIdCardNumber: { (image) in
  return ""
}, success: { (result) in

}, failure: { (error) in

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

where:

  • configuration: TVIdCardConfiguration

  • framesRecordedCallback:

    • batchId: String. new coming local batch id
    • frames: Dictionary. batch frame to push
    • metadata: Dictionary. batch metadata to push
    • currentBatchIds [String]. For debugging only

    This callback will be called each time there is a new frame batch coming. Client upload and get the batch id which is used for later id tampering api call.

  • success: method that will be called in case success. Parameters:

    • result: TVDetectionResult. Use the following fields:
      • frontIdImage: TVImageClass
      • backIdImage: TVImageClass
      • frontIdQr: TVCardQr
      • backIdQr: TVCardQr
      • nfcInfoResult: TVNfcInfoResult
  • failure: FailureCallback

  • cancellation: CancellationCallback

  • readIdCardNumber: method that will be called in case of scan NFC to read SDK Id number from the image. The readIdCardNumber method has a parameter and return a string which is the id number of the card.

    • image: TVImageClass. image of back id card
3.0.3. Handle framesRecordedCallback

With each batch that returned by framesRecordedCallback callback, call the below api to get server frame batch id, keep it corresponds to batchId returned in framesRecordedCallback - local id https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-videoaudioframes

For example:

swift
  var frontCardFrameBatchIdsDictionary: [String: String] = [:]
  var backCardFrameBatchIdsDictionary: [String: String] = [:]
  . . .
  framesRecordedCallback = { batchId, frames, metadata, currentBatchIds in
        let batchDict = frames.merging(["metadata": metadata, "label": "The card type"]) { $1 }
        let jsonToBeUploaded = try JSONSerialization.data(withJSONObject: batchDict, options: .prettyPrinted)
    // upload frame batch to server using this api:
    // https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-videoaudioframes
    doYourUploadFrameBatchHere(withJSON: jsonToBeUploaded) { uploadingResult in
      if cardSide == TVIdCardConfiguration.TVCardSide.front {
        frontCardFrameBatchIdsDictionary.updateValue(uploadingResult.fileId, forKey: batchId)
      }
      else {
        backCardFrameBatchIdsDictionary.updateValue(uploadingResult.fileId, forKey: batchId)
      }
    }
  }

3.0.4. Handle ID capturing results

3.0.4.1. Remove redundant frame batch ids

For example:

swift
// These lists contain all valid frame batch ids that responded by server
var validFrontCardServerFrameBatchIds: [String] = []
var validBackCardServerFrameBatchIds: [String] = []
private func removeRedudantFrameBatchIds(batchIdsDictionary: [String: String], validIdsFromSDK: [String]) -> [String] {
    return batchIdsDictionary.compactMap({
        if validIdsFromSDK.contains($0.key) {
            return $0.value
        }
        else {
            return nil
        }
    })
}
. . .
success = { result in
    // result.frontCardFrameBatchIds && result.backCardFrameBatchIds is empty when Frame Recording feature is disabled by client settings.
    // Wait until every Frame batch has been uploaded to server before calling this
    if(everyFrameBatchUploadingCompleted) {
        if (!result.frontCardFrameBatchIds.isEmpty) {
            validFrontCardServerFrameBatchIds = removeRedudantFrameBatchIds(frontCardFrameBatchIdsDictionary, result.frontCardFrameBatchIds)
        }
        if (!result.backCardFrameBatchIds.isEmpty) {
            validBackCardServerFrameBatchIds = removeRedudantFrameBatchIds(backCardFrameBatchIdsDictionary, result.backCardFrameBatchIds)
        }
    }
}
3.0.4.2. Get Image Ids to be used in a particular use case

Use this API https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-image The images should be uploaded as JPEG data with 100% quality. For example:

swift
  // with front side
  let dataToUpload = result.frontIdImage.imageByteArray
  let frontCardId = yourMethodToUploadImage(dataToUpload)

  // with back side
  let dataToUpload = result.backIdImage.imageByteArray
  let backCardId = yourMethodToUploadImage(dataToUpload)
3.0.4.3. Upload QR images

if result.frontIdQr.isRequired is true then result.frontIdQr.images array should be non-empty. Otherwise, clients should be warned to re-capture id card photos.

QR images will be uploaded with this api: https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-image

swift
let dataToUpload = result.frontIdQr.images[i].imageByteArray
let qrId = yourMethodToUploadImage(dataToUpload)
  • Fields:
    • data: dataToUpload
    • label: result.frontIdQr.images[i].label
    • metadata: result.frontIdQr.images[i].metadata

*The same logic will be applied to result.backIdQr

3.0.4.4. Call this api to check id tampering

Call this API https://ekyc.trustingsocial.com/api-reference/customer-api/#request-detect-id-card-tampering with params:

json
{
    "image": {
        "id": "<frontCardId>"
    },
     "image2": {
        "id": "<backCardId>"
    },
    "qr1_images": [{
        "id": "<qrId>"
    }],
    "card_type": "<result.cardType.id>",
    "videos": [{
          "id": "<validFrontCardServerFrameBatchIds[index]>"
      },
      {
          "id": "<validFrontCardServerFrameBatchIds[index + 1]>"
      },
      ...
      {
          "id": "<validBackCardServerFrameBatchIds[index]>"
      },
      {
          "id": "<validBackCardServerFrameBatchIds[index + 1]>"
      },
      ...
    ]
}

3.0.5. Scan NFC

After capture the back card, if the card has nfc chip, SDK will call readIdCardNumber method in background thread. With image that returned by readIdCardNumber, call api to detect id number of the card then return id number to start flow scan NFC. If id number is null or empty, SDK skip flow scan NFC and continue

swift
readIdCardNumber: { [weak self] (image) in
  var idNumber = ""
  // call api or do any thing to read and return id number
  // TODO
  return idNumber
}

3.1. 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.

3.1.1. Set config parameters

swift
let config = TVSelfieConfiguration(
                cameraOption: TVCameraOption.front,
                isSoundEnable: true,
                skipConfirmScreen: true,
                livenessMode: TVLivenessMode.flash_16,
                isSanityRequired: true,
                isEnableVerifyLiveness: true,
                isEnableUploadFrames: true,
                isEnableUploadImages: true,
                isEnableExitConfirmPopup: false)

Options:

  • cameraOption: TVCameraOption. Set the camera mode
  • isSoundEnable: Bool. Sound should be played or not
  • skipConfirmScreen: Bool. Skip selfie capturing confirmation screen or not
  • livenessMode: TVLivenessMode. Set the liveness verification mode
  • isSanityRequired: Bool. Enable sanity check or not. If it's true then the SDK will call the API to check the sanity of the selfie.
  • isEnableVerifyLiveness: Bool. Enable liveness verification or not. If it's true then the SDK will call the API to verify the liveness of the selfie.
  • isEnableUploadFrames: Bool. Enable upload video frames or not. If it's false then the SDK won't call the API to upload the frames and the APIs that need the video frames will be skipped or called with empty frames data.
  • isEnableUploadImages: Bool. Enable upload images or not. If it's false then the SDK won't call the API to upload the images and the APIs that need the image will be skipped.
  • isEnableExitConfirmPopup: Bool. Enable exit confirm popup or not. If it's true then the SDK will show the exit confirm popup when the user tries to exit the selfie capturing activity.

3.1.2. Start selfie capturing from configuration

swift
let vc = TrustVisionSdk.shared.startSelfieCapturing(configuration: config,
framesRecordedCallback: { batchId, frames, metadata, currentBatchIds in

}, success: { (result) in

}, failure: { (error) in

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

where:

  • configuration: TVSelfieConfiguration

  • framesRecordedCallback:

    • batchId: String. new coming local batch id
    • frames: Dictionary. batch frame to push
    • metadata: Dictionary. batch metadata to push
    • currentBatchIds [String]. For debugging only

    This callback will be called each time there is a new frame batch coming. Client upload and get the batch id which is used for later selfie liveness api call.

  • success method that will be called in case success. Parameters:

    • result : TVDetectionResult . Use the following fields:
      • selfieImages: [TVGestureImage]. List images includes frontal and gesture faces.
      • livenessFrameBatchIds: [String]. List valid frame batch id in liveness.
      • faces: [TVImageClass]. List images includes frontal faces.
      • gestureFaces: [TVGestureFace]. List images includes gesture faces.
  • failure: FailureCallback

  • cancellation: CancellationCallback

3.1.3. Handle framesRecordedCallback callback

With each batch that returned by framesRecordedCallback callback, call the below api to get server frame batch id, keep it corresponds to batchId returned in framesRecordedCallback - local id https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-videoaudioframes

For example:

swift
  // this dictionary will be used for Liveness verification
  var selfieFrameBatchIdsDictionary: [String: String] = [:]
  . . .
  framesRecordedCallback = { batchId, frames, metadata, currentBatchIds in
    let batchDict = frames.merging(["metadata": metadata, "label": "video"]) { $1 }
    let jsonToBeUploaded = try JSONSerialization.data(withJSONObject: batchDict, options: .prettyPrinted)
    // upload frame batch to server using this api:
    // https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-videoaudioframes
    doYourUploadFrameBatchHere(withJSON: jsonToBeUploaded) { uploadingResult in
        // Keep the id that generated by the SDK corresponding with the one responded from server
        selfieFrameBatchIdsDictionary.updateValue(uploadingResult.fileId, forKey: batchId)
    }
  }

3.1.4. Handle selfie capturing results

3.1.4.1. Remove redundant frame batch ids

For example:

swift
// These lists contain all valid frame batch ids that responded by server
var validServerFrameBatchIds: [String] = []
private func removeRedudantFrameBatchIds(batchIdsDictionary: [String: String], validIdsFromSDK: [String]) -> [String] {
    return batchIdsDictionary.compactMap({
        if validIdsFromSDK.contains($0.key) {
            return $0.value
        }
        else {
            return nil
        }
    })
}
. . .
success = { result in
    // result.livenessFrameBatchIds is empty when Frame Recording feature is disabled by client settings.
    // Wait until every Frame batch has been uploaded to server before calling this
    if(everyFrameBatchUploadingCompleted) {
        if (!result.livenessFrameBatchIds.isEmpty) {
            validServerFrameBatchIds = removeRedudantFrameBatchIds(selfieFrameBatchIdsDictionary, result.livenessFrameBatchIds)
        }
    }
}
3.1.4.2 . Use this api to get image id:

https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-image The images should be uploaded as JPEG data with 100% quality. For example:

swift
// with frontal images
let dataToUpload = result.selfieImages[i].frontalImage.imageByteArray

// with gesture images
let dataToUpload = result.selfieImages[i].gestureImage.imageByteArray

id of frontal image i = image id of result.selfieImages[i].frontalImage.imageByteArray id of gesture image i = image id of result.selfieImages[i].gestureImage.imageByteArray

3.1.4.3. Use this api to get video id:

https://ekyc.trustingsocial.com/api-reference/customer-api/#upload-videoaudioframes id of selfie video i = video id of result.livenessVideos[i]

3.1.4.4. Call this api to check liveness

API document: https://ekyc.trustingsocial.com/api-reference/customer-api/#verify-face-liveness

Call the above api with below parameters:

  1. images field
json
{
  "images": [
    {
      "id": "<result.selfieImages[index].frontalImage.imageId>"
    },
    {
      "id": "<result.selfieImages[index + 1].frontalImage.imageId>"
    },
    ...
  ]
}
  1. gesture_images field
json
{
  "gesture_images": [
    {
      "gesture": "<result.selfieImages[index].gestureType.description>",
      "images": [{
          "id":  "<result.selfieImages[index].gestureImage.imageId>"
      }]
    },
    {
      "gesture": "<result.selfieImages[index + 1].gestureType.description>",
      "images": [{
          "id":  "<result.selfieImages[index + 1].gestureImage.imageId>"
      }]
    },
    ...
  ]
}
  1. videos field
json
{
  "videos": [
    {
      "id": "<validServerFrameBatchIds[index]>"
    },
    {
      "id": "<validServerFrameBatchIds[index + 1]>"
    },
    ...
  ]
}
  1. metadata field
json
{
  "metadata": "<result.livenessMetadata>"
}

3.2. Scan QR

The QR scanning activity will show the camera to scan image, preview the image. To start the QR scanning activity.

3.2.1. Set config parameters

swift
let config = TVQRConfiguration(
    cardTypes: [TVCardType],
    cardSide: TVIdCardConfiguration.TVCardSide.front,
    skipConfirmScreen: true,
    isEnableUploadFrames: false,
    isEnableUploadImages: false
)

Options:

  • cardTypes: [TVCardType]. Card types are allowed to capture. List of supported cards can be found in this table:
card_typedescriptionsupported countries
TVCardType.defaultVnCardType()Any of Vietnam national ID versionsvietnam
TVCardType.cmnd()Chứng minh nhân dân cũvietnam
TVCardType.cmndNew()Chứng minh nhân dân mớivietnam
TVCardType.cccd()Căn cước công dânvietnam
TVCardType.cccdNew()Căn cước công dân gắn chipvietnam
TVCardType.passport()Vietnam passportvietnam
  • cardSide: TVCardSide. Card side to capture
  • skipConfirmScreen: Bool. Skip id capturing confirmation screen nor not
  • isEnableUploadFrames: Bool. Enable upload video frames or not. If it's false then the SDK won't call the API to upload the frames and the APIs that need the video frames will be skipped or called with empty frames data.
  • isEnableUploadImages: Bool. Enable upload images or not. If it's false then the SDK won't call the API to upload the images and the APIs that need the image will be skipped.

3.2.2. Start QR scanning from configuration

swift
let vc = TrustVisionSdk.shared.startQRScanning(configuration: config, success: { (result) in

}, failure: { (error) in

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

where:

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

3.3. Scan NFC

The NFC scanner activity will show the guideline screen, the scanner popup. To start the NFC scanner activity.

3.3.1 Add NFC Capability

alt text

3.3.2. Set config Info.plist

<key>NFCReaderUsageDescription</key>
<string>This app would like to use NFC to scan CCCD chip</string>

<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
    <array>
        <string>A0000002471001</string>
        <string>A0000002472001</string>
        <string>00000000000000</string>
    </array>

3.3.3. Set config parameters

swift
let config = TVIdNfcConfiguration(
    nfcCode: nfcCode,
    nfcSod: sod,
    cardIssueDate: issueDate,
    nfcCacheFields: nfcCacheFields,
    isRequestReadImageNfc: true,
    isRequestCloneDetectionNfc: true,
    isRequestIntegrityCheckNfc: true,
    nfcMaxRetries: 5,
    isEnableCheckNfcData: true,
    isEnableVerifyNfc: true,
    dateOfBirth:  "dd/MM/yyyy",
    dateOfExpiry : "dd/MM/yyyy"
)

Options:

  • nfcCode: String is the id number of ID card
  • nfcSod: String (optional) is the hash of SOD
  • cardIssueDate: String (optional) is the issue date of ID card (DD/MM/YYYY)
  • nfcCacheFields: List<String> (optional) is the list of fields that was cached from previous scanning
  • isRequestReadImageNfc: Bool. Read image in the chip when scan nfc or not
  • isRequestCloneDetectionNfc: Bool. Check clone of the chip when scanning nfc or not
  • isRequestIntegrityCheckNfc: Bool. Check integrity of the chip when scanning nfc or not
  • nfcMaxRetries: Int. The maximum number of times the SDK retries an NFC scanning before giving up
  • isEnableCheckNfcData: Bool. Enable check NFC data or not. If it's true then the SDK will call the API to get sod and cached fields of the NFC data.
  • isEnableVerifyNfc: Bool. Enable verify NFC or not. If it's true then the SDK will call the API to verify the NFC data.
  • dateOfBirth: String? (required) is the date of birth (dd/MM/yyyy)
  • dateOfExpiry: String? (required) is the expired of ID card (dd/MM/yyyy). For cards with unlimited expiration, please input: 31/12/9999

3.3.4. Start NFC scanning from configuration

swift
let vc = TrustVisionSdk.shared.startNfcScanning(configuration: config, success: { (result) in

}, failure: { (error) in

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

where:

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

3.4. Face authentication

The face authentication activity will show the camera to capture the face, preview the image.

3.4.1. Set config parameters

swift
let authenConfigurationComponents = TVAuthenConfigurationComponents(
    selfieConfig: selfieConfig,
    cardConfig: cardConfig,
    nfcConfig: nfcConfig)

let config = TVFaceAuthenConfiguration(
    type: TVFaceAuthenType.register,
    userId: "user_id",
    method: TVFaceAuthenMethod.active,
    authenConfigurationComponents: authenConfigurationComponents,
    isEnableFaceAuthentication: true,
    isEnableFaceRegistration: true
)

Options:

  • type: TVFaceAuthenType. Set the TVFaceAuthenType mode to register or authenticate.
  • userId: String is the user id
  • method: TVFaceAuthenMethod. Set the TVFaceAuthenMethod mode to authen.
  • authenConfigurationComponents: TVAuthenConfigurationComponents. Set up the configurations. Use the following fields:
    • selfieConfig: TVSelfieConfiguration (optional): set it if you want to use selfie capturing in face authentication.
    • cardConfig: TVIdCardConfiguration (optional): set it if you want to use scan nfc in face authentication.
    • nfcConfig: TVIdNfcConfiguration (optional): set it if you want to use scan nfc in face authentication.
  • isEnableFaceAuthentication: Bool. Enable call API face authentication or not
  • isEnableFaceRegistration: Bool. Enable call API face registration or not

3.4.2. Start face authentication from configuration

swift
let vc = try TrustVisionSdk.shared.startFaceAuthen(
config: config,
framesRecordedCallback: { batchId, frames, metadata, currentBatchIds in

},
onLoading: {
},
success: { [weak self] (result) in

},
failure: { (error) in

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

where:

  • config: TVFaceAuthenConfiguration

  • framesRecordedCallback:

    • batchId: String. new coming local batch id
    • frames: Dictionary. batch frame to push
    • metadata: Dictionary. batch metadata to push
    • currentBatchIds [String]. For debugging only

    This callback will be called each time there is a new frame batch coming.

  • onLoading: the callback provides the loading screen at the host app when the SDK is processing for request face authentication.

  • success: method that will be called in case success for register. Parameters:

    • result: TVDetectionResult. Use the following fields:
      • faceAuthRegisterResult: TVFaceAuthRegisterResult.
      • faceAuthResult: TVFaceAuthResult.
  • failure: FailureCallback

  • cancellation: CancellationCallback

3.4.3. Sample code

Note: Sample code for face authentication in the case of initializing the SDK with the parameters endpoint, accessKeyId, and accessKeySecret.

swift
// Define configs as you need. Example:
let selfieConfig = TVSelfieConfiguration(
                cameraOption: .front,
                isSoundEnable: true,
                skipConfirmScreen: true,
                livenessMode: .active,
                isSanityRequired: false,
                isEnableVerifyLiveness: false,
                isEnableUploadFrames: false,
                isEnableUploadImages: false
            )
let cardConfig = TVIdCardConfiguration(
                cardTypes: [TVCardType.id],
                cardSide: .front,
                isSoundEnable: true,
                isReadBothSide: false,
                idTamperingLevel: nil,
                skipConfirmScreen: false,
                idCaptureOnlyMode: false,
                isEnablePhotoGalleryPicker: false,
                isEnableScanQr: true,
                isEnableScanNfc: true,
                isEnableVerifyNfc: true,
                isSanityRequired: false,
                isIdCardTamperingDetectionEnable: false,
                isEnableReadCardInfo: false,
                isEnableUploadFrames: true,
                isEnableUploadImages: true
            )
let nfcConfig = TVIdConfirmationTheme(
                nfcCode: "nfc_code",
                nfcSod: "nfc_sod",
                cardIssueDate: "card_issue_date",
                nfcCacheFields: ["nfc_cache_field"],
                isRequestReadImageNfc: true,
                isRequestCloneDetectionNfc: true,
                isRequestIntegrityCheckNfc: true,
                nfcMaxRetries: 5,
                isEnableCheckNfcData: true,
                isEnableVerifyNfc: true
            )
// Set up config for face authentication
let authenConfigurationComponents = TVAuthenConfigurationComponents(
                selfieConfig: selfieConfig,
                cardConfig: cardConfig,
                nfcConfig: nfcConfig)

let config = TVFaceAuthenConfiguration(
                type: .register,
                userId: cusUserId,
                method: TVFaceAuthSession.shared.registerFaceMethod,
                authenConfigurationComponents: authenConfigurationComponents,
                isEnableFaceAuthentication: false,
                isEnableFaceRegistration: false
            )

// Start face authentication
TrustVisionSdk.shared.startFaceAuthen(
    config: config,
    framesRecordedCallback: { batchId, frames, metadata, currentBatchIds in
        // Handle frame recorded callback
    },
    onLoading: {
        // Handle loading screen at your side when the SDK is processing for request face authentication
        // Leave it if you do need it, do not forget to stop loading after the SDK returns success, failed, or canceled
    },
    success: { [weak self] (result) in
        // Handle success
        self?.handleSuccessFaceAuthen(result)
    },
    failure: { (error) in
        // Handle failure
    },
    cancellation: { (cancellation) in
        // Handle cancellation
    }

func handleSuccessFaceAuthen(_ result: TVDetectionResult) {
    var selfieImages = result.selfieImages
    let videos: [TVRequestVideo] = result.livenessFrameBatchIds.map{TVRequestVideo(id: $0)}
    var faces : [TVRequestImage] = result.faces.map{TVRequestImage(id: $0.imageId)}
    var gestures : [TVGestureFace] = result.gestureFaces.map{TVGestureFace(gesture: $0.gestureType.description.lowercased(), images: [TVRequestImage(id: $0.gestureImage.imageId)])

    // call api to verify face authentication
    // https://ekyc.trustingsocial.com/api-reference/customer-api#request-face-authentication
    let faceAuthenRequest = TVRequestFaceAuthen(
        cusUserId
        images: faces,
        gestureImages: gestures,
        videos: videos,
        "selfie",
        "transfer"
    )
    yourMethodToCallFaceAuthenticationAPI(request)
}

3.5. Error handling

// [FlowStartingFunc]: startIdCapturing, startSelfieCapturing, startQRScanning, startNfcScanning, startFaceAuthen

swift
TrustVisionSdk.shared.[FlowStartingFunc]
   (config: ...,
   error: { [weak self] error in
   // Handle error
    self?.handleError(error)
   })

func handleError(_ error: TVError) {
    switch error.category {
    case .local:
        // Handle SDK error
        switch error.errorCode {
        case "unidentified":
            // unidentified error (general)
        case "authentication_missing_error":
            // sdk is not initialized
        case "sdk_canceled":
            // sdk is canceled by user
        case "permission_missing_error":
            // permission missing error (example: camera permission)
        case "setupSDK":
            // fail to set up sdk
        case "max_retry_reached":
           // When the SDK reaches the maximum timeout, this only applies to FlashLiveness

        default:
            // Handle other local errors
        }
    case .server:
        // Handle server error
        // The SDK has an unexpected error when calling API
        // https://ekyc.trustingsocial.com/api-reference/customer-api#response-errors
    }
}

4. Additional built-in API

The SDK provides some built-in API for quick detection

4.0. Detect if device support NFC

Allow users to quick check if device support NFC so that they can determine for their next step

swift
TrustVisionSdk.shared.isNfcSupport() -> Bool

4.1. Get Device Info

Allow users to get device information: TVDeviceInfoProvider

Swift
 let deviceInfo =  TrustVisionSdk.shared.getDeviceInfo()

TVDeviceInfoProvider contains following properties (will return nil if SDK cannot get information of that property)

PropertyTypeDescription
idStringDevice Id
udidStringSame as above, Unique Device Id
snStringSerial Number
imeiStringIMEI
manufacturerStringManufacturer
deviceNameStringDevice name
wlanMacStringWireless mac address
phoneNumberStringCurrent Phone Number
locationLocationInfoLocation information {longitude, latitude}

LocationInfo contains following properties (will return empty string if SDK cannot get information of that property) Please request location permission from your app first.

PropertyType
longitudeString
latitudeString

API references

1. TVDetectionResult

PropertiesTypedescription
frontIdImageTVImageClassImage of id card's front side (use field imageByteArray)
backIdImage TVImageClassImage of id card's back side (use field imageByteArray)
frontIdQrTVCardQrInfo of QR of id card's front side
backIdQr TVCardQrInfo of QR of id card's back side
frontCardFrameBatchIds [String]List of front id frame batch IDs
backCardFrameBatchIds [String]List of back id frame batch IDs
nfcInfoResult TVNfcInfoResultInfo in nfc chip. Use it to call api verify NFC
PropertiesTypedescription
livenessResult TVLivenessResultLiveness check result
selfieImages [TVGestureImage]Images of selfie
livenessFrameBatchIds [String]List of selfie frame batch IDs
livenessVideos [Data]List of video data during checking liveness
livenessMetadata[String: Any]?Collected data during liveness checking process

2. TVGestureImage

  • gestureType: GestureType
  • frontalImage: TVImageClass
  • gestureImage: TVImageClass

3. TVGestureImage.GestureType

  • up
  • down
  • left
  • right
  • 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.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...
  • TVLivenessMode.flash: Use challenge-response approach. User needs to follow and finish all steps when capturing selfie like far, close, flash... (for flash mode)
  • TVLivenessMode.flashEdge: Same with TVLivenessMode.flash, but with flashEdge mode.
  • TVLivenessMode.flashAdvanced: Same with TVLivenessMode.flash, but with flashAdvanced mode.
  • TVLivenessMode.flash8: Same with TVLivenessMode.flash, but with flash_8 mode.
  • TVLivenessMode.flash16: Same with TVLivenessMode.flash, but with flash_16 mode.
  • TVLivenessMode.flash32: Same with TVLivenessMode.flash, but with flash_32 mode.

6. TVLivenessResult

  • isLive: selfie is live or not

7. TVCardQr

  • isRequired: This side of card contains QR or not
  • images: [TVImageClass]. Array of QR images

8. 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

9. CancellationCallback (Callback)

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

10. TVNfcInfoResult

PropertiesTypeDescription
comString
sodString
dg1String
dg2String
dg13String
dg14String
dg15String
getCloneStatus()TVNfcVerificationResultStatus

11. TVNfcVerificationResultStatus

PropertiesTypeDescription
errorTVError
verdictTVNfcVerdictTVNfcVerdict.notChecked
TVNfcVerdict.alert
TVNfcVerdict.good
TVNfcVerdict.error

12. TVFaceAuthRegisterResult

PropertiesTypeDescription
requestIdString
statusStringsuccess, failure

13. TVFaceAuthResult

PropertiesTypeDescription
requestIdString
statusStringsuccess, failure
matchResultTVCompareFacesResult.MatchResult.matchedTVCompareFacesResult.MatchResult.matched
TVCompareFacesResult.MatchResult.unmatched
TVCompareFacesResult.MatchResult.unsure
scoreFloat

14. TVFaceAuthenMethod (Enum)

  • TVFaceAuthenMethod.passive: Use face authentication with passive mode.
  • TVFaceAuthenMethod.active: Use face authentication with active mode.
  • TVFaceAuthenMethod.nfc: Use face authentication with nfc.
  • TVFaceAuthenMethod.flashEdge: Use face authentication with edge flash.
  • TVFaceAuthenMethod.flashAdvanced: Use face authentication with advanced flash.
  • TVFaceAuthenMethod.light: Use face authentication with light mode.
  • TVFaceAuthenMethod.flash: Use face authentication with flash mode.
  • TVFaceAuthenMethod.flash8: Use face authentication with flash_8 mode.
  • TVFaceAuthenMethod.flash16: Use face authentication with flash_16 mode.
  • TVFaceAuthenMethod.flash32: Use face authentication with flash_32 mode.

15. TVFaceAuthenType (Enum)

  • TVFaceAuthenType.register: Use face authentication for registering.
  • TVFaceAuthenType.authen: Use face authentication for authenticating.

16. TVGestureFace

  • gestureType: GestureType
  • gestureImage: TVImageClass

UI Customization

This document introduces how to enable the ability to customize UI components of TrustingVision SDK.

Default UI prototypes

Check out the default UI of TrustingVision SDK. We provide you the ability to change and modify many UI components: background colors, font interfaces, font sizes, icons, buttons.

Before initialize the SDK

Initialize and change properties of TVTheme class. If any of which is not set, it will get default value.

TVTheme let you custom and override attributes, which includes:

Properties/FunctionsTypeDescription
idCapturingThemeTVIdCapturingThemeAttributes that change the UI of ID Card Detection screen.
idConfirmationThemeTVIdConfirmationThemeAttributes that change the UI of ID Confirmation screen.
selfieCapturingThemeTVSelfieCapturingThemeAttributes that change the UI of Selfie Capturing screen.
selfieConfirmationThemeTVSelfieConfirmationThemeAttributes that change the UI of Selfie Confirmation screen.
qrGuidelinePopupThemeTVQrPopupThemeModifying UI of QR guildline popup.
qrRetryPopupThemeTVQrPopupThemeModifying UI of QR retry popup.
clone()() -> TVThemeA function that returns a deep copy of TVTheme's instance itself.

Common UI components

Object TVThemeDefaultValues helps you to quickly change some common UI components that will be used across the whole SDK.

In case a specific Screen's theme is set, it will override TVThemeDefaultValues's properties.

PropertiesTypeDescription
normalLabelThemeTVLabelThemeNormal text of SDK.
titleLabelThemeTVLabelThemeThe title of any screen (located on the top-most, centered of screen).
errorLabelThemeTVLabelThemeThis text is shown as if any user misconduction or system failure occurred during the detection process.
instructionLabelThemeTVLabelThemeInstruction text.
timeoutLabelThemeTVLabelThemeThe count down text.

The object TVLabelTheme can be described in this table below:

Properties/FunctionsTypeLabel's
fontUIFontfont interface, weight, size
textColorUIColortext color
textGravityNSTextAlignmenttext alignment of its frame
backgroundColorsArray of UIColorbackground colors. If total element of this array is 1, the background color is solid.
isBackgroundGradientHorizontalBoolbackground gradient direction
cornerRadiusCGFloatrounded corner
isHiddenBoolhide the label
borderWidthCGFloatborder width
borderColorUIColorborder color
clone()() -> TVLabelThemeA function that returns a deep copy of TVLabelTheme's instance itself.

Here is snipped code example:

swift
    //Change default value for all screen
    TVThemeDefaultValue.titleLabelTheme = TVLabelTheme(
        font: .systemFont(ofSize: 16.0, weight: .regular),
        textColor: .yellow, textGravity: .center,
        backgroundColors: [.cyan],
        isBackgroundGradientHorizontal: false,
        cornerRadius: 8.0, isHidden: false,
        borderWidth: 4.0,
        borderColor: .brown)
    TVThemeDefaultValue.errorLabelTheme = TVLabelTheme(
        font: .systemFont(ofSize: 14.0, weight: .bold),
        textColor: .red,
        textGravity: .center,
        backgroundColors: [.orange],
        isBackgroundGradientHorizontal: false,
        cornerRadius: 8.0,
        isHidden: false,
        borderWidth: 0.0,
        borderColor: .brown)
    TVThemeDefaultValue.instructionLabelTheme = TVLabelTheme(
        font: .systemFont(ofSize: 14.0, weight: .regular),
        textColor: .blue,
        textGravity: .center,
        backgroundColors: [.white],
        isBackgroundGradientHorizontal: false,
        cornerRadius: 8.0,
        isHidden: false,
        borderWidth: 4.0,
        borderColor: .brown)
    TVThemeDefaultValue.timeoutLabelTheme = TVLabelTheme(
        font: .systemFont(ofSize: 14.0, weight: .regular),
        textColor: .red,
        textGravity: .center,
        backgroundColors: [],
        isBackgroundGradientHorizontal: false,
        cornerRadius: 0,
        isHidden: true,
        borderWidth: 0,
        borderColor: .brown)

    // Init theme
    theme = TVTheme()

    // Specific change for ID Capturing Screen
    theme.idCapturingTheme.instructionLabelTheme = TVLabelTheme(font: .systemFont(ofSize: 14.0, weight: .bold), textColor: .yellow, textGravity: .center, backgroundColors: [.darkGray], isBackgroundGradientHorizontal: false, cornerRadius: 8.0, isHidden: false)
    theme.idCapturingTheme.showTrademark = false
    theme.idCapturingTheme.backgroundColor = .lightGray
    theme.idCapturingTheme.qrMaskViewSuccessImage = UIImage(named: "QR normal mask view")!
    theme.idCapturingTheme.qrMaskViewErrorImage = UIImage(named: "QR normal mask view2")!
    theme.idCapturingTheme.qrMaskViewNeutralImage = UIImage(named: "QR normal mask view1")!
    theme.idCapturingTheme.maskViewErrorImage = UIImage(named: "id_card_error_bg")!
    theme.idCapturingTheme.maskViewNeutralImage = UIImage(named: "id_card_bg_front")!
    theme.idCapturingTheme.maskViewSuccessImage = UIImage(named: "id_card_success_bg")!

    // Specific change for ID Confirmation Screen
    theme.idConfirmationTheme.icQrResultErrorImage = UIImage(named: "icon_qr_describe_1")!
    theme.idConfirmationTheme.icQrResultSuccessImage = UIImage(named: "icon_qr_describe_2")!
    theme.idConfirmationTheme.backgroundColor = .yellow

    // Specific change for Selfie Capturing Screen
    theme.selfieCapturingTheme.backgroundColor = .lightText
    theme.selfieCapturingTheme.instructionLabelTheme = TVLabelTheme(font: .systemFont(ofSize: 14.0, weight: .bold), textColor: .yellow, textGravity: .center, backgroundColors: [.darkGray], isBackgroundGradientHorizontal: false, cornerRadius: 8.0, isHidden: false)
    theme.selfieCapturingTheme.maskViewSuccessImage = UIImage(named: "selfie_bg_no_sticks_focus success")!
    theme.selfieCapturingTheme.maskViewNeutralImage = UIImage(named: "selfie_bg_no_sticks_focus normal")!
    theme.selfieCapturingTheme.maskViewErrorImage = UIImage(named: "selfie_bg_no_sticks_focus error")!
    theme.selfieCapturingTheme.progressTheme.progressColor = .clear
    theme.selfieCapturingTheme.gestureTheme.turnUpActiveImage = UIImage(named: "liveness_up")!
    theme.selfieCapturingTheme.gestureTheme.turnDownActiveImage = UIImage(named: "liveness_down")!
    theme.selfieCapturingTheme.gestureTheme.turnLeftActiveImage = UIImage(named: "liveness_left")!
    theme.selfieCapturingTheme.gestureTheme.turnRightActiveImage = UIImage(named: "liveness_right")!
    theme.selfieCapturingTheme.gestureTheme.lookStraightActiveImage = UIImage(named: "liveness_opposite")!

ID Card Detection: UI customization

alt text

Class TVIdCapturingTheme

If a property is not set, default value will be used.

PropertiesTypeDescription
titleLabelThemeTVLabelThemeSee Common UI components section.
instructionLabelThemeTVLabelTheme
errorLabelThemeTVLabelTheme
timeoutLabelThemeTVLabelTheme
normalLabelThemeTVLabelTheme
qrInstructionLabelThemeTVLabelThemeThe instruction text that show during QR scanning process.
closeButtonLocationenumTVButtonLocationThe position of close button to device orientation:
.TOP_LEFT: to the left of the title
.TOP_RIGHT: to the right of the title
.NONE: hide the button
showTrademarkBoolShow the trademark text or not.
backgroundColorUIColorSets the background color of view. Default value is black with 60% opacity.
captureButtonImageUIImageThe image of the capture button.
captureButtonDisableImageUIImageThe image of the disabled capture button.
closeButtonImageUIImageThe image of the close view button.
maskViewNeutralImageUIImageThe mask image of camera view when start the ID Capture flow.
maskViewSuccessImageUIImageThe mask image of camera view when detected a valid ID card.
maskViewErrorImageUIImageThe mask image of camera view when cannot detect any ID card.
qrInstructionBackgroundImageUIImageThe image behind the QR instruction text.
qrMaskViewNeutralImageUIImageThe mask image of camera view when start QR detection or not detected any QR code.
qrMaskViewSuccessImageUIImageThe mask image of camera view when detected a valid QR code.
qrMaskViewErrorImageUIImageThe mask image of camera view when detected an invalid QR code.
loadingImageUIImageLoading indicator in image.
clone()() -> TVIdCapturingThemeA function that returns a deep copy of TVIdCapturingTheme's instance itself.

ID Card Confirmation: UI customization

alt text

Class TVIdConfirmationTheme

If a property is not set, default value will be used.

PropertiesTypeDescription
titleLabelThemeTVLabelThemeSee Common UI components section.
errorLabelThemeTVLabelTheme
normalLabelThemeTVLabelTheme
closeButtonLocationenumTVButtonLocationThe position of close button to device orientation:
.TOP_LEFT: to the left of the title
.TOP_RIGHT: to the right of the title
.NONE: hide the button
showTrademarkBoolShow the trademark text or not.
backgroundColorUIColorSets the background color of view. Default value is black with 60% opacity.
closeButtonImageUIImageThe image of the close view button.
confirmButtonImageUIImageThe image of the "Look good" button.
retryButtonImageUIImageThe image of the "Try again" button.
icQrResultSuccessImageUIImageIcon before text that scanned QR successfully.
icQrResultErrorImageUIImageIcon before text that scanned QR failed.
maskViewImageUIImageThe mask image of camera view showing captured image.
loadingImageUIImageLoading indicator in image.
clone()() -> TVIdConfirmationThemeA function that returns a deep copy of TVIdConfirmationTheme's instance itself.

Selfie Capturing: UI customization

alt text

Class TVSelfieCapturingTheme

If a property is not set, default value will be used.

PropertiesTypeDescription
titleLabelThemeTVLabelThemeSee Common UI components section.
instructionLabelThemeTVLabelTheme
errorLabelThemeTVLabelTheme
timeoutLabelThemeTVLabelTheme
normalLabelThemeTVLabelTheme
closeButtonLocationenumTVButtonLocationThe position of close button to device orientation:
.TOP_LEFT: to the left of the title
.TOP_RIGHT: to the right of the title
.NONE: hide the button
showTrademarkBoolShow the trademark text or not.
backgroundColorUIColorSets the background color of view. Default value is black with 60% opacity.
captureButtonImageUIImageThe image of the capture button.
captureButtonDisableImageUIImageThe image of the disabled capture button.
closeButtonImageUIImageThe image of the close view button.
switchCameraSideImage UIImageThe image of switch camera button.
maskViewNeutralImageUIImageThe mask image of camera view when start the selfie flow.
maskViewSuccessImage UIImageThe mask image of camera view when detected a valid face.
maskViewErrorImageUIImageThe mask image of camera view when cannot detect any valid face.
progressTheme.isHiddenBoolHide the current 4 steps view.
progressTheme.backgroundColorUIColorBackground color of the circle progress theme.
progressTheme.progressColorUIColorBackground color of the progress steps.
gestureTheme.isHiddenBoolWhether of not should hide selfie steps' group view.
gestureTheme.turnLeftActiveImageUIImageImage for turn left step gesture when active.
gestureTheme.turnRightActiveImageUIImageImage for turn right step gesture when active.
gestureTheme.turnUpActiveImageUIImageImage for turn up step gesture when active.
gestureTheme.turnDownActiveImageUIImageImage for turn down step gesture when active.
gestureTheme.lookStraightActiveImageUIImageImage for look straight step gesture when active.
gestureTheme.turnLeftInactiveImageUIImageImage for turn left step gesture when inactive.
gestureTheme.turnRightInactiveImageUIImageImage for turn right step gesture when inactive.
gestureTheme.turnUpInactiveImageUIImageImage for turn up step gesture when inactive.
gestureTheme.turnDownInactiveImageUIImageImage for turn down step gesture when inactive.
gestureTheme.lookStraightInactiveImageUIImageImage for look straight step gesture when inactive.
gestureTheme.finishedGestureBackgroundImageUIImageBackground for every step that completed.
gestureTheme.currentStepFocusImageUIImageImage overlay for current step indicator.
maskViewErrorImageUIImageThe mask image of camera view when cannot detect any valid face.
maskViewErrorImageUIImageThe mask image of camera view when cannot detect any valid face.
loadingImageUIImageLoading indicator in image.
clone()() -> TVSelfieCapturingThemeA function that returns a deep copy of TVSelfieCapturingTheme's instance itself.