FaceAuthenticator

The @caf.io/react-native-face-authenticator library is a powerful tool for integrating facial liveness detection functionality into React Native applications. It allows developers to easily incorporat

Requirements

The libraries are compatible only with React Native versions that are 0.66.5 or later.

Android

To publish your app on the Google Play Store, you must complete a data safety form. Since we integrate with the FingerPrintJS SDK, you'll need to provide the following information:

iOS

Installation

yarn add @caf.io/react-native-face-authenticator
# or 
npm install @caf.io/react-native-face-authenticator

iOS

In the Podfile in the iOS folder, add this following sources:

source 'https://github.com/combateafraude/iOS.git'
source 'https://cdn.cocoapods.org'

After editing your Podfile, save it and install the SDK along with its dependencies by running the following command:

pod install

Usage

import React from 'react';
import { View, Button, StyleSheet } from 'react-native';
import { 
  startFaceAuthenticator,
  useFaceAuthenticator, 
  FaceAuthenticatorOptions, 
  Stage, 
  Filter, 
  Time 
} from '@caf.io/react-native-face-authenticator';

export default function App() {
  const mobileToken: string = "";
  const peopleId: string = "";

  const options: FaceAuthenticatorOptions = {
    cafStage: Stage.PROD,
    filter: Filter.NATURAL,
    imageUrlExpirationTime: Time.THREE_HOURS,
    enableScreenshots: true,
    loadingScreen: true
  } // optional

  const { 
    result, 
    error, 
    cancelled, 
    isLoading 
  } = useFaceAuthenticator(options);

  return (
    <View style={styles.container}>
      <Button 
        title="Press" 
        onPress={() => startFaceAuthenticator(mobileToken, peopleId)} 
      />
    </View>
  );
} 

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Methods

startFaceAuthenticator

This method inicialize the face authenticator.

Params

Hooks

useFaceAuthenticator

This hook provides the responses of method startFaceAuthenticator and make the settings for face authenticator.

Params

Responses

FaceAuthenticatorResponse

Types

FaceAuthenticatorResult

signedResponse params

FaceAuthenticatorError

FaceAuthenticatorResponse

FaceAuthenticatorOptions

Enums

Stage

Filter

Time

Error

Last updated

Logo

2023 © Caf. - All rights reserved