Types
Types of device capabilities
What canUseAccessControl answers.
Import
import { type AccessControlAvailability } from '@apexnative/keychain';
AccessControlAvailability
type AccessControlAvailability =
| { available: true }
| {
available: false;
reason: 'noHardware' | 'notEnrolled' | 'passcodeNotSet' | 'unsupportedOS';
};
Whether an access control can protect an item on this device now, and why not when it can't: the answer of canUseAccessControl. Check available first; TypeScript then knows whether there is a reason.
| Field | Type | Description |
|---|---|---|
| availableRequired | boolean | Whether a write with the access control would succeed now. |
| reason | string | Only when available is false. 'unsupportedOS': a value with the passcode on Android 7–10. 'noHardware': no biometric sensor that can unlock a key. 'passcodeNotSet': no passcode, PIN or pattern. 'notEnrolled': no face or finger enrolled. When several are true, the first in this order. |
A temporary lockout of the biometrics is not a reason: the answer stays available, and a read meets the lockout as LOCKOUT.