Source Code

import React, { useEffect } from 'react';
import { View, Button, StyleSheet, Button, Platform } from 'react-native';

import { CafSmartAuthSettings, CafFilter, CafStage } from './src/hooks/types';

import {
  startSmartAuth,
  requestLocationPermissions,
  useSmartAuth,
} from './src/hooks/useSmartAuth';

const IS_ANDROID = Platform.OS === 'android';

export default function App() {
  const mfaToken: string = '';
  const faceAuthToken: string = '';
  const policyId: stirng = '';
  const personId: string = '';

  const settings: CafSmartAuthSettings = {
    faceAuthenticationSettings: {
      loadingScreen: false,
      enableScreenCapture: false,
      filter: CafFilter.LINE_DRAWING,
    },
    stage: CafStage.PROD,
  }

  const { success, cancelled, error, isLoading, pending } = useSmartAuth(settings);

  useEffect(() => {
    IS_ANDROID && requestLocationPermissions();
  }, []);

  return (
    <View style={styles.container}>
      <Button
        title="Start CafSmartAuth"
        onPress={() =>
          startSmartAuth(
            mfaToken,
            faceAuthToken,
            policyId,
            personId,
          )
        }
      />
    </View>
  );
};

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

Last updated

Logo

2023 © Caf. - All rights reserved