> For the complete documentation index, see [llms.txt](https://lumin-soft.gitbook.io/ekyc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lumin-soft.gitbook.io/ekyc/integration-guide/mobile-plugin/enroll-ios-framework.md).

# eNROLL iOS Framework

## 1. Requirements

* **Xcode**: ≥ 14.2
* **iOS Deployment Target**: ≥ 13.0

***

## 2. Installation

### 🔹 CocoaPods (Recommended)

We now distribute **EnrollFramework** via a **private CocoaPod** for easier integration.

1. Add our private specs repo to your Podfile (before the CocoaPods default one):

   ```ruby
   source 'https://github.com/LuminSoft/eNROLL-iOS-specs.git'
   source 'https://github.com/innovatrics/innovatrics-podspecs'
   source 'https://github.com/CocoaPods/Specs.git'
   ```
2. Add the EnrollFramework pod:

   ```ruby
   pod 'EnrollFramework', '~> 3.0.9'
   ```

   > ✅ You no longer need to declare these pods manually `dot-face-detection-fast`, `dot-face-expression-neutral`, etc.\
   > They are already included in our podspec.
3. Install pods:

   ```sh
   pod repo add eNROLL-iOS-specs https://github.com/LuminSoft/eNROLL-iOS-specs.git
   pod install --repo-update
   ```

***

## 3. Configurations

### 3.1  Basic Configurations

1. Update your **Info.plist**:

   ```xml
   <key>NSCameraUsageDescription</key>
   <string>Your message to users</string>
   <key>NSLocationWhenInUseUsageDescription</key>
   <string>Your message to users</string>
   ```
2. **If you are using Xcode 15 or later**\
   Go to **Build Settings** → search for `User Script Sandboxing` and set it to **NO**.

<figure><img src="https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2F8BWZZsLCrFVxhRNUOCmk%2Fimage.png?alt=media&#x26;token=31278b62-42f3-41f0-9380-6709bdd34714" alt="" width="551"><figcaption></figcaption></figure>

3. Place your **license file** inside your project (drag & drop into Navigator, with *Copy items if needed* checked).

<figure><img src="https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FD22HiplTaCuMTRwHgt8A%2Fimage.png?alt=media&#x26;token=595b27a1-5818-4365-bb23-08b69cb5f015" alt="" width="368"><figcaption></figcaption></figure>

### 3.2 ePassport Configuration(Optional)

To enable NFC reading capability for ePassport support, follow these steps:

1. Add the following to your project **Info.plist** file:

```xml
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>A0000002471001</string>
</array>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
</array>
<key>NFCReaderUsageDescription</key>
<string>Your message to users</string>
```

2. Enable NFC capability in Xcode:

   * Select your **Target** → **Signing & Capabilities** tab
   * Search for and add the **Near Field Communication Tag Reading** capability
   *

   ```
   <figure><img src="/files/ASlRRrmPy86jZMRuQgFF" alt=""><figcaption></figcaption></figure>
   ```

***

## 4. Usage

#### 4.1. Import the Framework

```swift
import EnrollFramework
```

#### 4.2. Conform to `EnrollCallBack`

```swift
class YourViewController: UIViewController, EnrollCallBack {
    func didInitializeRequest(requestId: String) { }
    func enrollDidSucceed(with model: EnrollSuccessModel) { }
    func enrollDidFail(with error: EnrollErrorModel) { }
}
```

#### 4.3. Configure App Theme and Colors (Optional)

You can customize the SDK's appearance by configuring custom colors and theme with icons:

```swift
// Define custom colors
let enrollColors = EnrollColors(
    primary: .cyan,
    secondary: .red
)

// Configure theme with custom icons
let theme = EnrollTheme(
    icons: AppIcons(
        logo: LogoConfig(
            mode: .default,
            icon: EnrollIcon(assetName: "logo2")
        ),
        location: LocationIcons(
            tutorial: StepIcon(icon: EnrollIcon(assetName: "location"))
        ),
        nationalId: NationalIdIcons(
            tutorial: StepIcon(icon: EnrollIcon(assetName: "photo")),
            tutorialIdOrPassport: StepIcon(icon: EnrollIcon(assetName: "passport")),
            preScan: StepIcon(icon: EnrollIcon(assetName: "nationalIdPrescanImage", validationMode: .strict)),
            choose: StepIcon(icon: EnrollIcon(assetName: "card"))
        ),
        passport: PassportIcons(
            tutorial: StepIcon(icon: EnrollIcon(assetName: "passport"))
        ),
        phone: PhoneIcons(
            tutorial: StepIcon(icon: EnrollIcon(assetName: "phone"))
        ),
        email: EmailIcons(
            tutorial: StepIcon(icon: EnrollIcon(assetName: "otp")),
            validateOtp: StepIcon(icon: EnrollIcon(assetName: "otp"))
        ),
        faceMatching: FaceMatchingIcons(
            tutorial: StepIcon(icon: EnrollIcon(assetName: "face")),
            error: StepIcon(icon: EnrollIcon(assetName: "wrong"))
        ),
        password: PasswordIcons(
            tutorial: StepIcon(icon: EnrollIcon(assetName: "otp"))
        ),
        common: CommonIcons(
            popups: PopupIcons(
                warningIcon: StepIcon(icon: EnrollIcon(assetName: "wrong")),
                errorIcon: StepIcon(icon: EnrollIcon(assetName: "wrong")),
                successIcon: StepIcon(icon: EnrollIcon(assetName: "ok")),
                errorSign: StepIcon(icon: EnrollIcon(assetName: "wrong"))
            ),
            fieldIcons: FieldIcons(
                user: StepIcon(icon: EnrollIcon(assetName: "face", renderingMode: EnrollIconRenderingMode.template)),
                calendar: StepIcon(icon: EnrollIcon(assetName: "calender")),
                gender: StepIcon(icon: EnrollIcon(assetName: "melody")),
                num: StepIcon(icon: EnrollIcon(assetName: "cash")),
                passport: StepIcon(icon: EnrollIcon(assetName: "passport")),
                address: StepIcon(icon: EnrollIcon(assetName: "folder2")),
                idCard: StepIcon(icon: EnrollIcon(assetName: "card"))
            )
        )
    ),
    colors: enrollColors
)
```

#### 4.4. Initialize & Present

```swift
do {
    let enrollInitModel = try 
     EnrollInitModel(
     tenantId: "<YOUR_TENANT_ID>",
     tenantSecret:  "<YOUR_TENANT_SECRET>",
     enrollEnviroment: .production, // or .staging
     localizationCode: langugeSwitch.isOn ? .en : .ar,
     enrollCallBack: self,
     enrollMode: .onboarding,        // or .authentication, .update, .signContract
     skipTutorial: true, // or false
     enrollColors: enrollColors,
     enrollTheme: theme,
     levelOffTrustId: levelOfTrustTF.text,
     applicantId:  "<YOUR_APPLICANT_ID>",
     requestId: requestIdTf.text, 
     contractTemplateId: Int(contarctTempleteIdTF.text ?? ""),
     signContarctParam: contarctParametersTF.text ?? nil, 
     exitStep: selectedExitStep
    )

    let enrollVC = Enroll.initViewController(
        enrollInitModel: enrollInitModel,
        presenterVC: self
    )

    self.present(enrollVC, animated: true)

} catch {
    print("Error initializing EnrollInitModel: \(error)")
}
```

***

## 5. Values Description

#### 5.1. EnrollInitModel Parameters

| Keys                       | Values                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `tenantId`                 | **Required**. Write your organization tenant id.                                                                                                                                                                                                                                                                                                             |
| `tenantSecret`             | **Required**. Write your organization tenant secret.                                                                                                                                                                                                                                                                                                         |
| `enrollMode`               | **Required**. Mode of the SDK. (See Enroll Modes).                                                                                                                                                                                                                                                                                                           |
| `enrollEnviroment`         | **Required**. Select the EnrollEnvironment: `EnrollEnvironment.STAGING` for staging and `EnrollEnvironment.PRODUCTION` for production.                                                                                                                                                                                                                       |
| `enrollCallback`           | **Required**. Callback function to receive success and error response.                                                                                                                                                                                                                                                                                       |
| `localizationLanguage`     | \<p>\<strong>Required\</strong>. Select your language code: \<code>LocalizationEnum.EN\</code> for English, and \<code>LocalizationEnum.AR\</code> for Arabic.\<br>Default value is \<strong>English\</strong>.\</p>                                                                                                                                         |
| `googleApiKey`             | **Optional**. Google API Key to view the user's current location on the map.                                                                                                                                                                                                                                                                                 |
| `applicantId`              | **Optional**. Write your Application ID (Required for `auth`, `update`, and `signContract`).                                                                                                                                                                                                                                                                 |
| `levelOffTrustId`          | **Optional**. Write your Organization's level of trust (Required for `auth`).                                                                                                                                                                                                                                                                                |
| `skipTutorial`             | **Optional**. Choose to ignore the tutorial or not.                                                                                                                                                                                                                                                                                                          |
| `enrollColors`             | **Optional**. Collection of app colors you can override: `primary`, `secondary`, `background`, `successColor`, `warningColor`, `errorColor`, `textColor`.                                                                                                                                                                                                    |
| `enrollTheme`              | **Optional**. Custom theme configuration with icons and colors. (See App Theme Configuration).                                                                                                                                                                                                                                                               |
| `customFontName`           | **Optional**. Font resource to set your font family.                                                                                                                                                                                                                                                                                                         |
| `correlationId`            | **Optional**. Correlation ID to connect your User ID with our Request ID.                                                                                                                                                                                                                                                                                    |
| `contractTemplateId`       | **Optional**. The ID of the contract to be signed (Required for `signContract`).                                                                                                                                                                                                                                                                             |
| `signContarctParam`        | **Optional**. Extra contract parameters for `signContract`.                                                                                                                                                                                                                                                                                                  |
| `enrollForcedDocumentType` | \<p>\<strong>Optional\</strong>. Accepts values from the \<code>EnrollForcedDocumentType\</code> enum:\<br>- \<code>passport\</code> → The user must enroll using a passport.\<br>- \<code>nationalId\</code> → The user must enroll using a national ID.\<br>- \<code>default\</code> → Keeps the normal flow with standard document selection screen.\</p> |
| `requestId`                | **Optional**. Write your request ID to continue a previously initiated request (runaway) instead of starting from the beginning.                                                                                                                                                                                                                             |

### 5.2.EnrollColors

Define custom colors for UI components inside the framework.

| Keys               | Values                                                |
| ------------------ | ----------------------------------------------------- |
| primary            | The Primary color used for all buttons and main items |
| secondary          | Used for the minor views and items                    |
| appBackgroundColor | Used for the main background                          |
| textColor          | Used for the text and content color                   |
| errorColor         | Used for the error color                              |
| successColor       | Used for the successful color                         |
| warningColor       | Used for the warning color                            |
| appWhite           | The main white color                                  |
| appBlack           | The main black color                                  |

***

***

## 6. Step Types

The SDK supports the following step types defined in the `StepType` enumeration:

```swift
enum StepType {
    case phoneOtp = 3
    case personalConfirmation = 1
    case smileLiveness = 2
    case emailOtp = 4
    case saveMobileDevice = 5
    case deviceLocation = 6
    case password = 8
    case securityQuestions = 7
    case amlCheck = 9
    case termsAndConditions = 10
    case electronicSignature = 12
    case ntraCheck = 13
    case csoCheck = 14
}
```

#### Step Type Details

| Step Type              | Value | Description                                          |
| ---------------------- | ----- | ---------------------------------------------------- |
| `personalConfirmation` | 1     | Personal confirmation step for identity verification |
| `smileLiveness`        | 2     | Smile liveness detection to verify user is alive     |
| `phoneOtp`             | 3     | One-Time Password verification via phone             |
| `emailOtp`             | 4     | One-Time Password verification via email             |
| `saveMobileDevice`     | 5     | Option to save the current mobile device             |
| `deviceLocation`       | 6     | Device location verification step                    |
| `securityQuestions`    | 7     | Security questions for additional verification       |
| `password`             | 8     | Password creation or verification step               |
| `amlCheck`             | 9     | Anti-Money Laundering compliance check               |
| `termsAndConditions`   | 10    | Terms and Conditions acceptance                      |
| `electronicSignature`  | 12    | Electronic signature step                            |
| `ntraCheck`            | 13    | NTRA (National Telecom Regulatory Authority) check   |
| `csoCheck`             | 14    | CSO (Central Security Organization) check            |

***

## 7. ENROLL MODES

The SDK supports **4 modes** defined in the `EnrollMode` enum:

```swift
enum EnrollMode {
  onboarding,
  auth,
  update,
  signContract
}
```

### Mode Details

| Mode           | Description                                                | Requirements                                                                                                 |
| -------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `onboarding`   | Registering a new user in the system.                      | `tenantId`, `tenantSecret` (required).                                                                       |
| `auth`         | Verifying the identity of an existing user.                | `tenantId`, `tenantSecret`, **`applicantId`**, **`levelOffTrustId`** (all required).                         |
| `update`       | Updating or re-verifying the identity of an existing user. | `tenantId`, `tenantSecret`, `applicantId` (required).                                                        |
| `signContract` | Signing contract templates by a user.                      | `tenantId`, `tenantSecret`,**`contractTemplateId,`** `applicantId`(required). Optional: `signContarctParam`. |

## 8- Security Notes

* Never hardcode `tenantSecret`, `levelOfTrustToken`, or API keys inside the mobile application. Use a secure storage mechanism (e.g., Keychain on iOS, Keystore on Android).
* Regularly update the SDK to the latest stable version for security patches.
* Rooted devices are blocked by default for security reasons.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lumin-soft.gitbook.io/ekyc/integration-guide/mobile-plugin/enroll-ios-framework.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
