Source Code

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

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

  const options: FaceAuthenticatorSettings = {
    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',
  },
});

Last updated

Logo

2023 © Caf. - All rights reserved