Skip to content

Kagii SDK for iOS

Notifications You must be signed in to change notification settings

Sedicii/Kagii-iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Kagii iOS SDK

Kagii protects the enterprise by carefully authenticating authorized users seeking access to the network and to applications. Grant users secure access to all protected applications (on-premises or cloud-based) through a uniform, frictionless interface accessible from anywhere.

Full example

A full example which integrates Kagii SDK with KYCExpert SDK is available in the repository Sedicii/KYCexpert-High-Assurance-Example

Requirements

  • iOS 13.0 and higher
  • Internet connection
  • Permissions for camera

Permissions

The permissions declared in the SDK are assigned automatically to the client application.

According to the Apple documentation, an iOS app linked on or after iOS 10.0, must describe the reason why your app needs that permission.

It is necessary to include the NSCameraUsageDescription, NSPhotoLibraryUsageDescription and NSMicrophoneUsageDescription keys in your app's Info.plist file and provide a purpose string for this key.

Include SDK in Project

This framework can be included in your project with Carthage:

github "Sedicii/Kagii-iOS"

Or you can include it manually downloading the latest version.

Dependencies

This framework depends on the following frameworks:

github "marmelroy/PhoneNumberKit"
github "Sedicii/SediciiCoreSDK-iOS"
github "Sedicii/SediciiZkpSDK-iOS"

You can include them manually downloading SediciiCoreSDK latest version and SediciiZkpSDK latest version

SDK Configuration

These are the available variables to configure the SDK:

Name Required Description
API_ENDPOINT true The API_ENDPOINT of the backend used by the SDK, Sedicii will provide it.
API_KEY true The API_KEY of the backend used by the SDK, Sedicii will provide it.
CLIENT_ID true The CLIENT_ID is the unique identifier of the client, Sedicii will provide it.
REDIRECT_URI true The REDIRECT_URI of the authorised domain, Sedicii will provide it.
PASSWORD_CONFIRM_NEEDED false If true, it'll show a password confirmation field. By default, it's false.

To configure the SDK in iOS a plist type file is needed located in the main project path, with name Kagii-Info.plist (make sure it is added in BuildPhases > Copy Bundle Resources), which can have the following values:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>API_ENDPOINT</key>
        <string>https://example.acc.sedicii.com</string>
        <key>API_KEY</key>
        <string>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</string>
        <key>CLIENT_ID</key>
        <string>example</string>
        <key>REDIRECT_URI</key>
        <string>https://example.kyc.sedicii.com/admin/login</string>
        <key>PASSWORD_CONFIRM_NEEDED</key>
        <true/>
    </dict>
</plist>

SDK Initialisation

To initialise the SDK, it is needed to call the method Kagii.userInterface.logInUser as follows:

Kagii.userInterface.logInUser { kagiiResult in
    switch kagiiResult {
    case .failure(let error):
        // error - LogInUserError
    case .success(let response):
        // response - LogInUserResponse
    }
}

LogInUserError

LogInUserError is the enumeration which is returned in case of failure in the Kagii.userInterface.logInUser call.

public enum LogInUserError: Error {
    case error(Error)
    case sdkClosed
}

LogInUserResponse

LogInUserResponse is the data structure which is returned in the successfull case in the Kagii.userInterface.logInUser call.

public struct LogInUserData {
    public var id: String
}

public struct LogInUserResponse {
    public var user: LogInUserData
    public var code: String
}

Appearance

The full appearance definition is available in appearance section.

Defining the appearance. This is way to define your own appearance.

Kagii.userInterface.appearance = ClientAppearance.appearance

Logging

Also, it is allowed the definition of the logging level as follows:

Kagii.loggerLevel = .none

where the logging levels are:

    case none
    case error
    case warning
    case info
    case debug
    case trace