expo-secure-store
Advanced tools
Comparing version 10.1.0 to 10.2.0
export declare type KeychainAccessibilityConstant = number; | ||
/** | ||
* The data in the keychain item cannot be accessed after a restart until the device has been | ||
* unlocked once by the user. This may be useful if you need to access the item when the phone | ||
* is locked. | ||
*/ | ||
export declare const AFTER_FIRST_UNLOCK: KeychainAccessibilityConstant; | ||
/** | ||
* Similar to `AFTER_FIRST_UNLOCK`, except the entry is not migrated to a new device when restoring | ||
* from a backup. | ||
*/ | ||
export declare const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: KeychainAccessibilityConstant; | ||
/** | ||
* The data in the keychain item can always be accessed regardless of whether the device is locked. | ||
* This is the least secure option. | ||
*/ | ||
export declare const ALWAYS: KeychainAccessibilityConstant; | ||
/** | ||
* Similar to `WHEN_UNLOCKED_THIS_DEVICE_ONLY`, except the user must have set a passcode in order to | ||
* store an entry. If the user removes their passcode, the entry will be deleted. | ||
*/ | ||
export declare const WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: KeychainAccessibilityConstant; | ||
/** | ||
* Similar to `ALWAYS`, except the entry is not migrated to a new device when restoring from a backup. | ||
*/ | ||
export declare const ALWAYS_THIS_DEVICE_ONLY: KeychainAccessibilityConstant; | ||
/** | ||
* The data in the keychain item can be accessed only while the device is unlocked by the user. | ||
*/ | ||
export declare const WHEN_UNLOCKED: KeychainAccessibilityConstant; | ||
/** | ||
* Similar to `WHEN_UNLOCKED`, except the entry is not migrated to a new device when restoring from | ||
* a backup. | ||
*/ | ||
export declare const WHEN_UNLOCKED_THIS_DEVICE_ONLY: KeychainAccessibilityConstant; | ||
export declare type SecureStoreOptions = { | ||
/** | ||
* - iOS: The item's service, equivalent to `kSecAttrService` | ||
* - Android: Equivalent of the public/private key pair `Alias` | ||
* > If the item is set with the `keychainService` option, it will be required to later fetch the value. | ||
*/ | ||
keychainService?: string; | ||
/** | ||
* __(iOS only)__ Specifies when the stored entry is accessible, using iOS's `kSecAttrAccessible` | ||
* property. See Apple's documentation on [keychain item accessibility](https://developer.apple.com/library/content/documentation/Security/Conceptual/keychainServConcepts/02concepts/concepts.html#//apple_ref/doc/uid/TP30000897-CH204-SW18). | ||
* Default value: `SecureStore.WHEN_UNLOCKED`. | ||
*/ | ||
keychainAccessible?: KeychainAccessibilityConstant; | ||
}; | ||
/** | ||
* Returns whether the SecureStore API is enabled on the current device. This does not check the app permissions. | ||
* Returns whether the SecureStore API is enabled on the current device. This does not check the app | ||
* permissions. | ||
* | ||
* @returns Async `boolean`, indicating whether the SecureStore API is available on the current device. Currently this resolves `true` on iOS and Android only. | ||
* @return Promise which fulfils witch `boolean`, indicating whether the SecureStore API is available | ||
* on the current device. Currently this resolves `true` on iOS and Android only. | ||
*/ | ||
export declare function isAvailableAsync(): Promise<boolean>; | ||
/** | ||
* Delete the value associated with the provided key. | ||
* | ||
* @param key The key that was used to store the associated value. | ||
* @param options An [`SecureStoreOptions`](#securestoreoptions) object. | ||
* | ||
* @return A promise that will reject if the value couldn't be deleted. | ||
*/ | ||
export declare function deleteItemAsync(key: string, options?: SecureStoreOptions): Promise<void>; | ||
/** | ||
* Fetch the stored value associated with the provided key. | ||
* | ||
* @param key The key that was used to store the associated value. | ||
* @param options An [`SecureStoreOptions`](#securestoreoptions) object. | ||
* | ||
* @return A promise that resolves to the previously stored value, or `null` if there is no entry | ||
* for the given key. The promise will reject if an error occurred while retrieving the value. | ||
*/ | ||
export declare function getItemAsync(key: string, options?: SecureStoreOptions): Promise<string | null>; | ||
/** | ||
* Store a key–value pair. | ||
* | ||
* @param key The key to associate with the stored value. Keys may contain alphanumeric characters | ||
* `.`, `-`, and `_`. | ||
* @param value The value to store. Size limit is 2048 bytes. | ||
* @param options An [`SecureStoreOptions`](#securestoreoptions) object. | ||
* | ||
* @return A promise that will reject if value cannot be stored on the device. | ||
*/ | ||
export declare function setItemAsync(key: string, value: string, options?: SecureStoreOptions): Promise<void>; |
import { UnavailabilityError } from '@unimodules/core'; | ||
import ExpoSecureStore from './ExpoSecureStore'; | ||
// @needsAudit | ||
/** | ||
* The data in the keychain item cannot be accessed after a restart until the device has been | ||
* unlocked once by the user. This may be useful if you need to access the item when the phone | ||
* is locked. | ||
*/ | ||
export const AFTER_FIRST_UNLOCK = ExpoSecureStore.AFTER_FIRST_UNLOCK; | ||
// @needsAudit | ||
/** | ||
* Similar to `AFTER_FIRST_UNLOCK`, except the entry is not migrated to a new device when restoring | ||
* from a backup. | ||
*/ | ||
export const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY = ExpoSecureStore.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY; | ||
// @needsAudit | ||
/** | ||
* The data in the keychain item can always be accessed regardless of whether the device is locked. | ||
* This is the least secure option. | ||
*/ | ||
export const ALWAYS = ExpoSecureStore.ALWAYS; | ||
// @needsAudit | ||
/** | ||
* Similar to `WHEN_UNLOCKED_THIS_DEVICE_ONLY`, except the user must have set a passcode in order to | ||
* store an entry. If the user removes their passcode, the entry will be deleted. | ||
*/ | ||
export const WHEN_PASSCODE_SET_THIS_DEVICE_ONLY = ExpoSecureStore.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY; | ||
// @needsAudit | ||
/** | ||
* Similar to `ALWAYS`, except the entry is not migrated to a new device when restoring from a backup. | ||
*/ | ||
export const ALWAYS_THIS_DEVICE_ONLY = ExpoSecureStore.ALWAYS_THIS_DEVICE_ONLY; | ||
// @needsAudit | ||
/** | ||
* The data in the keychain item can be accessed only while the device is unlocked by the user. | ||
*/ | ||
export const WHEN_UNLOCKED = ExpoSecureStore.WHEN_UNLOCKED; | ||
// @needsAudit | ||
/** | ||
* Similar to `WHEN_UNLOCKED`, except the entry is not migrated to a new device when restoring from | ||
* a backup. | ||
*/ | ||
export const WHEN_UNLOCKED_THIS_DEVICE_ONLY = ExpoSecureStore.WHEN_UNLOCKED_THIS_DEVICE_ONLY; | ||
const VALUE_BYTES_LIMIT = 2048; | ||
// @needsAudit | ||
/** | ||
* Returns whether the SecureStore API is enabled on the current device. This does not check the app permissions. | ||
* Returns whether the SecureStore API is enabled on the current device. This does not check the app | ||
* permissions. | ||
* | ||
* @returns Async `boolean`, indicating whether the SecureStore API is available on the current device. Currently this resolves `true` on iOS and Android only. | ||
* @return Promise which fulfils witch `boolean`, indicating whether the SecureStore API is available | ||
* on the current device. Currently this resolves `true` on iOS and Android only. | ||
*/ | ||
@@ -19,2 +56,11 @@ export async function isAvailableAsync() { | ||
} | ||
// @needsAudit | ||
/** | ||
* Delete the value associated with the provided key. | ||
* | ||
* @param key The key that was used to store the associated value. | ||
* @param options An [`SecureStoreOptions`](#securestoreoptions) object. | ||
* | ||
* @return A promise that will reject if the value couldn't be deleted. | ||
*/ | ||
export async function deleteItemAsync(key, options = {}) { | ||
@@ -27,2 +73,12 @@ _ensureValidKey(key); | ||
} | ||
// @needsAudit | ||
/** | ||
* Fetch the stored value associated with the provided key. | ||
* | ||
* @param key The key that was used to store the associated value. | ||
* @param options An [`SecureStoreOptions`](#securestoreoptions) object. | ||
* | ||
* @return A promise that resolves to the previously stored value, or `null` if there is no entry | ||
* for the given key. The promise will reject if an error occurred while retrieving the value. | ||
*/ | ||
export async function getItemAsync(key, options = {}) { | ||
@@ -32,2 +88,13 @@ _ensureValidKey(key); | ||
} | ||
// @needsAudit | ||
/** | ||
* Store a key–value pair. | ||
* | ||
* @param key The key to associate with the stored value. Keys may contain alphanumeric characters | ||
* `.`, `-`, and `_`. | ||
* @param value The value to store. Size limit is 2048 bytes. | ||
* @param options An [`SecureStoreOptions`](#securestoreoptions) object. | ||
* | ||
* @return A promise that will reject if value cannot be stored on the device. | ||
*/ | ||
export async function setItemAsync(key, value, options = {}) { | ||
@@ -34,0 +101,0 @@ _ensureValidKey(key); |
@@ -11,2 +11,14 @@ # Changelog | ||
### 💡 Others | ||
## 10.2.0 — 2021-06-16 | ||
### 🐛 Bug fixes | ||
- Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman)) | ||
### 💡 Others | ||
- Build Android code using Java 8 to fix Android instrumented test build error. ([#12939](https://github.com/expo/expo/pull/12939) by [@kudo](https://github.com/kudo)) | ||
## 10.1.0 — 2021-03-10 | ||
@@ -21,9 +33,8 @@ | ||
- Data saved with `expo-secure-store` is no longer lost upon ejecting, **if you first upgrade your app to SDK 41 before ejecting**. ([#11309](https://github.com/expo/expo/pull/11309) by [@cruzach](https://github.com/cruzach)) | ||
> On Android, all of your `SecureStore` data will be migrated on app start-up. On iOS, keys and their associated data will be migrated whenever you call `getItemAsync` on that key. This means that any keys you don't `get` while on SDK 41 will **not** be migrated. | ||
> On Android, all of your `SecureStore` data will be migrated on app start-up. On iOS, keys and their associated data will be migrated whenever you call `getItemAsync` on that key. This means that any keys you don't `get` while on SDK 41 will **not** be migrated.## 10.0.0 — 2021-01-15 | ||
## 10.0.0 — 2021-01-15 | ||
### 🛠 Breaking changes | ||
### 🛠 Breaking changes- Dropped support for iOS 10.0 ([#11344](https://github.com/expo/expo/pull/11344) by [@tsapeta](https://github.com/tsapeta)) | ||
- Dropped support for iOS 10.0 ([#11344](https://github.com/expo/expo/pull/11344) by [@tsapeta](https://github.com/tsapeta)) | ||
## 9.3.0 — 2020-11-17 | ||
@@ -30,0 +41,0 @@ |
{ | ||
"name": "expo-secure-store", | ||
"version": "10.1.0", | ||
"version": "10.2.0", | ||
"description": "Provides a way to encrypt and securely store key–value pairs locally on the device.", | ||
@@ -44,3 +44,3 @@ "main": "build/SecureStore.js", | ||
}, | ||
"gitHead": "5b57d1fd0a20294c1dec7c43b5df34dd6425d1a5" | ||
"gitHead": "b33f5e224578564c3e4b1b467f258cc119b3b786" | ||
} |
@@ -7,11 +7,51 @@ import { UnavailabilityError } from '@unimodules/core'; | ||
// @needsAudit | ||
/** | ||
* The data in the keychain item cannot be accessed after a restart until the device has been | ||
* unlocked once by the user. This may be useful if you need to access the item when the phone | ||
* is locked. | ||
*/ | ||
export const AFTER_FIRST_UNLOCK: KeychainAccessibilityConstant = ExpoSecureStore.AFTER_FIRST_UNLOCK; | ||
// @needsAudit | ||
/** | ||
* Similar to `AFTER_FIRST_UNLOCK`, except the entry is not migrated to a new device when restoring | ||
* from a backup. | ||
*/ | ||
export const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: KeychainAccessibilityConstant = | ||
ExpoSecureStore.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY; | ||
// @needsAudit | ||
/** | ||
* The data in the keychain item can always be accessed regardless of whether the device is locked. | ||
* This is the least secure option. | ||
*/ | ||
export const ALWAYS: KeychainAccessibilityConstant = ExpoSecureStore.ALWAYS; | ||
// @needsAudit | ||
/** | ||
* Similar to `WHEN_UNLOCKED_THIS_DEVICE_ONLY`, except the user must have set a passcode in order to | ||
* store an entry. If the user removes their passcode, the entry will be deleted. | ||
*/ | ||
export const WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: KeychainAccessibilityConstant = | ||
ExpoSecureStore.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY; | ||
// @needsAudit | ||
/** | ||
* Similar to `ALWAYS`, except the entry is not migrated to a new device when restoring from a backup. | ||
*/ | ||
export const ALWAYS_THIS_DEVICE_ONLY: KeychainAccessibilityConstant = | ||
ExpoSecureStore.ALWAYS_THIS_DEVICE_ONLY; | ||
// @needsAudit | ||
/** | ||
* The data in the keychain item can be accessed only while the device is unlocked by the user. | ||
*/ | ||
export const WHEN_UNLOCKED: KeychainAccessibilityConstant = ExpoSecureStore.WHEN_UNLOCKED; | ||
// @needsAudit | ||
/** | ||
* Similar to `WHEN_UNLOCKED`, except the entry is not migrated to a new device when restoring from | ||
* a backup. | ||
*/ | ||
export const WHEN_UNLOCKED_THIS_DEVICE_ONLY: KeychainAccessibilityConstant = | ||
@@ -22,11 +62,25 @@ ExpoSecureStore.WHEN_UNLOCKED_THIS_DEVICE_ONLY; | ||
// @needsAudit | ||
export type SecureStoreOptions = { | ||
/** | ||
* - iOS: The item's service, equivalent to `kSecAttrService` | ||
* - Android: Equivalent of the public/private key pair `Alias` | ||
* > If the item is set with the `keychainService` option, it will be required to later fetch the value. | ||
*/ | ||
keychainService?: string; | ||
/** | ||
* __(iOS only)__ Specifies when the stored entry is accessible, using iOS's `kSecAttrAccessible` | ||
* property. See Apple's documentation on [keychain item accessibility](https://developer.apple.com/library/content/documentation/Security/Conceptual/keychainServConcepts/02concepts/concepts.html#//apple_ref/doc/uid/TP30000897-CH204-SW18). | ||
* Default value: `SecureStore.WHEN_UNLOCKED`. | ||
*/ | ||
keychainAccessible?: KeychainAccessibilityConstant; | ||
}; | ||
// @needsAudit | ||
/** | ||
* Returns whether the SecureStore API is enabled on the current device. This does not check the app permissions. | ||
* Returns whether the SecureStore API is enabled on the current device. This does not check the app | ||
* permissions. | ||
* | ||
* @returns Async `boolean`, indicating whether the SecureStore API is available on the current device. Currently this resolves `true` on iOS and Android only. | ||
* @return Promise which fulfils witch `boolean`, indicating whether the SecureStore API is available | ||
* on the current device. Currently this resolves `true` on iOS and Android only. | ||
*/ | ||
@@ -37,2 +91,11 @@ export async function isAvailableAsync(): Promise<boolean> { | ||
// @needsAudit | ||
/** | ||
* Delete the value associated with the provided key. | ||
* | ||
* @param key The key that was used to store the associated value. | ||
* @param options An [`SecureStoreOptions`](#securestoreoptions) object. | ||
* | ||
* @return A promise that will reject if the value couldn't be deleted. | ||
*/ | ||
export async function deleteItemAsync( | ||
@@ -50,2 +113,12 @@ key: string, | ||
// @needsAudit | ||
/** | ||
* Fetch the stored value associated with the provided key. | ||
* | ||
* @param key The key that was used to store the associated value. | ||
* @param options An [`SecureStoreOptions`](#securestoreoptions) object. | ||
* | ||
* @return A promise that resolves to the previously stored value, or `null` if there is no entry | ||
* for the given key. The promise will reject if an error occurred while retrieving the value. | ||
*/ | ||
export async function getItemAsync( | ||
@@ -59,2 +132,13 @@ key: string, | ||
// @needsAudit | ||
/** | ||
* Store a key–value pair. | ||
* | ||
* @param key The key to associate with the stored value. Keys may contain alphanumeric characters | ||
* `.`, `-`, and `_`. | ||
* @param value The value to store. Size limit is 2048 bytes. | ||
* @param options An [`SecureStoreOptions`](#securestoreoptions) object. | ||
* | ||
* @return A promise that will reject if value cannot be stored on the device. | ||
*/ | ||
export async function setItemAsync( | ||
@@ -61,0 +145,0 @@ key: string, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
74380
444