---
title: kSecAttrAccessibleWhenUnlockedThisDeviceOnly
framework: security
role: symbol
role_heading: Global Variable
path: security/ksecattraccessiblewhenunlockedthisdeviceonly
---

# kSecAttrAccessibleWhenUnlockedThisDeviceOnly

The data in the keychain item can be accessed only while the device is unlocked by the user.

## Declaration

```swift
let kSecAttrAccessibleWhenUnlockedThisDeviceOnly: CFString
```

## Mentioned in

Protecting keys with the Secure Enclave

## Discussion

Discussion This is recommended for items that need to be accessible only while the application is in the foreground. Items with this attribute do not migrate to a new device. Thus, after restoring from a backup of a different device, these items will not be present.
