Registry / storage / react-native-fast-secure-storage

react-native-fast-secure-storage

JSON →
library1.2.3jsnpmunverified

A fast, secure key-value storage library for React Native (iOS & Android) that provides encrypted data storage with a simple async API. Current version 1.2.3. Uses native iOS Keychain and Android EncryptedSharedPreferences for encryption. Differentiators: supports synchronous getItem/setItem operations, ACCESSIBLE levels, and batch operations (setItems, getAllItems, clearStorage). Alternatives: react-native-encrypted-storage (more limited), expo-secure-store (Expo-only). Types included. Peer dependencies: react and react-native.

npm install react-native-fast-secure-storage
INSTALL
IMPORT
SIG · REACT-NATIVE-FAST-
R
react-native-fast-secure-storage
storagejavascriptv1.2.3
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.

SecureStorage
import SecureStorage from 'react-native-fast-secure-storage'
const SecureStorage = require('react-native-fast-secure-storage').default
Default export is the storage object; no named import for the default.
ACCESSIBLE
import { ACCESSIBLE } from 'react-native-fast-secure-storage'
Named export; used for optional 'accessible' parameter in setItem/setItems.
SecureStorage (sync methods)
import SecureStorage from 'react-native-fast-secure-storage'; SecureStorage.getItemSync('key')
import { SecureStorage } from 'react-native-fast-secure-storage'
Sync methods available but should be avoided on main thread; same default import.

Demonstrates basic setItem, getItem, removeItem, and hasItem usage with type safety.

import SecureStorage, { ACCESSIBLE } from 'react-native-fast-secure-storage'; async function example() { await SecureStorage.setItem('token', 'abc123', ACCESSIBLE.WHEN_UNLOCKED); const token = await SecureStorage.getItem('token'); console.log(token); // 'abc123' await SecureStorage.removeItem('token'); const hasToken = await SecureStorage.hasItem('token'); console.log(hasToken); // false } example();
Debug
Known issues
breakinggetItem throws an error if the key does not exist or value is empty (not returning null).
fix
Wrap in try/catch or use hasItem before calling getItem.
affects: >=1.0.0
deprecatedremoveItem is not a method; use deleteItem instead. (Documentation shows removeItem but likely deprecation).
fix
Use SecureStorage.deleteItem('key') instead.
affects: >=1.0.0
gotchagetAllKeys and getAllItems throw an error if no items exist (cannot be called on empty storage).
fix
Check storage size or wrap in try/catch.
affects: >=1.0.0
gotchaSync methods (getItemSync, setItemSync) run synchronously and can block the JS thread; use only for very fast operations or avoid.
fix
Prefer async methods (getItem, setItem).
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: SecureStorage.getItem is not a function
Incorrect import: using named import instead of default.
fix
import SecureStorage from 'react-native-fast-secure-storage';
Error: value does not exist
getItem called on a key that is not stored or value is empty.
fix
Use hasItem to check existence before getItem, or wrap in try/catch.
Error: Operation not supported
Calling getAllKeys or getAllItems when storage is empty.
fix
Check if storage has any items before calling, or wrap in try/catch.
Upgrade
Version history
1.2.3latest on npm
Audit
Dependencies
reactrequiredpeer dependency - React Native requires React
react-nativerequiredpeer dependency - native module initialization
Agent activity
26 hits · last 30 days
node
26
Resources
react-native-fast-secure-storage — npm install react-native-fast-secure-storage · libregistry