Source Code

import React from 'react';
import { View, Button, StyleSheet } from 'react-native';
import { 
  startFaceLiveness,
  useFaceLiveness, 
  FaceLivenessSettings, 
  Stage, 
  Filter, 
  Time 
} from '@caf.io/react-native-face-liveness';

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

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

  const { 
    result, 
    error, 
    cancelled, 
    isLoading 
  } = useFaceLiveness(settings);

  return (
    <View style={styles.container}>
      <Button 
        title="Start" 
        onPress={() => startFaceLiveness(mobileToken, personId)} 
      />
    </View>
  );
} 

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

Last updated

Logo

2023 © Caf. - All rights reserved