New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vivlab/api-database

Package Overview
Dependencies
Maintainers
3
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vivlab/api-database - npm Package Compare versions

Comparing version 1.0.39 to 1.0.40

23

dist/libraries/crypto.js

@@ -10,3 +10,2 @@ "use strict";

const KEYLEN = 64;
const CIPHER_ALGORITHM = "aes-256-ctr";
const randomBytes = util_1.default.promisify(crypto_1.default.randomBytes);

@@ -53,10 +52,2 @@ const scrypt = util_1.default.promisify(crypto_1.default.scrypt);

exports.generateKeyPair = generateKeyPair;
if (!process.env.CRYPTO_IV)
throw new Error("Missing Crypto IV");
const CIPHER_IV = Buffer.from(process.env.CRYPTO_IV, "hex");
const CIPHER_KEY = crypto_1.default
.createHash("sha256")
.update(String(process.env.CRYPTO_KEY))
.digest("base64")
.substr(0, 32);
function cipher(data) {

@@ -66,2 +57,3 @@ if (data == null)

try {
const { CIPHER_ALGORITHM, CIPHER_KEY, CIPHER_IV } = initCypher();
const cryptoCipher = crypto_1.default.createCipheriv(CIPHER_ALGORITHM, CIPHER_KEY, CIPHER_IV);

@@ -81,2 +73,3 @@ let encrypted = cryptoCipher.update(data, "utf8", "hex");

try {
const { CIPHER_ALGORITHM, CIPHER_KEY, CIPHER_IV } = initCypher();
const cryptoDecipher = crypto_1.default.createDecipheriv(CIPHER_ALGORITHM, CIPHER_KEY, CIPHER_IV);

@@ -92,2 +85,14 @@ let decrypted = cryptoDecipher.update(data, "hex", "utf8");

exports.decipher = decipher;
function initCypher() {
if (!process.env.CRYPTO_IV)
throw new Error("Missing Crypto IV");
const CIPHER_ALGORITHM = "aes-256-ctr";
const CIPHER_IV = Buffer.from(process.env.CRYPTO_IV, "hex");
const CIPHER_KEY = crypto_1.default
.createHash("sha256")
.update(String(process.env.CRYPTO_KEY))
.digest("base64")
.substr(0, 32);
return { CIPHER_ALGORITHM, CIPHER_KEY, CIPHER_IV };
}
//# sourceMappingURL=crypto.js.map
{
"name": "@vivlab/api-database",
"version": "1.0.39",
"version": "1.0.40",
"description": "",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc