A native implementation of Public/Private RSA key genaration.
import KeyPair from 'react-native-key-pair'
KeyPair.generate((keys)=>{
console.log(keys.private) // the private key
console.log(keys.public) // the public key
})
$ npm install react-native-key-pair --save
$ react-native link react-native-key-pair
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-key-pair
and addRNKeyPair.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNKeyPair.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNKeyPairPackage;
to the imports at the top of the file - Add
new RNKeyPairPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-key-pair' project(':react-native-key-pair').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-key-pair/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-key-pair')
- In Visual Studio add the
RNKeyPair.sln
innode_modules/react-native-key-pair/windows/RNKeyPair.sln
folder to their solution, reference from their app. - Open up your
MainPage.cs
app
- Add
using Cl.Json.RNKeyPair;
to the usings at the top of the file - Add
new RNKeyPairPackage()
to theList<IReactPackage>
returned by thePackages
method
import RNKeyPair from 'react-native-key-pair';
// TODO: What do with the module?
RNKeyPair;