How to use the react-native-keychain.AUTHENTICATION_TYPE function in react-native-keychain

To help you get started, we’ve selected a few react-native-keychain 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 Emurgo / yoroi-mobile / src / helpers / deviceSettings.js View on Github external
export const canBiometricEncryptionBeEnabled = async () => {
  if (Platform.OS === 'android') {
    return await KeyStoreBridge.canFingerprintEncryptionBeEnabled()
  } else if (Platform.OS === 'ios') {
    // prettier-ignore
    const hasBiometricHardware =
      await isBiometricEncryptionHardwareSupported()
    const supportedBiometrics = await Keychain.canImplyAuthentication({
      authenticationType: Keychain.AUTHENTICATION_TYPE.BIOMETRICS,
    })
    return supportedBiometrics && hasBiometricHardware
  }

  throw new Error('Unsupported platform')
}
github Emurgo / yoroi-mobile / src / helpers / deviceSettings.js View on Github external
export const isSystemAuthSupported = async () => {
  if (Platform.OS === 'android') {
    return await KeyStoreBridge.isSystemAuthSupported()
  } else if (Platform.OS === 'ios') {
    const supportedSystemAuth = await Keychain.canImplyAuthentication({
      authenticationType:
        Keychain.AUTHENTICATION_TYPE.DEVICE_PASSCODE_OR_BIOMETRICS,
    })
    return supportedSystemAuth
  }

  throw new Error('Unsupported platform')
}
github MetaMask / metamask-mobile / app / core / SecureKeychain.js View on Github external
keychainObject.password = decrypted.password;
				instance.isAuthenticating = false;
				return keychainObject;
			}
			instance.isAuthenticating = false;
		}
		return null;
	},

	async setGenericPassword(key, password, authOptions) {
		const encryptedPassword = await instance.encryptPassword(password);
		return Keychain.setGenericPassword(key, encryptedPassword, { ...defaultOptions, ...authOptions });
	},
	ACCESS_CONTROL: Keychain.ACCESS_CONTROL,
	ACCESSIBLE: Keychain.ACCESSIBLE,
	AUTHENTICATION_TYPE: Keychain.AUTHENTICATION_TYPE
};