Socket
Socket
Sign inDemoInstall

@tinypudding/puddy-lib

Package Overview
Dependencies
44
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.31 to 1.1.32

26

crypto/decrypt.js

@@ -1,14 +0,30 @@

module.exports = function (tinyCrypto, text) {
// Module
const crypto = require('crypto');
const cryptoAction = function (tinyCrypto, key, text) {
const crypto = require('crypto');
let textParts = text.split(':');
let iv = Buffer.from(textParts.shift(), tinyCrypto.stringType);
let encryptedText = Buffer.from(textParts.join(':'), tinyCrypto.stringType);
let decipher = crypto.createDecipheriv(tinyCrypto.algorithm, Buffer.from(tinyCrypto.key), iv);
let decipher = crypto.createDecipheriv(tinyCrypto.algorithm, Buffer.from(key), iv);
let decrypted = decipher.update(encryptedText);
decrypted = Buffer.concat([decrypted, decipher.final()]);
return decrypted.toString();
}
// Export
module.exports = function (tinyCrypto, text) {
// Prepare Result
let result = text;
if (!Array.isArray(tinyCrypto.key)) { tinyCrypto.key = [tinyCrypto.key]; }
for (const item in tinyCrypto.key) {
result = cryptoAction(tinyCrypto, tinyCrypto.key[item], result);
}
// Complete
return result;
};

@@ -1,6 +0,7 @@

module.exports = function (tinyCrypto, text) {
// Module
const crypto = require('crypto');
const cryptoAction = function (tinyCrypto, key, text) {
const crypto = require('crypto');
let iv = crypto.randomBytes(tinyCrypto.IV_LENGTH);
let cipher = crypto.createCipheriv(tinyCrypto.algorithm, Buffer.from(tinyCrypto.key), iv);
let cipher = crypto.createCipheriv(tinyCrypto.algorithm, Buffer.from(key), iv);
let encrypted = cipher.update(text);

@@ -10,2 +11,17 @@ encrypted = Buffer.concat([encrypted, cipher.final()]);

};
// Export
module.exports = function (tinyCrypto, text) {
// Prepare Result
let result = text;
if (!Array.isArray(tinyCrypto.key)) { tinyCrypto.key = [tinyCrypto.key]; }
for (const item in tinyCrypto.key) {
result = cryptoAction(tinyCrypto, tinyCrypto.key[item], result);
}
// Complete
return result;
};

2

package.json
{
"name": "@tinypudding/puddy-lib",
"version": "1.1.31",
"version": "1.1.32",
"description": "Essential codes to run the other repositories from the Tiny Pudding Account.",

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc