react-native-rsa-native
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -7,4 +7,4 @@ | ||
export { RNRSAKeychain }; | ||
export { RNRSAKeychain, RNRSAKeychain as RSAKeychain, RNRSA, RNRSA as RSA }; | ||
export default RNRSA; |
{ | ||
"name": "react-native-rsa-native", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A native implementation of RSA key generation and encryption/decryption.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# react-native-rsa-native | ||
A native implementation of RSA key generation and encryption/decryption. | ||
A native implementation of RSA key generation and encryption/decryption, sign/verify. | ||
Keychain implementation | ||
Implementation is in PKCS1 | ||
@@ -8,4 +9,4 @@ | ||
Android: Generation, Encryption, Decryption | ||
iOS: Generation, Encryption, Decryption | ||
Android: Generation, Encryption, Decryption, Sign, Verify, keychain support | ||
iOS: Generation, Encryption, Decryption, Sign, Verify, keychain support | ||
@@ -34,3 +35,3 @@ *Need to check cross platform encrypt/decrypt | ||
import RSA, {RNRSAKeychain} from 'react-native-rsa-native'; | ||
import {RSA, RSAKeychain} from 'react-native-rsa-native'; | ||
@@ -41,11 +42,21 @@ RSA.generate() | ||
console.log(keys.public) // the public key | ||
RNRSA.encrypt('1234', keys.public) | ||
RSA.encrypt('1234', keys.public) | ||
.then(encodedMessage => { | ||
RNRSA.decrypt(encodedMessage, keys.private) | ||
RSA.decrypt(encodedMessage, keys.private) | ||
.then(message => { | ||
console.log(message) | ||
console.log(message); | ||
}) | ||
}) | ||
}) | ||
RSA.sign(secret, keys.private) | ||
.then(signature => { | ||
console.log(signature); | ||
RSA.verify(signature, secret, keys.public) | ||
.then(valid => { | ||
console.log(valid); | ||
}) | ||
}) | ||
}) | ||
// Example utilizing the keychain for private key secure storage | ||
@@ -56,13 +67,12 @@ | ||
RNRSAKeychain.generate(keyTag) | ||
RSAKeychain.generate(keyTag) | ||
.then(keys => { | ||
console.log(keys.public); | ||
console.log(secret); | ||
RSA.encrypt(secret, keyTag) | ||
RSAKeychain.encrypt(secret, keyTag) | ||
.then(encodedMessage => { | ||
console.log(encodedMessage); | ||
RSA.decrypt(encodedMessage, keyTag) | ||
RSAKeychain.decrypt(encodedMessage, keyTag) | ||
.then(message => { | ||
@@ -72,3 +82,13 @@ console.log(message); | ||
}) | ||
}); | ||
RSAKeychain.sign(secret, keyTag) | ||
.then(signature => { | ||
console.log(signature); | ||
RSAKeychain.verify(signature, secret, keyTag) | ||
.then(valid => { | ||
console.log(valid); | ||
}) | ||
}) | ||
}); | ||
``` | ||
@@ -75,0 +95,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
50032
19
96
1