How to use the react-native-fingerprint-scanner.isSensorAvailable function in react-native-fingerprint-scanner

To help you get started, we’ve selected a few react-native-fingerprint-scanner examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-mobile / src / components / screens / signIn / index.js View on Github external
async defineDefaultAuthMethod() {
    const { password } = await getPassphraseFromKeyChain();
    let sensorType = null;
    try {
      sensorType = await FingerprintScanner.isSensorAvailable();
    } catch (error) {
      sensorType = null;
    }
    const signOut = this.props.navigation.getParam('signOut');
    const delay = this.state.view === 'splash' && !signOut ? 1100 : 0;

    // Update the store
    this.props.settingsUpdated({
      sensorType,
      hasStoredPassphrase: !!password,
    });
    // Update the component state
    this.timeout = setTimeout(() => {
      if (password && sensorType) {
        this.setState({
          view: 'biometricAuth',
github eltcoin / eltwallet / src / components / PinKeyboard / components / BackButton / index.js View on Github external
checkTouchIdSupport = async () => {
    try {
      const isSensorAvailable = await FingerprintScanner.isSensorAvailable();

      if (isSensorAvailable) {
        this.setState({
          isTouchIdSupported: true,
        });

        this.onTouchIdClick();
      }
    } catch (error) {
      // An error happened during biometric detection
    }
  };
github flow-typed / flow-typed / definitions / npm / react-native-fingerprint-scanner_v2.x.x / flow_v0.69.0- / test_react-native-fingerprint-scanner.js View on Github external
it("passes when used properly", () => {
    FingerprintScanner.isSensorAvailable().then(type => {
      (type: "Fingerprint" | "Face ID" | "Touch ID");
    });
  });
});
github iotaledger / trinity-wallet / src / mobile / src / ui / views / wallet / BiometricAuthentication.js View on Github external
activateFingerprintScanner() {
        const { t } = this.props;

        return FingerprintScanner.isSensorAvailable()
            .then(() => {
                FingerprintScanner.authenticate({
                    description: t('instructionsEnable'),
                })
                    .then(() => {
                        this.onSuccess();
                    })
                    .catch(() => {
                        this.onFailure();
                    });
            })
            .catch((err) => {
                this.props.generateAlert(
                    'error',
                    t('fingerprintUnavailable'),
                    t('fingerprintUnavailableExplanation'),
github LiskHQ / lisk-mobile / src / utilities / passphrase.js View on Github external
export const bioMetricAuthentication = async ({
  successCallback,
  errorCallback = err => err,
  description,
  androidError,
}) => {
  const authConfig =
    Platform.OS === 'ios'
      ? {
          description:
            description ||
            'Scan your fingerprint on the device scanner to sign in',
        }
      : { onAttempt: androidError };
  try {
    await FingerprintScanner.isSensorAvailable();
    try {
      await FingerprintScanner.authenticate(authConfig);
      successCallback();
    } catch (error) {
      errorCallback(error);
    }
  } catch (error) {
    errorCallback(error);
  }
};
github LiskHQ / lisk-mobile / src / components / shared / imessage / signInWarning / index.js View on Github external
async componentDidMount() {
    let sensorType;

    try {
      sensorType = await FingerprintScanner.isSensorAvailable();
    } catch (error) {
      sensorType = 'biometric authentication';
    }

    this.setState({ sensorType });
  }
github hieuvp / react-native-fingerprint-scanner / examples / src / Application.container.js View on Github external
componentDidMount() {
    FingerprintScanner
      .isSensorAvailable()
      .catch(error => this.setState({ errorMessage: error.message }));
  }
github daper / nextcloud-passwords-app / src / Lock.js View on Github external
async componentDidMount () {
    if (!this.props.isLocked) {
      this.props.history.push('/dashboard')
      return
    }

    try {
      let isAvailable = await FingerprintScanner.isSensorAvailable()
      if (!isAvailable) {
        this.setState({ sensorAvail: isAvailable })
      } else {
        await FingerprintScanner.authenticate({ onAttempt: this.setError })
        await this.setState({ isError: false })
        
        setTimeout(this.goBack, 400)
      }
    } catch (err) {
      this.setError(err)
    }
  }

react-native-fingerprint-scanner

React Native Biometrics Scanner for Android and iOS

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis