Current version
The latest iOS Liveness SDK compact version is 0.1.5. A compatibility version is also available for older integrations.Prerequisites
- iOS minimum deployment target: iOS 13.0
- Camera permission declared (
NSCameraUsageDescriptioninInfo.plist) - Swift 5.x or later
Step 1 — Add the SDK
- CocoaPods
- Swift Package Manager
Add the pod to your Then run:
Podfile:Step 2 — Declare the camera permission
Add the following key to yourInfo.plist:
Step 3 — Generate tokens server-side
Before initializing the SDK your backend must generate a session ID and a liveness token. Use theApiClient helper below as a reference for the required calls.
Generate session ID — POST /v2/api/sdk/session-id:
POST /v2/api/sdk/liveness-token:
Step 4 — Initialize and launch the SDK
1
Import the package
2
Initialize the SDK with tokens
3
Start the liveness task
4
Add the liveness view controller
5
Handle the close delegate
Available liveness tasks
All tasks accept a
difficulty parameter (.easy, .medium, .hard) and an optional timeout in milliseconds.
Configuration options
String
Your Youverify public merchant key. Safe to embed in your app.
String
required
Session ID generated server-side via
POST /v2/api/sdk/session-id.String
required
Liveness token generated server-side via
POST /v2/api/sdk/liveness-token.Bool
default:"true"
Set to
false for production. Defaults to true.YVLivenessUser
User details.
firstName is required; lastName and email are optional.Bool
default:"false"
Set to
true to enable audio narration of task instructions.Callback data (LivenessData)
Bool
true if the liveness check passed all tasks.String
URL or base64-encoded face image captured during the check.
String
URL or base64 video clip of the user performing the liveness task.
LivenessError
Present only on failure. Contains
key (e.g. eyes_closed, image_capture_failed, invalid_or_expired_session) and message.iOS (Compat) version
A compatibility version of the SDK is available for integrations requiring support for older iOS versions or legacy codebases. Install it via CocoaPods:If you receive an
invalid_or_expired_session error, your session ID has expired. Generate a new sessionId and sessionToken from your backend and call initializeSDK again with the fresh values.