Face Capture - Selphi
This component requires iOS 13 or later.
Introduction
Face capture is performed using the Selphi Component.
This component captures a selfie of the user and extracts their main facial features. It includes the following processes:
Internal management of cameras and permissions.
Assistance during face capture.
Generation of facial templates and the user's image.
The Simplified Launch section describes the steps required for basic SDK integration. This page provides the specific information needed to launch this component.
Dependencies
To avoid conflicts and compatibility issues, if the project contains older versions of Facephi libraries (Widgets), they must be completely removed before installing the SDKMobile.
CocoaPods
Facephi libraries are distributed remotely through dependency managers. On iOS, CocoaPods is used. The required dependencies that must be installed beforehand (by adding them to the project's Podfile) are:
pod 'FPHISDKMainComponent', '~> $VERSION'To install the Selphi, add the corresponding dependency to the project's Podfile , along with the SDK's required dependencies.
pod 'FPHISDKSelphiComponent', '~> $VERSION'Swift Package Manager (SPM)
If you use SPM, make sure the SDK's mandatory dependencies are installed beforehand.
To install the Selphicomponent, include it in the project modules.
Permissions
In the client application where the components will be integrated, the following entry must be added to the Info.plist:
Available Controllers
Controller
Description
SelphiController
Main facial recognition controller
RawTemplateController
Controller for generating a RawTemplate from an image
SignatureSelphiController
Controller for signing a process with a Face Capture
Simplified Launch
Once the SDK has been initialized and a new operation has been created, the component can be launched using any of its available controllers, depending on the required functionality.
Receiving the result
Launching the component returns a result in the SdkResultformat, which includes:
selphiResult.finishStatusselphiResult.errorTypeselphiResult.data
Receiving errors
finishStatus: Indicates whether the operation completed successfully. Possible values:
errorType: Errors specific to the widget.
On iOS, errorType is an SDK ErrorType For a timeout, the Swift enum may be .SDK_TIMEOUT, .SELPHI_TIMEOUT(LivenessDiagnostic?) or, if interpolated directly, display names such as SDK_TIMEOUT or SELPHI_TIMEOUT. On iOS, there is no TIMEOUT case without a prefix.
To serialize the error, use:
This returns SPI_TIMEOUT whether the enum is SDK_TIMEOUT or SELPHI_TIMEOUT.
Timeout behavior
On timeout, the result has:
finishStatus:STATUS_ERRORdata:nil(no SelphiResult is returnedSelphiResult)errorType:.SDK_TIMEOUTor.SELPHI_TIMEOUT(LivenessDiagnostic?)
The SELPHI_TIMEOUT case retains the widget's liveness diagnostic when available. This information is not part of data; it can only be read on iOS by pattern matching on errorType:
If the timeout is received as SDK_TIMEOUT, it does not include a liveness diagnostic. If it is received as SELPHI_TIMEOUT, the associated diagnostic may be nil when the timeout occurs through the widget's error path (FWETimeout) rather than the delegate extractionTimeout().
For native iOS integrations, the serialized value should be treated as SPI_TIMEOUT (includes both SDK_TIMEOUT and SELPHI_TIMEOUT from the enum).
If showDiagnostic is enabled, the output callback is not invoked at the time of the timeout: the diagnostic screen is shown first, and the result is delivered when the user taps Close. With showDiagnostic disabled, the callback is executed immediately.
The following list includes errors from the cross-platform contract; some do not occur on iOS.
SPI_APPLICATION_CONTEXT_ERROR: The required application context is null.
SPI_BAD_EXTRACTOR_CONFIGURATION_ERROR: Widget: Incorrect extractor configuration.
SPI_CAMERA_PERMISSION_DENIED: The user denied the permissions.
SPI_CANCEL_BY_USER: The user canceled the process.
SPI_COMPONENT_LICENSE_ERROR: The component license is invalid.
SPI_EMPTY_LICENSE: The license String is empty.
SPI_EXTRACTION_LICENSE_ERROR: Widget: License error.
SPI_ACTIVE_LIVENESS_ERROR: Widget: Error during the active liveness process.
SPI_HARDWARE_ERROR: Widget: Hardware error.
SPI_INITIALIZATION_ERROR: Initialization error.
SPI_MANAGER_NOT_INITIALIZED: The managers are null.
SPI_NO_DATA_ERROR: The input data is null.
SPI_OPERATION_NOT_CREATED: There is no operation in progress.
SPI_RESOURCES_FILE_NOT_FOUND: The resources zip file was not found.
SPI_SETTINGS_PERMISSION_ERROR: Widget: Permission error.
SPI_TEMPLATE_ERROR:
SPI_TIMEOUT: Timeout during the process (
SDK_TIMEOUTorSELPHI_TIMEOUTfrom the enum).SPI_UNEXPECTED_CAPTURE_ERROR: Widget: Capture error.
SPI_UNKNOWN_ERROR: Unknown error.
SPI_WIDGET_RESULT_DATA_ERROR: Error in the widget output data.
Successful execution response — data
The contents of the data field depend on the component launched. In Selphi, it may include:
templateFacial template generated after extraction. Valid for Authentication.templateRawRaw facial template generated after the extraction process. Valid for Authentication.bestImageDataBest captured image, in byte array format and original size. Valid for Liveness.bestImageCroppedDataCropped image centered on the face. Recommended as the user's avatar.qrDataInformation obtained from the QR scan inString.bestImageTokenizedEncrypted image resulting from the process. Valid for Liveness.
Advanced information
Additional controllers
SignatureSelphiController
Works the same as SelphiController, but generates a signature file for the process.
RawTemplateController
Allows you to generate a RawTemplate from an image (bitmap).
Usage example:
or
Advanced configuration
To launch the component, create a SelphiConfigurationData object.
This object defines the component's behavior and configuration.
Available parameters
resourcesPathRelative path to theResourcesfolder containing the resource file.showTutorialDisplays the tutorial before capture.showDiagnosticDisplays a diagnostic screen in case of an error or insufficient permissions.showResultAfterCaptureDisplays the captured image and allows you to repeat the process.debugEnables debug mode.fullscreenPrioritizes full-screen display.cropPercentFace crop percentage.livenessModeLiveness detection mode:NONEPASSIVEMOVE
stabilizationModeRequires the user to keep their head still before starting the process.templateRawOptimizedIndicates whethertemplateRawshould be optimized.qrModeEnables or disables QR scanning.videoFilenameAbsolute path to record the process video.cameraFlashEnabledEnables the camera flash.translationsContentAdvanced text configuration using XML.viewsContentAdvanced view configuration using XML.vibrationEnabledEnables vibration for errors and successful results.animateDismissIndicates whether the SDK dismissal is animated when the process finishes. Available since 2.8.1.
Component customization
In addition to the changes that can be made at the SDK level (described in SDK Customization), this component can also be customized independently.
Text
Customize the text by overriding keys in Localizable.strings, inside the Resources.
Keys with the suffix _alt are used for accessibility (VoiceOver).
Example of changing the text START for es:
Open the file Localizable.strings in the es.lproj folder (if this folder does not exist, create it).
If a key is not defined, the default value will be used.
Name
Value
selphi_component_tutorial_message_1
Place your face in the center and look straight at the camera.
selphi_component_tutorial_message_2
Remove any objects covering your face.
selphi_component_tutorial_message_3
Find a well-lit environment with no shadows on your face.
selphi_component_tip_message
Place your face in the center of the circle
selphi_component_tip_title
Facial Recognition
selphi_component_tip_button
START
selphi_component_tip_button_alt
Start face capture
selphi_component_tip_anim_alt
A person positions their face inside the circle, and the app takes a photo.
selphi_component_tip_move_anim_alt
Animation of a mobile phone screen with the front camera activated. A circle appears in the center of the screen. A person positions their face inside the circle, moves it slightly to one side, and the app takes a photo.
selphi_component_tutorial_1_anim_alt
The photo is taken when the person is in the center.
selphi_component_tutorial_2_anim_alt
A person takes off their sunglasses and moves their hair away from their eyes.
selphi_component_tutorial_3_anim_alt
The image appears dark, and a person turns on the light.
selphi_component_tip_move_message
Place your face in the center of the circle and follow the instructions.
selphi_component_timeout_title
Time exceeded
selphi_component_timeout_desc
We couldn't identify you. Try again
Animations
The animations for the previous tip and tutorials are Lottie (.json).
To replace them:
Add the file to the
Resources.Keep the filename exactly the same.
If they aren't replaced, the default animations will be displayed.
selphi_anim_tip
LivenessMode animation: None, Passive
selphi_anim_tip_move
LivenessMode animation: Move
selphi_anim_tuto_1
First tutorial animation
selphi_anim_tuto_2
Second tutorial animation
selphi_anim_tuto_3
Third tutorial animation
Last updated