Device
Methods
getAvailableHardware
Gets the types of biometrics the device supports.
Usage
const hardware = await Device.getAvailableHardware();
hardware.forEach((biometricType) => console.log("Type: " + biometricType));
Returns: Promise<SupportedBiometricType[]>
getBiometricStrengthLevel
Checks the device biometric strength level.
On iOS this will always return 'strong'.
Usage
const biometricStrength = await Device.getBiometricStrengthLevel();
Returns: Promise<BiometricSecurityStrength>
hasSecureHardware
Check if the device has a secure hardware enclave.
Usage
const hasSecureHardware = await Device.hasSecureHardware();
if (!hasSecureHardware) {
// this device doesn't have secure hardware
}
Returns: Promise<boolean>
isBiometricsAllowed
Returns the current state of biometric permissions.
On Android and iOS devices with TouchID, this always returns granted
.
Usage
const permissions = await Device.isBiometricsAllowed();
if (permissions === BiometricPermissionState.Denied) {
// user must enable FaceID for the application...
}
Returns: Promise<BiometricPermissionState>
isBiometricsEnabled
Check whether or not biometrics is supported by the device and has been configured by the current user of the device.
Usage
const biometricsEnabled = await Device.isBiometricsEnabled();
if (!biometricsEnabled) {
// biometrics not enabled on this device...
}
Returns: Promise<boolean>
isBiometricsSupported
Check whether or not biometrics is supported by the device.
Usage
const biometricsSupported = await Device.isBiometricsSupported();
if (biometricsSupported) {
// biometrics is supported on this device...
}
Returns: Promise<boolean>
isHideScreenOnBackgroundEnabled
Check whether or not the screen will be obscured in app switcher mode.
Usage
const willHideScreen = await Device.isHideScreenOnBackgroundEnabled();
Returns: Promise<boolean>
isLockedOutOfBiometrics
Check whether biometrics are locked out on the device.
On Android, the locked out state will only known after an attempted biometric unlock.
Usage
const isLockedOut = await Device.isLockedOutOfBiometrics();
if (isLockedOut) {
// device is locked out ...
}
Returns: Promise<boolean>
isSystemPasscodeSet
Check whether the device OS-level passcode has been set.
Usage
const hasSystemPasscode = await Device.isSystemPasscodeSet();
if (hasSystemPasscode) {
// device has a system passcode
}
Returns: Promise<boolean>
setHideScreenOnBackground
Set whether or not the screen will be obscured in app switcher mode. If enabled, by default the screen behind biometric prompts will be obscured via the splash screen.
For Android, an optional boolean dimBiometrics can be set to obscure the screen behind biometric prompts via dimming the background instead.
Usage
await Device.setHideScreenOnBackground(true, true);
Parameters
Name | Type | Default value |
---|---|---|
enabled | boolean | false |
dimBiometrics | boolean | false |
Returns: Promise<void>
showBiometricPrompt
Show a biometric prompt.
Usage
try {
const promptConfig = {...};
await Device.showBiometricPrompt(promptConfig);
// biometric prompt succeeded successfully
} catch (err) {
// handle error
}
Parameters
Name | Type |
---|---|
config | PromptConfig |
Returns: Promise<void>