Skip to main content
‹ Device capabilities
Function

isPasscodeSet()

Whether the device has a passcode, PIN or pattern: the screen lock every protected item needs. It never shows a prompt.

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

Usage​

import { isPasscodeSet } from '@apexnative/keychain';

if (!(await isPasscodeSet())) {
showHint('Set a passcode on this device to protect your account with it.');
}

Signature​

function isPasscodeSet(): Promise<boolean>;
ReturnsPromise<boolean>PromptNeverPlatformsiOSAndroid

true when the device has a screen lock: a passcode on iOS, a PIN, a pattern or a password on Android (KeyguardManager.isDeviceSecure).

Every accessControl but 'none' needs it, and so does accessible: 'whenPasscodeSetThisDeviceOnly': without one, their writes fail with PASSCODE_NOT_SET. To ask about one protection, canUseAccessControl is more precise: it answers passcodeNotSet among its other reasons.

See also​