TuIdentidadSDK (iOS) SDK v1.1.7

This library makes it possible to capture two images "INE Front" and "INE Back", which correspond to the two sides of the voter's credential. Send them to TuIdentidadSDK to verify the captured documents and issue the result. This document is specifically aimed at technical level users who require information about the TuIdentidad SDK.

1.1.7 Version improvements

  1. Improved request for validation and response delegation.

  2. Improved experience showing alert when images to validate have not been selected.

  3. The answer is complemented by adding new attributes of INE Service API v2

Requirements

XCode 11.2.1
IOS 10+
Arquitectura -armv7, arm64
CocoaPods

Project overview

Restrictions and assumptions

1) Cocoapods is used as the manager of this framework.

Previous clarifications

1) The Apikey must be requested with the provider.

Development

TuIdentidadSDK (IOS) was developed in Swift 5 and Xcode 11.2.1.

Cocoapods installation

1) If you are using the default version of Ruby on your Mac, you will have to use the sudo command.

$ gem install cocoapods
$ sudo gem install cocoapods

2) Enter the username and password credentials, this will raise the privileges of the "install" command and allow you to put the files in a protected folder.

Start using Cocoapods with TuIdentidadSDK

AlamoFire helps HTTP requests in Swift.

1) You need an Xcode project to start. Create a project or use an existing one.
2) Close your Xcode project, while Cocoapods is going to make changes to the project.
3) Open the terminal to the location of the folder that belongs to your Xcode project.
4) Enter pod init in the terminal.

$ pod init

Download framework

The text "TuIdentidadSDKDemo" is the name of the solution, the example shown below is the configuration file, necessary to download the framework.

# Uncomment the next line to define a global platform for your project  
platform :ios, '10.0'  
target 'TuIdentidadSDKDemo' do  
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
#TuIdentidad SDKs
  #SDK INE  
  pod 'TuIdentidadSDK', '~>1.1.7'
end  

1) Run the Cocoapods installer, it will take some time if it is the first time you install it:

$ pod install

2) Depending on how old your installation is, you may need to use the update command to get the current version. In case you happen to see the following error, check out the Fix problems section below.

Fix problems with Cocoapods

1) Try clearing the cache before you start.
2) Update Cocoapods or try reinstalling it.

Privacy configuration

Add the description of the NSCameraUsageDescription key ("Privacy - Camera Usage Description") in your info.plist file.
ex. 'This app use the camera to validate documents with pictures.'

Using TuIdentidadSDK/IdValidation

1) Import the TuIdentidadSDK library.

import TuIdentidadSDK

2) Call the delegate to get the validation result.

class ViewController: UIViewController, IDValidationDelegate

3) Delegate function where the result of the validation is obtained. INE method and corresponding IDVAL.

TUID.instantiateIDAuth(delegate: self, context: self, apikey: "Your-Api-Key", method: .INE, showResults: false, validateOptions: IDValidateOptions(checkInfo: true, checkQuality: true, checkPatterns: true, checkCurp: true, checkFace: true))
TUID.instantiateTuIdentidadSDK(delegate:self ,context: self, apikey: "Your-Api-Key”, method:
.IDVAL, showResults: false)

4) This function returns the result of the validation, it is a function built into the delegate.

// IDVAL and OnlyOCR delegate 
func getData(data: IDValidation) {  
    print(data)  
}  
// INE Method delegate  
func getINEData(data: IDValidationINE) {  
    debugPrint(data)  
}  
func error(response: String) {  
    debugPrint(response)  
}  

TuIdentidadSDK properties

delegate: The delegate is sent, which in this case would be the controller so that this view listens when the SDK obtains the results.
context: The context is sent from where the cell phone is sent to call.
apikey: Necessary to consume the API of TuIdentidadSDK (request activation with provider).

method: The SDK has one INE processing methods:

a) INE: New and improved INE + OCR validation service.

showResults: Boolean that indicates whether to show a viewController with the results. (Discontinued).

validateOptions: Validation options for the identification. It is recommended to put the values of 'checkInfo', 'checkQuality', 'checkPatterns' ‘CheckCurp’ ‘CheckFace’ in 'true'. only in case of consuming the CURP validation service identified in the document before RENAPO and 'checkFace' in case it is not required to validate the photograph of the person, default value 'true'.

SDK usage example

import UIKit  
import TuIdentidadSDK  
class ViewController: UIViewController, IDValidationDelegate {  
    override func viewDidLoad() {  
        super.viewDidLoad()  
        // Do any additional setup after loading the view.  
    }  
    override func viewDidAppear(_ animated: Bool) {  
        super.viewDidAppear(animated)  
        TUID.instantiateIDAuth(delegate: self, context: self, apikey: "Your-Api-Key", method: .INE, showResults: false, validateOptions: IDValidateOptions(checkInfo: true, checkQuality: true, checkPatterns: true, checkCurp: true, checkFace: true))  
    }  
    // MARK - TuIdentidadSDKDelegate  
    func getData(data: IDValidation) {  
        debugPrint(data)  
    }  
    func getINEData(data: IDValidationINE) {  
        debugPrint(data)  
    }  
    func error(response: String) {  
        debugPrint(response)  
    }
}