For the complete documentation index, see llms.txt. This page is also available as Markdown.

Start Liveness Verification

From 3.0.0 the flow has three steps: configure once with setup, optionally prewarm the session, then startSDK to present the capture screen.

Configuring with setup

Call setup before starting. It only stores your configuration — it performs no network request and presents nothing.

Parameter
Required
Description

mobileToken: String

Yes

Usage token associated with your CAF account

personId: String

Yes

User identifier

customLocalization: String?

No

Strings table name for custom iProov localization (e.g., "stringsBundle")

customLocalizationBundle: Bundle?

No

Bundle containing the custom strings table (iProov options.stringsBundle)

uiCustomization: CerttaUiCustomization?

No

Visual branding for the liveness screen (default: nil, no customization)

environment: CafEnvironment

No

.dev, .beta, .prod (default: .prod)

loading: Bool

No

Show SDK loading screen (default: true)

You can call setup again to change any value — for example to switch personId between users. Doing so discards a previously prewarmed session whenever the credentials or environment differ.

Prewarming the session (optional)

prewarm() performs the session request ahead of time so startSDK can open the camera without waiting on the network. Call it at any point where the user is already occupied — an instructions screen, a consent step, a form — and the round trip overlaps with their reading time instead of adding to it.

sdk.setup(mobileToken: "your_mobile_token", personId: "your_person_id")
sdk.prewarm()                       // e.g. when the instructions screen appears
// … user reads the instructions …
sdk.startSDK(viewController: self)  // consumes the prewarmed session

prewarm() returns immediately and reports nothing: it has no completion handler and never invokes the delegate. It is safe to call from any thread and safe to call more than once — while a request is in flight, or while a valid session is already cached, it does nothing rather than requesting a second session.

Prewarming is always optional and can never break a capture. If no valid session is available when startSDK runs — because prewarming failed, was never called, or the cached session is no longer usable — the SDK silently falls back to requesting the session inline, exactly as it did before 3.0.0.

A prewarmed session is discarded when:

Condition
Detail

It is older than 90 seconds

Start the capture within that window to benefit from prewarming

Credentials or environment changed

A later setup with a different mobileToken, personId or environment invalidates it

The app was sent to the background

The cached session and the stored credentials are cleared

It was already used

Each prewarmed session is consumed by a single startSDK call; call prewarm() again for another capture

Two behaviors worth noting when you integrate:

  • No loading() / loaded() pair is emitted for the session request on the prewarmed path, since there is nothing to wait for. From 3.1.0 none is emitted after the capture either, because the result is delivered immediately. Do not rely on loading() as a signal that capture has begun.

  • prewarm() stores the mobile token and person ID in the keychain before issuing the request, because the request is authenticated from the keychain. They are removed if prewarming fails or the app is backgrounded.

Calling startSDK

startSDK presents the capture screen using the configuration supplied to setup. It takes only the presenting view controller. Call it on the main thread.

Parameter
Required
Description

viewController: UIViewController

Yes

The presenting view controller

Calling startSDK without a prior setup does not present anything — it reports didFinishWithError(type: .invalidOptionsException, description:) instead. See Result Reference.

startSDK checks camera access before any network request. If the user has not decided yet, the system prompt is shown; if access is denied, the SDK reports didFinishWithError(type: .cameraPermission, description:).

Calling startSDK while a capture is already running is ignored — nothing is presented and no delegate method is called.

Example

Custom localization with a framework bundle

When custom Localizable.strings ship inside a framework (or another non-main bundle), pass both the table name and the bundle:

Localization reference: iProov Localization

UI customization

To brand the liveness screen — header bar, guidance prompt, area around the face oval and font — pass a CerttaUiCustomization through the uiCustomization parameter of setup. Available from 2.1.0 and fully optional. See UI Customization.

Atualizado