Registry / storage / redux-persist-expo-securestore

redux-persist-expo-securestore

JSON →
library2.0.0jsnpmunverified

A storage engine for redux-persist that leverages Expo's SecureStore to persist Redux state securely on iOS and Android. Version 2.0.0 is the latest stable release, requiring peer dependency expo-secure-store ^5.0.1. It exports a createSecureStore() factory that returns an object conforming to redux-persist's storage API. Key differentiator: offers iOS keychain services with configurable accessibility options (e.g., WHEN_UNLOCKED, AFTER_FIRST_UNLOCK, ALWAYS) and Android's encrypted SharedPreferences. TypeScript types are included. Note that the package ships untranspiled code, so Jest transformIgnorePatterns must be updated to exclude it.

npm install redux-persist-expo-securestore
INSTALL
IMPORT
SIG · REDUX-PERSIST-EXPO
R
redux-persist-expo-securestore
storagejavascriptv2.0.0
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.

createSecureStore
import createSecureStore from 'redux-persist-expo-securestore';
import { createSecureStore } from 'redux-persist-expo-securestore';
This is a default export, not a named export.
createSecureStore
const createSecureStore = require('redux-persist-expo-securestore');
const { createSecureStore } = require('redux-persist-expo-securestore');
CommonJS require uses default import, not named destructuring.
createSecureStore function type
import type { SecureStoreOptions } from 'expo-secure-store';
import { SecureStoreOptions } from 'redux-persist-expo-securestore';
Options type is from expo-secure-store, not from this package. The package does not export its own option type.

Sets up redux-persist with Expo SecureStore storage engine, creating a persistor and store.

import createSecureStore from 'redux-persist-expo-securestore'; import { persistStore, persistReducer } from 'redux-persist'; import { combineReducers, createStore } from 'redux'; const secureStorage = createSecureStore(); const persistConfig = { key: 'root', storage: secureStorage, }; const rootReducer = combineReducers({ // your reducers }); const persistedReducer = persistReducer(persistConfig, rootReducer); const store = createStore(persistedReducer); const persistor = persistStore(store); export { store, persistor };
Debug
Known issues
gotchaPackage ships untranspiled code; must add 'redux-persist-expo-securestore' to Jest's transformIgnorePatterns whitelist.
fix
Update transformIgnorePatterns in Jest config: add 'redux-persist-expo-securestore' to the excluded list (see README).
affects: >=1.0.0
gotchacreateSecureStore() returns a storage object, not the options. Do not pass options directly to redux-persist config.
fix
Call createSecureStore(options) to get storage, then assign to config.storage.
affects: >=1.0.0
gotchaRequires expo-secure-store peer dependency ^5.0.1. Using incompatible version may cause runtime errors.
fix
Install expo-secure-store@^5.0.1: npm install expo-secure-store@^5.0.1
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'expo-secure-store'
Missing peer dependency expo-secure-store
fix
Install expo-secure-store: npm install expo-secure-store
Invariant Violation: Expected a valid storage object
Passed createSecureStore options object directly to redux-persist config.storage instead of calling createSecureStore() first
fix
Use config.storage = createSecureStore(options) or config.storage = createSecureStore()
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
expo-secure-storerequiredPeer dependency: Core native module used for secure storage
Agent activity
22 hits · last 30 days
node
18
Amazon
1
Resources
redux-persist-expo-securestore — npm install redux-persist-expo-securestore · libregistry