You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-npm-encrypt-decrypt

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-npm-encrypt-decrypt - npm Package Compare versions

Comparing version

to
1.0.2

2

package.json
{
"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);
```