// src/utils/biometrics.ts
import ReactNativeBiometrics from 'react-native-biometrics';

export async function isBiometricAvailable() {
  const rnBiometrics = new ReactNativeBiometrics();
  const { available, biometryType } = await rnBiometrics.isSensorAvailable();
  return { available, biometryType }; // BiometryTypes.TouchID | FaceID | Biometrics | undefined
}

export async function biometricAuthenticate(reason = 'Unlock with biometrics') {
  const rnBiometrics = new ReactNativeBiometrics();
  const { success } = await rnBiometrics.simplePrompt({
    promptMessage: reason,
  });
  return success;
}
