rn_encrypted_storage

1.0.4 • Public • Published

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

Package Sidebar

Install

npm i rn_encrypted_storage

Weekly Downloads

37

Version

1.0.4

License

MIT

Unpacked Size

206 kB

Total Files

58

Last publish

Collaborators

  • sherlock_lemine