
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
secure-keyx
Advanced tools
This is an npm package that provides a simple and secure way to perform Elliptic Curve Diffie-Hellman (ECDH) key exchange between a client and server, with the server managing the keys in a Redis database.
A simple npm package for exchanging and managing secrets between a client and a server using Elliptic Curve Diffie-Helman (ECDH) key exchange protocol.
To install the package, use the following commands:
npm i secure-keyx or yarn add secure-keyx
The package provides two main classes:
ClientSecureKeyExchangeThis class is to be used in the browser environment which has the WebCryptoAPI available. This class provides 2 methods which are to be used to generate a client public key and a generate the shared secret.
getPublicKey()This method is used to generate the client public key which is required by the ServerSecureKeyExchange to generate the server public key and the shared secret on the server side.
generateSecret(serverPublicKey)This method is used to generate the shared secret using the public key which is gotten from the server using ServerSecureKeyExchange.
Example:
import { ClientSecureKeyExchange } from "secure-keyx";
import axios from "axios";
const clientKeyExchange = new ClientSecureKeyExchange();
const clientPublicKey = await clientKeyExchange.getPublicKey();
console.log(clientPublicKey); // this will log the generated client public key
const response = await axios.get(
`https://api.your-server.com?clientPublicKey=${clientPublicKey}`
);
const sharedSecret = await clientKeyExchange.generateSecret(response);
// proceed to use the shared secret to encrypt and decrypt payloads send from and to the server
ServerSecureKeyExchangeThis class generates the server public key, encrypts generated shared secrets, caches these secrets in redis. The key passed when creating an instance of the class is the encryption key which will be used to encrypt all generated shared secrets. The following methods are are interfaces to getting these done.
setRedisConnection(redisClient)This method is used to set a redis connection secure-keyx will use to cache the generated shared keys. This should be the first method called.
generateSecret(clientPublicKey, userID, ttl)This method is used to generate, encrypt and cache the shared secret. It does this using the clientPublicKey gotten from ClientSecureKeyExchange, 32 character encryption key passed in the class constructor and the redis connection provided using the setRedisConnection().
getSecret(options)This method is used to retrieve the cached encrypted secrets stored in redis. You can specify whether to return the encrypted or decrypted version of the secret using decrypt option in GetSecretOptions.
Example:
import { ServerSecureKeyExchange } from "secure-keyx";
import redis from "redis";
const client = redis.createClient(process.ENV.REDIS_URL);
client.connect();
app.post("/", async (req, res) => {
const secureServerClient = new ServerSecureKeyExchange(
process.env.ENCRYPTION_KEY,
true // set to true if you want secure-keyx to cache the shared secrets to redis automatically
);
secureServerClient.setRedisConnection(client);
const serverPublicKey = await secureServerClient.generateSecret(
req.query.clientPublicKey,
req.query.userID,
60 // expire the secret in 60 seconds
);
const encryptedSecret = await secureServerClient.getSecret({
userID: req.query.userID,
decrypt: false, // the shared secret will be encrypted when returned
});
const decryptedSecret = await secureServerClient.getSecret({
userID: req.query.userID,
decrypt: true, // the shared secret will be returned plainly
});
res.json({ serverPublicKey, decryptedSecret, encryptedSecret });
});
FAQs
This is an npm package that provides a simple and secure way to perform Elliptic Curve Diffie-Hellman (ECDH) key exchange between a client and server, with the server managing the keys in a Redis database.
We found that secure-keyx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.