1.0.6 • Published 5 years ago
react-native-crypton v1.0.6
Crypton
react-native-crypton
An encryption pakage for react native based on native implemention
Getting started
$ npm install react-native-crypton --save
automatic installation
$ react-native link react-native-crypton
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-cryptonand addRNCrypton.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNCrypton.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNCryptonPackage;to the imports at the top of the file - Add
new RNCryptonPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-crypton' project(':react-native-crypton').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-crypton/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-crypton')
Added encyption methodes
- AES-256-CBC Encryption & Decryption with PBKDF2
Usage
import { Pbkdf2 } from 'react-native-crypton';
//encrypt
//text = String we want to decrypt in base-64
//password = String password
Pbkdf2.encrypt("<text>", "<password>")
.then(r => console.log('encrypted:: ', r))
.catch(e => console.log('enc catched: ', e));
//decrypt
Pbkdf2.decrypt("<encrypted_text>", "<password>")
.then(r => console.log('decrypted:: ', r))
.catch(e => console.log('dec catched: ', e));Tasks:
- ios pbkdf2
Contact
E-mail: amirhosein5858@gmail.com Backup e-mail: amir@rednode.ir