SDK

Adding the SDK to your project

To add our SDK to your own application, you should add it to the build process of your application. Currently we support doing this using CocoaPods or Carthage.

CocoaPods: Adding the SDK to your Podfile

To add the repository to your project, open the Podfile, if it does not exists, first run pod init in the root of your project with Xcode closed.
Edit the target part of your application in the Podfile, so that it contains the following:

                    
pod 'Klippa-Identity-Verification', podspec: 'https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/latest.podspec'
                    
                

The full Podfile might look like this now:

                    
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'TestIdentityVerification' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TestIdentityVerification
  pod 'Klippa-Identity-Verification', podspec: 'https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/latest.podspec'

end
                    
                

When you run pod install now, it should download our library as dependency, and with that all dependencies of our library.
Note: this code always uses the latest version, you can also use a specific version to make sure the SDK won't update without your knowledge.

Carthage: Adding the SDK to your Cartfile

To add the repository to your project, open the Cartfile, if it does not exists, create a Cartfile alongside your .xcodeproj or .xcworkspace.
Add the following to your Cartfile:

                    
binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json"
                    
                

When you run carthage update now, it should download our library as dependency, and with that all dependencies of our library.
Note: this code always uses the latest version, you can also use a specific version to make sure the SDK won't update without your knowledge.

Updating Info.plist file

If you want to use the NFC capabilities inside of the Identity SDK please add the following to your Info.plist.

                
<key>NFCReaderUsageDescription</key>
<string>Your NFC usage description here.</string>
                    
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
<string>A0000002472001</string>
<string>00000000000000</string>
</array>
            
                

Also, add "Near Field Communication Tag Reading" capability to your app using the Signing & Capabilities pane of the project editor.

Creating sessions

Before you can start using the identity verification you need to generate a session token in your backend. You can then start the session using your newly generated token. Once the session has been completed you can collect the files and data read by the OCR.

Starting the identity verification

In the ViewController that you want to launch the identity verification, implement the IdentityBuilderDelegate:

Swift version

                    
// Add to the top of your file
import KlippaIdentityVerification

// Your class definition should look like this.
final class ExampleIdentityVerificationViewController: UIViewController, IdentityBuilderDelegate {

    // ... Rest of your controller code.

    func startIdentityVerification() {
        // @todo: get a session token from the API through your backend here.
        let builder = IdentityBuilder(builderDelegate: self, sessionKey: "{insert-session-token-here}")

        // Build returns a viewController UIViewController that you can present.
        let viewController = builder.build()
        self.present(viewController, animated: true, completion: nil)
    }

    func finishedWithSuccess(response: KIVResult) {
        print("finishedWithSuccess")
    }

    func canceled() {
        print("canceled")
    }

    func contactSupportPressed() {
        print("contactSupportPressed")
    }

    // ... Rest of your controller code.
}
                    
                

Objective-C version

                    
// Add to the top of your file
#import 

@interface ViewController ()

@end

// Your class definition should look like this.
@implementation ViewController
    // ... Rest of your controller code.

    - (IBAction)ButtonClick:(id)sender {
        [self startIdentityVerification];
    }

    - (void)startIdentityVerification {
        id builder = [[IdentityBuilder alloc] initWithBuilderDelegate:self sessionKey:@"{insert-token}"];

        // Build returns a viewController UIViewController that you can present.
        id viewController = [builder build];
        [self presentViewController:viewController animated:true completion:nil];
    }

    - (void)canceled {
        NSLog(@"canceled");
    }

    - (void)finishedWithSuccessWithResponse:(KIVResult * _Nonnull)response {
        NSLog(@"finishedWithSuccess");
    }

    - (void)contactSupportPressed {
        NSLog(@"contactSupportPressed");
    }

    // ... Rest of your controller code.
}
                    
                

In the place where you want to start the identity verification, for example after a button click, call the startIdentityVerification method:

                    
startIdentityVerification()
                    
                

Customizing the identity verification

The SDK has a few customizing settings, the following methods are available:

Swift version

                    
builder.hasIntroScreen = true
builder.hasSuccessScreen = true

builder.kivColors.textColor = UIColor.red
builder.kivColors.backgroundColor = UIColor.lightGray
builder.kivColors.buttonSuccessColor = UIColor.purple
builder.kivColors.buttonErrorColor = UIColor.red
builder.kivColors.buttonOtherColor = UIColor.lightGray
builder.kivColors.progressBarBackground = UIColor.lightGray
builder.kivColors.progressBarForeground = UIColor.orange

builder.kivFonts.fontName = "ComicSans"
builder.kivFonts.boldFontName = "ComicSans"

// We support English, Dutch and Spanish.
builder.kivLanguage = .Dutch

// The extracted data keys that will be shown to the user after document pictures are processed.
Default value:

builder.kivVerifyIncludeList = [
"DateOfBirth",
"DateOfIssue",
"DocumentNumber",
"DocumentSubtype",
"DocumentType",
"Face",
"Gender",
"GivenNames",
"Height",
"IssuingCountry",
"IssuingInstitution",
"Nationality",
"PersonalNumber",
"PlaceOfBirth",
"Residency",
"Signature",
"Surname"
]

// The extracted data keys that will be hidden for the user after document pictures are processed.
Default value (empty):
builder.kivVerifyExcludeList = []
                    
                

Objective-C version

                    
[builder setHasIntroScreen:true];
[builder setHasSuccessScreen:true];

[[builder kivColors] setTextColor: UIColor.redColor];
[[builder kivColors] setBackgroundColor: UIColor.lightGrayColor];
[[builder kivColors] setButtonSuccessColor: UIColor.purpleColor];
[[builder kivColors] setButtonErrorColor: UIColor.redColor];
[[builder kivColors] setButtonOtherColor: UIColor.lightGrayColor];
[[builder kivColors] setProgressBarBackground: UIColor.lightGrayColor];
[[builder kivColors] setProgressBarForeground: UIColor.orangeColor];

[[builder kivFonts] setFontName: @"ComicSans"];
[[builder kivFonts] setBoldFontName: @"ComicSans"];

// We support English, Dutch and Spanish.
[builder setKivLanguage:IdentityBuilderKIVLanguageDutch];

// The extracted data keys that will be shown to the user after document pictures are processed.
// Default value:

NSArray *kivVerifyIncludeList = @[
@"DateOfBirth", 
@"DateOfIssue", 
@"DocumentNumber", 
@"DocumentSubtype", 
@"DocumentType"
@"Face"
@"Gender"
@"GivenNames"
@"Height"
@"IssuingCountry"
@"IssuingInstitution"
@"Nationality"
@"PersonalNumber"
@"PlaceOfBirth"
@"Residency"
@"Signature"
@"Surname"];
[builder setKivVerifyIncludeList: kivVerifyIncludeList];

// The extracted data keys that will be hidden for the user after document pictures are processed.
// Default value (empty):
NSMutableArray *setKivVerifyExcludeList = [NSMutableArray new];
[builder setKivVerifyExcludeList: setKivVerifyExcludeList];
                    
                

SDK size

The dependency download size itself is 67.3MB when extracted, but it contains builds for multiple architectures, it depends on the architecture of the phone how much the SDK is going to add to the app size:

  • arm64: 32.2MB
  • x86_64-simulator: 35MB

Versions

The following versions are available:

Version Podspec include URL Cartfile dependency Binary download
0.5.9 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.9.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.9 Fat framework (.xcarchive) | XCFramework
0.5.8 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.8.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.8 Fat framework (.xcarchive) | XCFramework
0.5.7 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.7.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.7 Fat framework (.xcarchive) | XCFramework
0.5.6 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.6.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.6 Fat framework (.xcarchive) | XCFramework
0.5.5 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.5.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.5 Fat framework (.xcarchive) | XCFramework
0.5.4 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.4.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.4 Fat framework (.xcarchive) | XCFramework
0.5.3 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.3.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.3 Fat framework (.xcarchive) | XCFramework
0.5.2 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.2.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.2 Fat framework (.xcarchive) | XCFramework
0.5.1 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.1.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.1 Fat framework (.xcarchive) | XCFramework
0.5.0 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.5.0.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.5.0 Fat framework (.xcarchive) | XCFramework
0.4.0 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.4.0.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.4.0 Fat framework (.xcarchive) | XCFramework
0.3.0 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.3.0.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.3.0 Fat framework (.xcarchive) | XCFramework
0.2.0 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.2.0.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.2.0 Fat framework (.xcarchive) | XCFramework
0.1.1 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.1.1.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.1.1 Fat framework (.xcarchive) | XCFramework
0.1.0 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.1.0.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.1.0 Fat framework (.xcarchive) | XCFramework
0.0.7 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaIdentityVerification/0.0.7.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaIdentityVerification.json" == 0.0.7 Fat framework (.xcarchive) | XCFramework

Changelog

0.5.9

  • Temporarily disabled ID model detection.

0.5.8

  • Added model to detect ID for auto capture.
  • Fixed issue where background color of some icons (MRZ form) were not being set correctly.
  • Fixed issue where validation (MRZ form) could pass with whitespace characters.

0.5.7

  • Added ability to add MRZ manually instead of using MRZ scanner.

0.5.6

Fixed

  • Issue where failing an upload task could cause an infinite loop.

0.5.5

Fixed

  • Issue where SDK could crash after giving camera permission.

0.5.4

  • Fixed issue where the textColor was not being set correctly on some textFields.
  • We now return InsufficientPermission error if camera permissions were denied or are restricted.
  • Multiple validation errors can now be shown if necessary.

0.5.3

  • Added ability to disable ActiveLiveness detection by setting RequiredLivenessCount to 0.
  • Fixed issue where session could fail to start.
  • Fixed issue where some colors were not being set correctly.

0.5.2

  • Added field validations. Such as document type, residency, and age.
  • Fixed issue where SDK would throw an error if MatchDocumentSides was set to true.

0.5.1

  • Fixed issue where SDK could throw an error while uploading an identity document image.
  • Fixed issue where SDK could crash if camera stops while showing a warning message.

0.5.0

  • Added NFC Support. This can be enabled through the API by setting RequiredNFCScanCount to 1.

0.4.0

  • Added Active and Passive Liveness detection during the selfie step, users will now have to complete 2 tasks (tilting their head in x direction) before the selfie is automatically taken.
  • Upgraded minimum deployment requirement to iOS 13.0
  • Renamed finishedWithSuccess(response:) to identityVerificationFinished().
  • Renamed canceled() to identityVerificationCanceled(withError:).
  • Renamed contactSupportPressed() to identityVerificationContactSupportPressed().
  • Improved clarity in thrown error messages.

0.3.0

  • The RequiredFields option now enforces that fields are filled. A session cannot be completed successfully if one of the required fields is missing.
  • Increased quality of pictures taken.

0.2.0

  • Now uses production API by default (unless you’re making a test/debug build builder.isDebug = true). Please note that due to this change you will have also have to call the production API (https://custom-ocr.klippa.com) from your backend.

0.1.1

  • Added arm64 build for simulator to add support for M1 Macs. Please note that this only work in XCFrameworks (Cocoapods), and not in the fat framework, since you can only have one arm64 binary, and the device binaries already come with an arm64 binary.
  • Fixed bug where sdk would crash if no camera is available. The sdk now gracefully gets cancelled.

0.1.0

  • Adjusted document and selfie screen UI
  • Added callback for support button pressed contactSupportPressed()
  • Added ability to include/exclude data from data verification check screen with builder.kivVerifyIncludeList and builder.kivVerifyExcludeList

0.0.5

  • Return viewController in stead of presenting it ourself

0.0.4

  • Rename stuff to be used from ObjC

0.0.3

  • Fix classes that should be exposes to be reachable from ObjC
  • Always use test API for now

0.0.2

  • No changes

0.0.1

  • Initial version