All Projects → CodingZeal → Redux Persist Sensitive Storage

CodingZeal / Redux Persist Sensitive Storage

Licence: mit
redux-persist storage engine for react-native-sensitive-info

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Redux Persist Sensitive Storage

React Native Encrypted Storage
React Native wrapper around SharedPreferences and Keychain to provide a secure alternative to Async Storage
Stars: ✭ 110 (-47.37%)
Mutual labels:  keychain, sharedpreferences
Frideos flutter
An all-in-one Fllutter package for state management, reactive objects, animations, effects, timed widgets etc.
Stars: ✭ 187 (-10.53%)
Mutual labels:  sharedpreferences
Appdatareader
A library for reading Shared Preferences and Database values within the application.
Stars: ✭ 126 (-39.71%)
Mutual labels:  sharedpreferences
Keychain Swift
Helper functions for saving text in Keychain securely for iOS, OS X, tvOS and watchOS.
Stars: ✭ 2,099 (+904.31%)
Mutual labels:  keychain
Bulldog
Android library to simplify reading and writing to SharedPreferences, never write code like this anymore prefs.edit().putString("someKey","someString").apply()
Stars: ✭ 133 (-36.36%)
Mutual labels:  sharedpreferences
Ksprefs
🚀⚡ Kotlin SharedPreferences wrapper & cryptographic preferences android library.
Stars: ✭ 176 (-15.79%)
Mutual labels:  sharedpreferences
Persistencekit
Store and retrieve Codable objects to various persistence layers, in a couple lines of code!
Stars: ✭ 121 (-42.11%)
Mutual labels:  keychain
Typedpreferences
Preference wrappers for primitive types for Android
Stars: ✭ 191 (-8.61%)
Mutual labels:  sharedpreferences
Android Prefs
Android preferences for WINNERS!
Stars: ✭ 183 (-12.44%)
Mutual labels:  sharedpreferences
Slopeninja Native
 Slope Ninja App 🎿❄️⛄️
Stars: ✭ 160 (-23.44%)
Mutual labels:  redux-persist
Zkudid
Generate and save permanent UDID with IDFV and keychain in iOS device.
Stars: ✭ 159 (-23.92%)
Mutual labels:  keychain
React Native Feature Boilerplate
Feature based Architecture for developing Scalable React Native Apps 🚀 using react, redux, sagas and hooks
Stars: ✭ 139 (-33.49%)
Mutual labels:  redux-persist
Kau
An extensive collection of Kotlin Android Utils
Stars: ✭ 182 (-12.92%)
Mutual labels:  sharedpreferences
Android Remote Debugger
A library for remote logging, database debugging, shared preferences and network requests
Stars: ✭ 132 (-36.84%)
Mutual labels:  sharedpreferences
Applocker
AppLocker - simple lock screen for iOS Application ( Swift 4+, iOS 9.0+) Touch ID / Face ID
Stars: ✭ 188 (-10.05%)
Mutual labels:  keychain
Prefs
Simple Android SharedPreferences wrapper.
Stars: ✭ 125 (-40.19%)
Mutual labels:  sharedpreferences
Cely
Plug-n-Play login system for iOS written in Swift
Stars: ✭ 158 (-24.4%)
Mutual labels:  keychain
React Native Default Preference
Use SharedPreference (Android) and UserDefaults (iOS) with React Native over a unified interface
Stars: ✭ 170 (-18.66%)
Mutual labels:  sharedpreferences
Tray
a SharedPreferences replacement for Android with multiprocess support
Stars: ✭ 2,314 (+1007.18%)
Mutual labels:  sharedpreferences
Flutter Things Todo
An example Todo App using Flutter with advanced features
Stars: ✭ 189 (-9.57%)
Mutual labels:  redux-persist

redux-persist-sensitive-storage

npm version CircleCI License

Storage engine to use react-native-sensitive-info with redux-persist.

react-native-sensitive-info manages all data stored in Android Shared Preferences and iOS Keychain.

NOTE: Android Shared Preferences are not secure, but there is a branch of react-native-sensitive-info that uses the Android keystore instead of shared preferences. You can use that branch with redux-persist-sensitive-storage if you prefer.

Installation

You can install this package using either yarn or npm. You will also need to install and link react-native-sensitive-info.

Using Yarn:

yarn add redux-persist-sensitive-storage react-native-sensitive-info
react-native link react-native-sensitive-info

Using npm:

npm install --save redux-persist-sensitive-storage react-native-sensitive-info
react-native link react-native-sensitive-info

Usage

To use redux-persist-sensitive-storage, create a sensitive storage instance using createSensitiveStorage and then configure redux-persist according to its documentation using your instance as the storage argument in the configuration.

createSensitiveStorage takes an optional set of configuration options. These are used to configure the keychain service (iOS) and shared preferences name (Android) that react-native-sensitive-info uses. See their documentation for more information.

For redux-persist v5.x or later

import { compose, applyMiddleware, createStore } from "redux";
import { persistStore, persistCombineReducers } from "redux-persist";
import createSensitiveStorage from "redux-persist-sensitive-storage";
import reducers from "./reducers"; // where reducers is an object of reducers

const storage = createSensitiveStorage({
  keychainService: "myKeychain",
  sharedPreferencesName: "mySharedPrefs"
});

const config = {
  key: "root",
  storage,
};

const reducer = persistCombineReducers(config, reducers);

function configureStore () {
  // ...
  let store = createStore(reducer);
  let persistor = persistStore(store);

  return { persistor, store };
}

You may want to only persist some keys in secure storage, and persist other parts of your state in local storage. If that's the case, you can use redux-persist's Nested Persists support. Your configuration might look something like this:

import { AsyncStorage } from "react-native";
import { combineReducers } from "redux";
import { persistReducer } from "redux-persist";
import createSensitiveStorage from "redux-persist-sensitive-storage";

import { mainReducer, tokenReducer } from "./reducers";

const sensitiveStorage = createSensitiveStorage({
  keychainService: "myKeychain",
  sharedPreferencesName: "mySharedPrefs"
});

const mainPersistConfig = {
  key: "main",
  storage: AsyncStorage,
  blacklist: ["someEphemeralKey"]
};

const tokenPersistConfig = {
  key: "token",
  storage: sensitiveStorage
};

let rootReducer = combineReducers({
  main: persistReducer(mainPersistConfig, mainReducer),
  token: persistReducer(tokenPersistConfig, tokenReducer)
});

For redux-persist v4.x

Modify the persistStore call as follows:

import createSensitiveStorage from "redux-persist-sensitive-storage";

// ...

persistStore(store, { storage: createSensitiveStorage(options) });

Here is a more complete example:

import { compose, applyMiddleware, createStore } from "redux";
import { persistStore, autoRehydrate } from "redux-persist";
import createSensitiveStorage from "redux-persist-sensitive-storage";

const store = createStore(
  reducer,
  compose(
    applyMiddleware(...),
    autoRehydrate()
  )
);

persistStore(store, {
  storage: createSensitiveStorage({
    keychainService: "myKeychain",
    sharedPreferencesName: "mySharedPrefs"
  });
);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].