https://github.com/minds/react-native-minds-encryption
Encryption/Decryption library for react native
https://github.com/minds/react-native-minds-encryption
Last synced: 10 months ago
JSON representation
Encryption/Decryption library for react native
- Host: GitHub
- URL: https://github.com/minds/react-native-minds-encryption
- Owner: Minds
- Created: 2018-01-17T13:20:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-31T13:02:22.000Z (over 6 years ago)
- Last Synced: 2025-07-25T08:52:08.998Z (11 months ago)
- Language: Objective-C
- Size: 12.7 KB
- Stars: 4
- Watchers: 15
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-minds-encryption
A native implementation of RSA encryption/decryption, sign/verify.
Implementation is in PKCS1 for public
Implementation is in PKCS8 for private
## Support
iOS 10+
android 4.1+ (API 16)
## Status
Features:
Encryption,
Decryption,
Sign,
Verify
## Getting started
`$ yarn add react-native-minds-encryption`
or:
`$ npm install react-native-minds-encryption --save`
### Mostly automatic installation:
`$ react-native link react-native-minds-encryption`
## iOS
In your React Native Xcode project, right click on your project and go 'Add Files to ...', then navigate to /node_modules/react-native-minds-crypto/ios and select the Crypto.xcodeproj file. Then in the build settings for your target under 'Link Binary With Libraries', add libCrypto.a.
## Usage
```
import Encryption from 'react-native-minds-encryption';
const publicKey = '...';
const privateKey = '...';
const secret = '...';
Encryption.encrypt('1234', publickey)
.then(encodedMessage => {
Encryption.decrypt(encodedMessage, privateKey)
.then(message => {
console.log(message);
});
});
Encryption.sign(secret, keys.private)
.then(signature => {
console.log(signature);
Encryption.verify(signature, secret, publicKey)
.then(valid => {
console.log(valid);
});
});
```
## Credit
* Based on https://github.com/amitaymolko/react-native-rsa-native