
Research
Security News
Malicious npm Packages Use Telegram to Exfiltrate BullX Credentials
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
secure-crypto-node-utils
Advanced tools
A collection of essential cryptographic utilities for secure communication in Node.js application. Includes methods for encryption and decryption using AES-256-CBC algorithm with customizable secret keys.
Node Secure Crypto Utils is a comprehensive library providing essential cryptographic utilities for secure communication in Node.js applications. It includes methods for encryption and decryption using the AES-256-CBC algorithm with customizable secret keys, ensuring robust security for your data transmission needs.
To install Node Secure Crypto Utils, you can use npm:
npm install node-secure-crypto-utils
Node Secure Crypto Utils is primarily used to encrypt and decrypt data transmitted between a client and a Node.js server. Here's how you can use it:
Create a .env file to provide the encryption keys in your root directory. The folder structure should be as follows:
|---root
|---bin
| |-- .env
In the .env file, provide the encryption keys:
.env
AES_ENC_SECRET_KEY=your-secret-key
AES_ENC_IV=your-IV-key
Note:
const { encrypt } = require('secure-crypto-node-utils');
// Encrypt sensitive data
const encryptedData = encrypt('Hello World');
const { decrypt } = require('secure-crypto-node-utils');
// Decrypt encrypted data
const decryptedData = decrypt(encryptedData);
To enable encryption and decryption for request and response handling, follow these steps:
To decrypt incoming request data, utilize middleware in your routes file. For example my folder structure is organized as follows:
|---root
|---bin
| |-- .env
|---middlewares
| |-- default.mw.js
|---routes.js
In your routes.js file, require and use the decryption middleware:
var defaultMiddleware = require("middlewares/default.mw.js");
router.use(defaultMiddleware.DecryptHandler);
// declare your API endpoint below
And in your default.mw.js middleware file:
middlewareObj.DecryptHandler = async function (req, res, next) {
// if you need to omit encryption you can use like below
if (req.path == '/test' || req.path == '/test2') {
req.is_no_enc = true;
}else{
// Decrypt encrypted data
req.body = await decrypt(req.body.data);
}
next();
}
To encrypt the response data before sending it to the client, set up a function like below and call it within your API route handler while preparing the response. Ensure to use your encryption methods provided by secure-crypto-node-utils.
async function sendResponse(req, res, response) {
// you can add your conditions to process response
response = { data: await encrypt(response) };
res.json(response);
}
FAQs
A collection of essential cryptographic utilities for secure communication in Node.js application. Includes methods for encryption and decryption using AES-256-CBC algorithm with customizable secret keys.
The npm package secure-crypto-node-utils receives a total of 0 weekly downloads. As such, secure-crypto-node-utils popularity was classified as not popular.
We found that secure-crypto-node-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.
Security News
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.