rn_encrypted_storage
v1.0.4
Published
A react native package to securely store data locally, it adds to [AsyncStorage](http://www.github.com/BLemine) an **encryption** layer based on [AES](https://searchsecurity.techtarget.com/definition/Advanced-Encryption-Standard) and [Hmacsha1](https://do
Downloads
122
Maintainers
Readme
RN-Encrypted-Storage :
A react native package to securely store data locally, it adds to AsyncStorage an encryption layer based on AES and Hmacsha1 encryption algorithms, your data is now saved 100% encrypted.
Installation :
npm install rn_encrypted_storage
# or
yarn add rn_encrypted_storage
## Install the peer-dependencies if your npm is between v3 and v7:
npm i @react-native-async-storage/async-storage hmacsha1 react-native-device-info react-native-crypto-js
# or with
yarn add @react-native-async-storage/async-storage hmacsha1 react-native-device-info react-native-crypto-js
Usage :
import {encyptStorage,decryptStorage, removeEncryptStorage} from "rn_encrypted_storage";
...
const storeData=async(loggedUser)=>{
await encryptStorage("name",loggedUser); // you don't need to stringify the object
}
...
const getData=()=>{
decryptStorage("name").then(res=>{
console.log(res) // this is your securely stored object, this retures it stringify so you can do :
console.log(JSON.parse(res)) // if it's a json object
}).catch(ex=>console.log(ex))
}
...
const remoteData=async ()=>{
await remoteEncryptStorage("user");
}
Example
For example check the folder Example