Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
expo-secure-store
Advanced tools
Provides a way to encrypt and securely store key-value pairs locally on the device.
The expo-secure-store package provides a way to securely store key-value pairs in a device's secure storage. This is useful for storing sensitive information such as authentication tokens, user preferences, and other confidential data.
Storing a value
This feature allows you to store a key-value pair securely. The `setItemAsync` method takes a key and a value as arguments and stores them in the secure storage.
import * as SecureStore from 'expo-secure-store';
async function save(key, value) {
await SecureStore.setItemAsync(key, value);
}
Retrieving a value
This feature allows you to retrieve a value stored under a specific key. The `getItemAsync` method takes a key as an argument and returns the corresponding value.
import * as SecureStore from 'expo-secure-store';
async function getValueFor(key) {
let result = await SecureStore.getItemAsync(key);
if (result) {
console.log("🔐 Here's your value 🔐 \n" + result);
} else {
console.log('No value stored under that key.');
}
}
Deleting a value
This feature allows you to delete a key-value pair from the secure storage. The `deleteItemAsync` method takes a key as an argument and removes the corresponding key-value pair from the storage.
import * as SecureStore from 'expo-secure-store';
async function deleteValueFor(key) {
await SecureStore.deleteItemAsync(key);
}
The react-native-keychain package provides similar functionality for securely storing key-value pairs. It supports both iOS and Android and offers additional features such as biometric authentication. Compared to expo-secure-store, react-native-keychain provides more advanced security options but may require more setup.
The redux-persist-sensitive-storage package is designed to work with redux-persist to securely store sensitive data. It uses the device's secure storage mechanisms and is a good option if you are already using Redux for state management. Compared to expo-secure-store, it integrates more seamlessly with Redux but is less general-purpose.
The secure-store package is another option for securely storing key-value pairs. It is lightweight and easy to use, making it a good alternative to expo-secure-store for simple use cases. However, it may not offer as many features or as much flexibility as expo-secure-store.
Provides a way to encrypt and securely store key–value pairs locally on the device.
For managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release.
For bare React Native projects, you must ensure that you have installed and configured the expo
package before continuing.
npx expo install expo-secure-store
No additional set up necessary.
Run npx pod-install
after installing the npm package.
Contributions are very welcome! Please refer to guidelines described in the contributing guide.
FAQs
Provides a way to encrypt and securely store key-value pairs locally on the device.
The npm package expo-secure-store receives a total of 187,762 weekly downloads. As such, expo-secure-store popularity was classified as popular.
We found that expo-secure-store demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.