1.0.6 • Published 4 years ago

react-native-crypton v1.0.6

Weekly downloads
28
License
-
Repository
-
Last release
4 years ago

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

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-crypton and add RNCrypton.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNCrypton.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. 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 the getPackages() method
  1. 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')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-crypton')

Added encyption methodes

  1. 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

Linkedin

E-mail: amirhosein5858@gmail.com Backup e-mail: amir@rednode.ir

Thanks to

CryptoSwift