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

react-npm-encrypt-decrypt

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-npm-encrypt-decrypt

The package used to encrypt and decrypt the data dynamically with keys.

1.0.22
Version published
Weekly downloads
5
-93.33%
Maintainers
1
Weekly downloads
 
Created

CryptoJS JSON Encryption and Decryption

This module provides functions for encrypting and decrypting JSON data using the CryptoJS library.

Installation

npm i react-npm-encrypt-decrypt

Usage

const { decryptJSONHandler, encryptJSONHandler } = require('react-npm-encrypt-decrypt');

// 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);

FAQs

Package last updated on 06 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts