Skip to content

Latest commit

 

History

History
281 lines (219 loc) · 15.4 KB

README.md

File metadata and controls

281 lines (219 loc) · 15.4 KB

IDnow eID SDK

Table of Contents


Requirements

  • Xcode 14.3 or later
  • Deployment Target: iOS 11.0 or later (Note: NFC can work only with iPhone 7 or higher)

Installation

Download the latest version of the eID framework.

Host app configuration

  • Add the idnow_eid.framework and AuthadaAuthenticationLibrary.xcframework to your Xcode project files. NOTE:

    • Due to technical reasons, we cannot make the following library available on Github: AuthadaAuthenticationLibrary.xcframework. Please contact your customer success manager so that they can provide it to you.
  • Navigate to your project settings, select your build target and open Build Phases.

  • Add the idnow_eid.framework, CoreNFC.framework and AuthadaAuthenticationLibrary.xcframework to Link Binary With Libraries alt text

  • Make sure both AuthadaAuthenticationLibrary and idnow_eid frameworks are added in Embed Frameworks section.alt text

  • Add Near Field Communication Tag Reading as a capability. In the entitlements file, check if there is an array for the key Near Field Communication Tag Reader Session Format, make sure the array contains the entry NFC tag-specific data protocol. alt text

  • Update the Info.plist file:

    • Add an array with the key com.apple.developer.nfc.readersession.iso7816.select-identifiers / ISO7816 application identifiers for NFC Tag Reader Session. Then add 2 items to the array: E80704007F00070302, A0000002471001.
    • Add a description for Privacy - NFC Scan Usage Description alt text

Usage:

Step 1: Import the library into your source code.

Swift

import idnow_eid

Objective C

@import idnow_eid;

Step 2: Configure the apearance.

You can customize the SDK appearance by accessing the properties of the IDN_eIDAppearance class. The complete list of properties and possible values can be found here.

Swift

let eidAppearance = IDN_eIDAppearance.shared
eidAppearance.underlineButtonTitles = false
eidAppearance.fontNameBold          = "TimesNewRomanPS-BoldMT"
eidAppearance.fontNameRegular       = "TimesNewRomanPSMT"
eidAppearance.primaryBrandColor     = .cyan
eidAppearance.proceedButtonBackgroundColor = .magenta
eidAppearance.linkColor             = .systemBlue

Objective C

IDN_eIDAppearance *appearance = IDN_eIDAppearance.shared;
appearance.primaryBrandColor         = UIColor.cyanColor;
appearance.proceedButtonBackgroundColor = UIColor.magentaColor;
appearance.linkColor                 = UIColor.blueColor;
appearance.underlineButtonTitles     = false;
appearance.fontNameRegular           = @"TimesNewRomanPSMT";
appearance.fontNameBold              = @"TimesNewRomanPS-BoldMT";

Step 3: Obtain the ident token and configure the IDnowController same as for the regular VideoIdent flow. This is needed to properly instantiate the identification system. For details see the VideoIdent configuration.

Step 4: Once the initialization is finished, check for errors and proceed to the eID identification.

Swift

idnowController.initialize(completionBlock: {(success, error, canceledByUser) -> Void in
    if error != nil {
        // Handle the error
        return
    }        
    if canceledByUser {
        // Handle cancellation
    } else if success {
        // Initialize the eID flow (See step 5). Note: This should be used instead of the regular VideIdent flow.
    }           
})

Objective C

[self.idnowController initializeWithCompletionBlock:^(BOOL success, NSError *error, BOOL canceledByUser)
     {
        if (error)
        {
            // Handle the error
        }
        else if (success)
        {
            // Initialize the eID flow (See step 5). Note: This should be used instead of the regular VideIdent flow.
        }
        else if (cancelledByUser)
        {
            // Handle cancellation
        }
    }];

Step 5: Initialize the IDN_eIDRouter that will be responsible for showing the VideoIdent/eID chooser page and the subsequent identification flow.

Swift

guard let token = textField.text, !token.isEmpty else { 
        // input token validate
        return
    }
    eidRouter = IDN_eIDRouter(
        withControlller: self,
        token: token,  
        completion: { [unowned self] (support, error) in
            if support {
                self.eidRouter.present { 
                (identSuccess, continueVideoIdent, error) in
                    if continueVideoIdent { 
                        print("LOG: - Continue video identification")
                    } else if let error = error {
                        print("LOG: - Failed \(error)")
                    } else {
                        print("LOG: - Identification  \(identSuccess ? "Succeded" : "Failed")")
                    }
                }
            } else {
                print("LOG: - Device not support nfc ")
            }
    })

Objective C

self.eidRouter = [[IDN_eIDRouter alloc]
                  initWithControlller:self
                  token: token
                  completion:^(BOOL supported, NSError * error) {
    if (supported) { // device supported, and can continue eID
        [self.eidRouter present:^(BOOL success, BOOL
                                  continueVideoIdent,
                                  NSError * error) {
            if (continueVideoIdent) { // Start video ident
                NSLog(@"LOG: - Video identification");
            }
            else if (error) {
                NSLog(@"LOG: - Error %@", error.localizedDescription);
            } else {
                NSLog(@"LOG: - Identification %s",
                success ? "Succeded" : "Failed" );
            }
        }];
    } else {
        NSLog(@"LOG: - Device doesnot support");
    }
}];

Error codes

Swift Objective C Description
unsupportedNFC IDN_eIDErrorUnsupportedNFC The flow cannot be started because the device does not support NFC.
userCancelled IDN_eIDErrorUserCancelled The user cancelled the identification process manually.
invalidToken IDN_eIDErrorInvalidToken The supplied token is invalid.
preconditionFailed IDN_eIDErrorPreconditionFailed Some of the preconditions weren't met. This includes: expired ident code, already used ident code, etc.
tokenUnsupportElectronicCard IDN_eIDErrorTokenUnsupportElectronicCard The document used for the identification is unsupported.
unknown IDN_eIDErrorUnknown The process has failed with an undefined error.

Branding (IDN_eIDAppearance)

All appearance settings are identical to the ones used in VI SDK.

Colors

Parameter name Description Appearance
defaultTextColor Optional color that replaces the default text color.
Default: #000000 #000000
Recommendation: Should be some kind of a dark color that does not collide with white color.
secondaryTextColor Optional secondary text color. Used to contrast the primary color for some text elements.
#333333 #000000CC
primaryBrandColor Optional color that replaces the default brand color.
Default value: #F95602 #F95602
Recommendation: Should be a color that does not collide with white color.
proceedButtonBackgroundColor Optional color that replaces the proceed button background color. Default: primaryBrandColor
proceedButtonTextColor Optional color that replaces the proceed button text color. Default value: #FFFFFF #FFFFFF
backgroundColor Optional color to be used as the screen background.
Default value: #F8F8F8 #F8F8F8
backgroundCellsColor Background color for cell UI elements, e.g. input cells, entry buttons.
Default value: #FFFFFF #FFFFFF
primarySubstitutionColor A color for link actions/subtitles in case the brand color is unreadable. Default value: primaryBrandColor
textFieldColor Optional color that replaces the default text color of the textfield components. Default: defaultTextColor
mode IDN_eIDAppearanceMode flag that is responsible for controlling the flow appearance mode.
Possible values:
light
dark
system
IDN_eIDAppearanceMode.dark

Light mode can be seen on other illustrations.
usedNewBrand A flag that specifies if the flow should use the new style (this includes fonts, logo and button corner radius).
Default value: true
usedNewBrand = false

usedNewBrand = true
cornerRadius An optional value for button corner radius.
Note: works only with usedNewBrand = false otherwise the button has round corners.
Default value: 4.0
userInterfaceLanguage Optional string representing a language code to be used for the flow.
Default value: system language.
-

Configuration

Additionally, the Terms and Conditions checkbox visibility can be configured via IDN_eIDConfig.

enableTnC

A flag that toggles the visibility of the Terms&Conditions checkbox. Default: true

Example usage:

IDN_eIDConfig.shared.enableTnC = false

Fonts

fontNameRegular

An optional font name that can be used to replace the regular font used by the SDK.
Default: System regular Font

fontNameBold

An optional font name that can be used to replace the bold font used by the SDK.
Default: System bold Font

fontNameMedium

An optional font name that can be used to replace the medium font used by the SDK.
Default: System medium Font

fontNameLight

An optional font name that can be used to replace the light font used by the SDK.
Default: System light Font

Button styles

underlineButtonTitles

Underline all button titles. Set this to true in order to underline button text.
Default: false

boldButtonTitles

Make button titles bold. Set this to false in order to use normal font weight in button titles.
Default: true