Skip to main content
Version: 5.0

Device

Methods

getAvailableHardware

Gets the types of biometrics the device supports.

Usage


_10
const hardware = await Device.getAvailableHardware();
_10
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


_10
const biometricStrength = await Device.getBiometricStrengthLevel();

Returns: Promise<BiometricSecurityStrength>

hasSecureHardware

Check if the device has a secure hardware enclave.

Usage


_10
const hasSecureHardware = await Device.hasSecureHardware();
_10
if (!hasSecureHardware) {
_10
// this device doesn't have secure hardware
_10
}

Returns: Promise<boolean>

isBiometricsAllowed

Returns the current state of biometric permissions.

On Android and iOS devices with TouchID, this always returns granted.

Usage


_10
const permissions = await Device.isBiometricsAllowed();
_10
if (permissions === BiometricPermissionState.Denied) {
_10
// user must enable FaceID for the application...
_10
}

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


_10
const biometricsEnabled = await Device.isBiometricsEnabled();
_10
if (!biometricsEnabled) {
_10
// biometrics not enabled on this device...
_10
}

Returns: Promise<boolean>

isBiometricsSupported

Check whether or not biometrics is supported by the device.

Usage


_10
const biometricsSupported = await Device.isBiometricsSupported();
_10
if (biometricsSupported) {
_10
// biometrics is supported on this device...
_10
}

Returns: Promise<boolean>

isHideScreenOnBackgroundEnabled

Check whether or not the screen will be obscured in app switcher mode.

Usage


_10
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


_10
const isLockedOut = await Device.isLockedOutOfBiometrics();
_10
if (isLockedOut) {
_10
// device is locked out ...
_10
}

Returns: Promise<boolean>

isSystemPasscodeSet

Check whether the device OS-level passcode has been set.

Usage


_10
const hasSystemPasscode = await Device.isSystemPasscodeSet();
_10
if (hasSystemPasscode) {
_10
// device has a system passcode
_10
}

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


_10
await Device.setHideScreenOnBackground(true, true);

Parameters

NameTypeDefault value
enabledbooleanfalse
dimBiometricsbooleanfalse

Returns: Promise<void>

showBiometricPrompt

Show a biometric prompt.

Usage


_10
try {
_10
const promptConfig = {...};
_10
await Device.showBiometricPrompt(promptConfig);
_10
// biometric prompt succeeded successfully
_10
} catch (err) {
_10
// handle error
_10
}

Parameters

NameType
configPromptConfig

Returns: Promise<void>