react-npm-encrypt-decrypt
Advanced tools
Comparing version
{ | ||
"name": "react-npm-encrypt-decrypt", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "The package used to encrypt and decrypt the data dynamically with keys.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,26 @@ # CryptoJS JSON Encryption and Decryption | ||
```bash | ||
npm install crypto-js | ||
npm i react-npm-encrypt-decrypt | ||
``` | ||
## Usage | ||
```bash | ||
const { decryptJSONHandler, encryptJSONHandler } = require('./your-module-name'); | ||
// Your encryption key and initialization vector (IV) | ||
const AES_ENC_SECRET_KEY = 'your-secret-key'; | ||
const AES_ENC_IV = 'your-initialization-vector'; | ||
// Your JSON data to be encrypted | ||
const jsonData = { key1: 'value1', key2: 'value2' }; | ||
// Encrypt JSON data | ||
const encryptedData = encryptJSONHandler(JSON.stringify(jsonData), AES_ENC_SECRET_KEY, AES_ENC_IV); | ||
console.log('Encrypted Data:', encryptedData); | ||
// Decrypt JSON data | ||
const decryptedData = decryptJSONHandler(encryptedData, AES_ENC_SECRET_KEY, AES_ENC_IV); | ||
console.log('Decrypted Data:', decryptedData); | ||
``` | ||
2536
38.88%33
266.67%