rsa-light-crypto
v1.0.4
Published
Module to encrypt your data fast between front-end and back-end
Downloads
10
Maintainers
Readme
RSA Light Crypto
A library to generate rsa keys, encrypt data and decrypt data in your application works well at browser to add a layer of security in your app.
I recommend to create a interceptor and intercept all request to encrypt and decrypt all in one safe place
Installation
Use the package manager node to install rsa-light-crypto.
npm i rsa-light-crypto
Usage
const light_crypto = require('rsa-light-crypto')
let keys = light_crypto.generateKey()
//PUBLIC_KEY: MTMwMDAwMCA=
//PRIVATE_KEY: MzEg
let data = "my data"
let encryptData = light_crypto.encrypt(data,keys.publicKey)
//6b87908a2653768c7626818b26657a78908a7a
let decryptData = light_crypto.decrypt(encryptData,keys.privateKey)
//my data
/*the result may be different rsa-light-crypto uses different methods every time you generate a new key*/
Please make sure to update tests as appropriate.