Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Commit 81725f9

Browse files
committed
docs: add storage options
1 parent 4dcc1d6 commit 81725f9

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,30 @@ async function removeUserSession() {
132132
}
133133
```
134134

135+
### Storage options
136+
137+
You can pass a set of **options** as the previous to last parameter of `setItem`, `getItem`, `removeItem` or `clear` functions:
138+
139+
```js
140+
await EncryptedStorage.removeItem('user_session', {
141+
storageName: 'userStorage',
142+
});
143+
```
144+
145+
The following options are supported:
146+
147+
- `keychainAccessibility` (**iOS only**)
148+
149+
Control item availability relative to the lock state of the device. If the attribute ends with the string `ThisDeviceOnly`, the item can be restored to the same device that created a backup, but it isn’t migrated when restoring another device’s backup data. [Read more](https://developer.apple.com/documentation/security/keychain_services/keychain_items/restricting_keychain_item_accessibility?language=objc)
150+
151+
Default value: `kSecAttrAccessibleAfterFirstUnlock`
152+
153+
- `storageName`
154+
155+
A string for identifying a set of storage items. Should not contain path separators. Uses [kSecAttrService](https://developer.apple.com/documentation/security/ksecattrservice?language=objc) on iOS and [fileName](https://developer.android.com/reference/kotlin/androidx/security/crypto/EncryptedSharedPreferences?hl=en#create) on Android.
156+
157+
Default value: App's bundle id
158+
135159
## Note regarding `Keychain` persistence
136160

137161
You'll notice that the iOS `Keychain` is not cleared when your app is uninstalled, this is the expected behaviour. However, if you do want to achieve a different behaviour, you can use the below snippet to clear the `Keychain` on the first launch of your app.

0 commit comments

Comments
 (0)