How to use react-native-fingerprint-scanner - 10 common examples

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 daper / nextcloud-passwords-app / src / Lock.js View on Github external
async componentWillUnmount () {
    try {
      await FingerprintScanner.release()
    } catch (err) { /* Do nothing */ }
  }
github LiskHQ / lisk-mobile / src / components / screens / signIn / biometricAuth / index.js View on Github external
componentWillUnmount() { // eslint-disable-line
    FingerprintScanner.release();
  }
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.authenticate({
        description: "Any string",
        fallbackEnabled: true
      });

      FingerprintScanner.authenticate({
        description: "Any string"
      });

      FingerprintScanner.authenticate({
        fallbackEnabled: true
      });
    });
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 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)
    }
  }
github LiskHQ / lisk-mobile / src / utilities / passphrase.js View on Github external
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 hieuvp / react-native-fingerprint-scanner / examples / src / FingerprintPopup.component.ios.js View on Github external
componentDidMount() {
    FingerprintScanner
      .authenticate({ description: 'Scan your fingerprint on the device scanner to continue' })
      .then(() => {
        this.props.handlePopupDismissed();
        AlertIOS.alert('Authenticated successfully');
      })
      .catch((error) => {
        this.props.handlePopupDismissed();
        AlertIOS.alert(error.message);
      });
  }

react-native-fingerprint-scanner

React Native Biometrics Scanner for Android and iOS

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis