Registry / security / rn-secure-storage

rn-secure-storage

JSON →
library3.0.1jsnpmunverified

React Native library for secure storage using iOS Keychain and Android Keystore. Current stable version is 3.0.1, released in 2023. v3 introduced breaking API changes, renamed and expanded methods (e.g., setItem/getItem), and requires Android minSdkVersion 23. Provides AES-GCM encryption on Android and uses iOS biometric authentication. Supports multiple value operations like multiSet, multiGet, multiRemove, and getAllKeys. Compared to react-native-keychain, it offers a simpler async/await API and TypeScript types.

npm install rn-secure-storage
INSTALL
IMPORT
SIG · RN-SECURE-STORAGE
R
rn-secure-storage
securityjavascriptv3.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RNSecureStorage
import RNSecureStorage from 'rn-secure-storage'
import { RNSecureStorage } from 'rn-secure-storage'
Default export in v3; named export does not exist
ACCESSIBLE
import { ACCESSIBLE } from 'rn-secure-storage'
import ACCESSIBLE from 'rn-secure-storage'
Named export for iOS accessibility options
RNSecureStorage.setItem
RNSecureStorage.setItem('key', 'value')
RNSecureStorage.setItem('key', 'value', {})
Third argument options object is optional

Basic set and get operations with async/await, showing default import and error handling.

import RNSecureStorage from 'rn-secure-storage'; async function storeAndRetrieve() { try { await RNSecureStorage.setItem('token', 'abc123'); const token = await RNSecureStorage.getItem('token'); console.log(token); // 'abc123' } catch (error) { console.error(error); } } storeAndRetrieve();
Debug
Known issues
breakingAPI changed from set()/get() to setItem()/getItem() in v3
fix
Replace set() with setItem() and get() with getItem().
affects: >=3.0.0
breakingAndroid minSdkVersion raised to 23 (Marshmallow)
fix
Update minSdkVersion in android/build.gradle to 23.
affects: >=3.0.0
deprecatedexist() method is deprecated; use exists() instead
fix
Use exists() method instead of exist().
affects: >=3.0.0 <=3.0.0
gotchaAsync functions must be called after component mount in React Native; calling in constructor causes app crash
fix
Call RNSecureStorage methods inside useEffect or componentDidMount.
affects: all
gotchaEmulator may lack Keychain/Keystore support; methods reject with error
fix
Handle errors gracefully and test on physical devices.
affects: all
Errors
Common errors & fixes
Error: Encryption/Decryption failed
Android Keystore corruption after app restore from backup
fix
Clear Keystore by calling RNSecureStorage.clear() or uninstall the app.
TypeError: RNSecureStorage.setItem is not a function
Misuse of named import instead of default import in v3
fix
Change import to: import RNSecureStorage from 'rn-secure-storage'
Error: not found
Getting a non-existent key without checking existence first
fix
Use exists() to check before getItem(), or catch the error.
RNSecureStorage: Native module cannot be null
Native module not linked in React Native CLI projects
fix
Run 'npx react-native link rn-secure-storage' or reinstall pods with 'cd ios && pod install'
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
expooptionalOptional dependency for Expo projects to integrate autolinking, but works standalone with React Native CLI
Agent activity
30 hits · last 30 days
node
26
Amazon
1
OpenAI (training)
1
Resources
rn-secure-storage — npm install rn-secure-storage · libregistry