React Native Des (remobile)
A des crypto for react-native
fork from remobile/react-native-des only add cbc feature in Android and iOS
Installation
npm install react-native-des-cbc --save
Installation (iOS)
- Drag
node_modules/react-native-des-cbc/ios/RCTDes.xcodeproj
to your project'sLibraries
in Xcode. - Click on your main project and select
Build Phases
then draglibRCTDes.a
from theLibraries/RCTDes.xcodeproj/Products
intoLink Binary With Libraries
. - (Optional) Look for
Build Settings/Header Search Paths
and make sure it contains both$(SRCROOT)/../../../react-native/React
as recursive. command + b
to buil it.
Installation (Android)
1/3. In android/settings.gradle
//...include ':react-native-des-cbc'project(':react-native-des-cbc').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-des-cbc/android')
2/3. In android/app/build.gradle
//...dependencies { //... compile project(':react-native-des-cbc')}
3/3. register module (in MainApplication.java
)
//...... // <--- import //...... @Overrideprotected List<ReactPackage> { return Arrays.<ReactPackage>;}
Usage
Example
var Des = ; Des; var vec = "cute";Des;
method
-
encrypt(text, key, callback)
-
encrypt(base64, key, callback)
-
encryptCbc(text, key, vec, callback)
-
encryptCbc(base64, key, vec, callback)
Server Side
- see https://github.com/remobile/react-native-des/blob/master/server
- support java, nodejs, js, php