Accessibility
public enum Accessibility
Predefined Accessibility levels used to secure Keychain items with various security levels.
-
Default kSecAttrAccessible all keychain items are stored with unless otherwise specified
Declaration
Swift
public static let `default`: Keychain.Accessibility
-
Item data can only be accessed once the device has been unlocked after a restart. This is recommended for items that need to be accesible by background applications. Items with this attribute will migrate to a new device when using encrypted backups.
Declaration
Swift
case afterFirstUnlock
-
Item data can only be accessed once the device has been unlocked after a restart. This is recommended for items that need to be accessible by background applications. Items with this attribute will never migrate to a new device, so after a backup is restored to a new device these items will be missing.
Declaration
Swift
case afterFirstUnlockThisDeviceOnly
-
Item data can always be accessed regardless of the lock state of the device. This is not recommended for anything except system use. Items with this attribute will migrate to a new device when using encrypted backups.
Declaration
Swift
case always
-
Item data can always be accessed regardless of the lock state of the device. This option is not recommended for anything except system use. Items with this attribute will never migrate to a new device, so after a backup is restored to a new device, these items will be missing.
Declaration
Swift
case alwaysThisDeviceOnly
-
Item data can only be accessed while the device is unlocked. This is recommended for items that only need to be accessible while the application is in the foreground and requires a passcode to be set on the device. Items with this attribute will never migrate to a new device, so after a backup is restored to a new device, these items will be missing. This attribute will not be available on devices without a passcode. Disabling the device passcode will cause all previously protected items to be deleted.
Declaration
Swift
case whenPasscodeSetThisDeviceOnly
-
Item data can only be accessed while the device is unlocked. This is recommended for items that only need be accesible while the application is in the foreground. Items with this attribute will migrate to a new device when using encrypted backups.
Declaration
Swift
case whenUnlocked
-
Item data can only be accessed while the device is unlocked. This is recommended for items that only need be accesible while the application is in the foreground. Items with this attribute will never migrate to a new device, so after a backup is restored to a new device, these items will be missing.
Declaration
Swift
case whenUnlockedThisDeviceOnly