This React Native module lets you store cryptographic keys in a container to make it more difficult to extract from the device.
Current functions:
- Generate Key pair and save them.
- Get Public Key string and fingerprint.
- Sign data with Private key.
- Use Android and IOS native key store system for saving keypair secure.
- Android Minimum SDK Level = 18
first get source code.
$ git clone https://github.com/pesehr/secureKeyStore.git
now you can install module with following instruction.
-
- goto Android folder and copy all java files to your android sorce code folder of your react native project. now ajust the codes with your project.
- copy following code line to your
MainApplication.java
:your code have must be like this:new SecureKeyStoreModulePack()
public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new SecureKeyStoreModulePack() ); } }; }
-
install this module on ios devices is more difficult then android. please do all instructions carefully
- first go to ios folder and copy all files to ios folder of your project.
- in this module we use extrenal library named
cryptoswift
. you must install it before using the module. for installation follw this link: https://github.com/krzyzanowskim/CryptoSwift. - you must enable key chain sharing. follow this link: https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html
- if you have problem with adding ios module. your can add ios native module by helping this link and my codes.
-
- you can invoke native methodes by
NativeModule
object. for example you could invocegenerateKeys
method like this:import { NativeModules } from 'react-native'; NativeModules.SecureKeyStore.generateKeys();
- you can invoke native methodes by
- Correct English writing wrongs!!!
- Add encryption with publickey and decryption with privatekey.
- Installation using
npm
.
Please create issues and send pull requests!
MIT
Free Software, Hell Yeah!