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

Migrating from CafSdk

Migrate a React Native app from the sequential useCafSdk API to Certta DevX in @caf.io/react-native-sdk 5.4.0. Compare configuration, module launch, and event handling.

Starting with @caf.io/react-native-sdk 5.4.0, Certta DevX (useCerttaSdk + per-module open()) is the recommended API for new integrations. The sequential useCafSdk API remains available in the same package. Existing initialize / startSDK flows keep working.

This page maps the legacy sequential API to independent module open() calls.

API comparison

Area
useCafSdk (legacy)
Certta DevX (5.4.0+)

Session hook

useCafSdk

useCerttaSdk

Session setup

initialize({ configuration, mobileToken, personId, ... })

configureSDK(CerttaConfiguration)

Module order

presentationOrder runs Face Liveness and Document Detector in one sequence

Each module is opened independently

Launch

One startSDK() starts the whole pipeline

useCafFaceLiveness().open, useCafDocumentDetector().open, useCafDocumentDetectorUI().open

Module config

applyCafFaceLiveness / applyCafDocumentDetector before initialize

Pass CerttaLivenessConfiguration / CerttaDocumentDetectorConfiguration directly to open()

Events

Single response object on useCafSdk

Per-hook event state + logs on useCerttaSdk

Person identifier

personId

userId

Security flag

enableSecurityModule on builder configuration

securityEnabled on CerttaConfiguration

Colors

colorConfiguration on builder configuration

colorConfiguration on CerttaConfiguration

Module selection (caf-modules-config.json), Maven repositories, CocoaPods, permissions, and ProGuard do not change. Follow the Installation Guide.

1. Configure the session once

// Before (useCafSdk)
const { initialize, startSDK, response } = useCafSdk();
const { applyCafFaceLiveness } = useCafFaceLiveness();
const { applyCafDocumentDetector } = useCafDocumentDetector();

await initialize(
  {
    configuration: {
      presentationOrder: [
        CafModuleType.FACE_LIVENESS,
        CafModuleType.DOCUMENT_DETECTOR,
      ],
      enableSecurityModule: true,
    },
    mobileToken: 'token',
    environment: CafEnvironment.PROD,
    personId: 'personId',
  },
  async () => {
    await applyCafFaceLiveness({ maxRetryAttempts: 3 });
    await applyCafDocumentDetector({
      flow: [{ document: CafDocument.RG_FRONT }],
    });
    return true;
  },
);

// After (Certta DevX)
const { configureSDK, updateUserId, updateMobileToken } = useCerttaSdk();

try {
  await configureSDK({
    mobileToken: 'token',
    userId: 'personId',
    environment: CafEnvironment.PROD,
    securityEnabled: true,
  });
} catch {
  // Handle BRIDGE_EXCEPTION
}

After configureSDK, update credentials without rebuilding the full configuration:

2. Open one module at a time

There is no presentationOrder on Certta. Start Face Liveness or Document Detector when your product flow needs it.

Legacy apply + module config
Certta launch

applyCafFaceLiveness

useCafFaceLiveness().open(CerttaLivenessConfiguration)

applyCafFaceLivenessUI

open({ useFaceLivenessUi: true, ... })

applyCafDocumentDetector

useCafDocumentDetector().open(CerttaDocumentDetectorConfiguration)

applyCafDocumentDetectorUI

useCafDocumentDetectorUI().open(CerttaDocumentDetectorUIConfiguration)

Certta liveness configuration is a smaller set: maxRetryAttempts, faceAuthEnabled, showLoading, useFaceLivenessUi, and payFaceDebugMode (iOS). Proxy URLs, certificates, and instruction-screen fields from CafFaceLivenessConfiguration are not part of the Certta configuration object.

3. Listen to typed module events

useCafSdk response

Certta equivalent

success.signedResponse

event.success.response

success.moduleName

Implied by which hook received the event

failure

useCafFaceLiveness().event.failed

error

event.error (CerttaError)

log

useCerttaSdk().logs

loading / loaded

Not forwarded on Certta module hooks

Bridge mapper rejections reject the configureSDK / open() promise with CerttaPlatformException and code BRIDGE_EXCEPTION (CerttaErrorCode.BridgeException) instead of only appearing on hook events.

4. Sequential pipelines

If you used presentationOrder, transition screens (enableTransitionScreens), or waitForAllServices with useCafSdk, the same product flow can be built with Certta DevX: configure the session once, then chain module open() calls from your app logic (for example, start Face Liveness when Document Detector event.success is set).

The sequential useCafSdk API remains available in @caf.io/react-native-sdk and is documented in Legacy Getting Started. Both APIs are supported and cover equivalent integration needs — prefer Certta DevX for new work and when migrating existing apps.

Next steps

Installation GuideFace LivenessDocument Detector

Atualizado