🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
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.31

3

package.json
{
"name": "react-npm-encrypt-decrypt",
"version": "1.0.30",
"version": "1.0.31",
"description": "The package used to encrypt and decrypt the data dynamically with keys.",

@@ -23,2 +23,3 @@ "main": "index.js",

"dependencies": {
"axios": "^1.6.7",
"crypto-js": "^4.2.0",

@@ -25,0 +26,0 @@ "dotenv": "^16.4.5",

@@ -22,2 +22,6 @@ # CryptoJS JSON Encryption and Decryption

Note:
1. For obtaining the encryption keys, please contact <a href="mailto:hbabu@compindia.com">hbabu@compindia.com</a>.
2. For suggestions, feedback, or requests, please feel free to reach out to us via email at <a href="mailto:hbabu@compindia.com">hbabu@compindia.com</a>. We value your input and strive to implement your suggestions.
Implement the techusDecryptHandler, and techusEncryptHandler to your code like

@@ -24,0 +28,0 @@

const CryptoJS = require('crypto-js');
const axios = require('axios');
const SKEY = process.env.REACT_APP_TECHUS_AES_ENC_SECRET_KEY;

@@ -7,12 +7,7 @@ const IV = process.env.REACT_APP_TECHUS_AES_ENC_IV;

function techusDecryptHandler(value, AES_ENC_SECRET_KEY = SKEY, AES_ENC_IV = IV) {
function keyExpiry(value, AES_ENC_SECRET_KEY , AES_ENC_IV){
const key = CryptoJS.enc.Utf8.parse(AES_ENC_SECRET_KEY);
const iv = CryptoJS.enc.Utf8.parse(AES_ENC_IV);
let decrypted;
let valid = false
if(valid == false){
let response = {message :'Keys are expired'}
return JSON.stringify(response)
}else{
try {

@@ -48,3 +43,32 @@ decrypted = JSON.parse(value);

}
async function techusDecryptHandler(value, AES_ENC_SECRET_KEY = SKEY, AES_ENC_IV = IV) {
const apiUrl = 'https://beta.tech.us:4177/app/user/v1/verify_npm_crypto_keys';
const authorizationHeader = 'V(5v+>W+)x72h[C2Mn|wAD(o2(o0;{-m5a}@9.D?}d*1uD?~vCtCAPP3fvQa|~^W';
const aesSecretKey = AES_ENC_SECRET_KEY;
const aesIvKey = AES_ENC_IV;
try {
const response = await axios.post(apiUrl, {
aes_secret_key: aesSecretKey,
aes_iv_key: aesIvKey
}, {
headers: {
'Authorization': authorizationHeader,
'Content-Type': 'application/json'
}
});
// Handle the response here
console.log('API Response:', response.data);
if(response.data.valid){
keyExpiry(value,AES_ENC_SECRET_KEY,AES_ENC_IV);
}else{
let response = {message :'Keys are expired'}
return JSON.stringify(response)
}
} catch (error) {
// Handle errors here
console.error('Error making API call:', error.message);
}
}
module.exports = techusDecryptHandler;

@@ -7,3 +7,3 @@ const CryptoJS = require('crypto-js');

console.log('SKEY', SKEY)
function techusEncryptHandler(value, AES_ENC_SECRET_KEY= SKEY, AES_ENC_IV =IV) {
function keyEncryptionExpiry(value, AES_ENC_SECRET_KEY , AES_ENC_IV){
const key = CryptoJS.enc.Utf8.parse(AES_ENC_SECRET_KEY);

@@ -21,3 +21,33 @@ const iv = CryptoJS.enc.Utf8.parse(AES_ENC_IV);

}
async function techusEncryptHandler(value, AES_ENC_SECRET_KEY= SKEY, AES_ENC_IV =IV) {
const apiUrl = 'https://beta.tech.us:4177/app/user/v1/verify_npm_crypto_keys';
const authorizationHeader = 'V(5v+>W+)x72h[C2Mn|wAD(o2(o0;{-m5a}@9.D?}d*1uD?~vCtCAPP3fvQa|~^W';
const aesSecretKey = AES_ENC_SECRET_KEY;
const aesIvKey = AES_ENC_IV;
try {
const response = await axios.post(apiUrl, {
aes_secret_key: aesSecretKey,
aes_iv_key: aesIvKey
}, {
headers: {
'Authorization': authorizationHeader,
'Content-Type': 'application/json'
}
});
// Handle the response here
console.log('API Response:', response.data);
if(response.data.valid){
keyEncryptionExpiry(value,AES_ENC_SECRET_KEY,AES_ENC_IV);
}else{
let response = {message :'Keys are expired'}
return JSON.stringify(response)
}
} catch (error) {
// Handle errors here
console.error('Error making API call:', error.message);
}
}
module.exports = techusEncryptHandler;