/
Contact usSee pricingStart building
    Overview
    iOS SDK reference
    Android SDK reference

    React Native SDK reference

    Installation
    Changelog
    Configuration
    Pre-built UI
      UI Configuration
    Users
      Get user
      Update user
      Delete authentication factors
    Email Magic Links
      Send
      Login or create
      Authenticate
    OAuth
      Start
      Authenticate
    Passwords
      Create
      Authenticate
      Reset by Email Start
      Reset by Email
      Strength Check
    One-time Passcodes (OTP)
      Login or create via SMS
      Send via SMS
      Login or create via Email
      Send via Email
      Login or create via WhatsApp
      Send via WhatsApp
      Authenticate
    Time-Based One-Time Passcodes (TOTP)
      Create
      Authenticate
      Get Recovery Codes
      Recover
    Session Management
      Get Session
      Authenticate Session
      Revoke Session
      Update Session
      Get Tokens
    Passkeys & WebAuthn
      Register
      Authenticate
      Update
    Biometrics
      Introduction
      Register
      Authenticate
      Keystore available
      Registration available
      Remove registration
      Get sensor
      Errors
    Device Fingerprinting
      Get telemetry ID
    More Resources
      SWR & caching
      Deep linking
      Android KeyStore considerations
Get support on SlackVisit our developer forum

Contact us

Consumer Authentication

/

Mobile SDKs

/

React Native SDK reference

/

Biometrics

/

Keystore available

Keystore available

Indicates whether or not the Keystore is available on the device. This will always return true for iOS devices. A percentage of Android devices will return false. To learn more about the implications of the Android Keystore being unavailable, read our Android Keystore resource.

import React, { useCallback, useEffect, useState } from 'react';
import { Text, TouchableOpacity, View } from 'react-native';
import { useStytch, useStytchSession } from '@stytch/react-native';

export const Register = () => {
  const stytch = useStytch();
  const { session } = useStytchSession();

  const [isKeystoreAvailable, setIsKeystoreAvailable] = useState(false);
  useEffect(() => {
    if (stytch) {
      stytch.biometrics.isKeystoreAvailable().then(setIsKeystoreAvailable);
    }
  }, [stytch]);

  const registerBiometrics = useCallback(() => {
    if (session) {
      stytch.biometrics.register({
        prompt: 'Register Your Biometric Factor',
      });
    }
  }, [session, stytch.biometrics]);

  return isKeystoreAvailable ? (
    <View>
      <TouchableOpacity onPress={registerBiometrics}>
        <Text>Register with Biometrics</Text>
      </TouchableOpacity>
    </View>
  ) : null;
};