Skip to main content
‹ Device capabilities
Constants

HardwareSecurityLevel

The hardware that keeps Keystore keys on Android: StrongBox, the Trusted Execution Environment, or software. A constant object and a type of the same name.

Import
import { HardwareSecurityLevel } from '@apexnative/keychain';

What getHardwareSecurityLevel answers for the device, and what getItemInfo reports as android.securityLevel for an item.

Usage​

import { HardwareSecurityLevel, keychain } from '@apexnative/keychain';

const info = await keychain.getItemInfo('accessToken');
const inHardware = info?.android?.securityLevel !== HardwareSecurityLevel.Software;

Signature​

const HardwareSecurityLevel: {
readonly Strongbox: 'strongbox';
readonly Tee: 'tee';
readonly Software: 'software';
};

type HardwareSecurityLevel = (typeof HardwareSecurityLevel)[keyof typeof HardwareSecurityLevel];
Type'strongbox' | 'tee' | 'software'PlatformsiOS (not supported)Android

Values​

ConstantStringThe key lives in
Strongbox'strongbox'A StrongBox secure element: a separate chip with its own processor and storage
Tee'tee'The Trusted Execution Environment of the main processor
Software'software'Software only: an emulator, or a device without secure hardware

The same strings name the hardware in KeyStorage, the option that asks for it.

See also​