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

secure-flow

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

secure-flow - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5-beta-1

bin/create-secureflow-config.cjs

4

dist/cli.js

@@ -20,3 +20,3 @@ "use strict";

else if (args.includes('--javascript')) {
configPath = path_1.default.resolve(process.cwd(), 'secureflow.config.js');
configPath = path_1.default.resolve(process.cwd(), 'secureflow.config.cjs');
}

@@ -28,3 +28,3 @@ else {

if (fs_1.default.existsSync(configPath)) {
console.error(args.includes('--typescript') ? 'secureflow.config.js already exists in the root directory.' : 'secureflow.config.ts already exists in the root directory.');
console.error(args.includes('--typescript') ? 'secureflow.config.ts already exists in the root directory.' : 'secureflow.config.cjs already exists in the root directory.');
process.exit(1);

@@ -31,0 +31,0 @@ }

@@ -6,4 +6,4 @@ "use strict";

encryptionAlgorithm: "aes-256-cbc",
encryptionKey: "12345678901234567890123456789012", // Must be 32 characters
iv: Buffer.from("1234567890123456"),
encryptionKey: "", // Must be 32 characters
iv: Buffer.from(""),
};
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.decrypt = exports.encrypt = void 0;
const crypto_1 = __importDefault(require("crypto"));
const loadConfig_js_1 = require("./loadConfig.js");
const node_crypto_1 = require("node:crypto");
const config = (0, loadConfig_js_1.loadConfig)();

@@ -13,3 +10,3 @@ // Define return types and parameter types for the functions

try {
const cipher = crypto_1.default.createCipheriv(config.encryptionAlgorithm, Buffer.from(config.encryptionKey), config.iv);
const cipher = (0, node_crypto_1.createCipheriv)(config.encryptionAlgorithm, Buffer.from(config.encryptionKey), config.iv);
let encrypted = cipher.update(text, "utf8", "hex");

@@ -27,3 +24,3 @@ encrypted += cipher.final("hex");

try {
const decipher = crypto_1.default.createDecipheriv(config.encryptionAlgorithm, Buffer.from(config.encryptionKey), config.iv);
const decipher = (0, node_crypto_1.createDecipheriv)(config.encryptionAlgorithm, Buffer.from(config.encryptionKey), config.iv);
let decrypted = decipher.update(text, "hex", "utf8");

@@ -30,0 +27,0 @@ decrypted += decipher.final("utf8");

@@ -12,21 +12,18 @@ "use strict";

let customConfigPath;
const args = process.argv.slice(2);
if (args.includes('--typescript')) {
// const args = process.argv.slice(2);
let configPath = path_1.default.resolve(process.cwd(), 'tsconfig.json');
if (fs_1.default.existsSync(configPath)) {
customConfigPath = path_1.default.resolve(process.cwd(), 'secureflow.config.ts');
}
else if (args.includes('--javascript')) {
customConfigPath = path_1.default.resolve(process.cwd(), 'secureflow.config.js');
}
else {
// Default to JavaScript if no argument is provided
customConfigPath = path_1.default.resolve(process.cwd(), 'secureflow.config.js');
customConfigPath = path_1.default.resolve(process.cwd(), 'secureflow.config.cjs');
}
if (fs_1.default.existsSync(customConfigPath)) {
const customConfig = require(customConfigPath).default || require(customConfigPath);
return Object.assign(Object.assign({}, config_js_1.defaultConfig), customConfig);
return { ...config_js_1.defaultConfig, ...customConfig };
}
else {
return config_js_1.defaultConfig;
throw new Error(`No config file found at ${customConfigPath}`);
}
}
exports.loadConfig = loadConfig;
{
"name": "secure-flow",
"version": "1.0.4",
"version": "1.0.5-beta-1",
"description": "Secure Flow is a lightweight TypeScript utility package for encryption and decryption using the AES-256-CBC algorithm. This package simplifies the process of securely encrypting and decrypting text, making it easy to integrate strong encryption into your Node.js applications.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"types": "dist/secure-flow.d.ts",
"type": "module",
"bin": {

@@ -30,12 +31,13 @@ "create-secureflow-config": "./bin/create-secureflow-config.js"

"dependencies": {
"crypto": "^1.0.1",
"express": "^4.19.2"
"express": "^4.19.2",
"inquirer": "^9.2.22"
},
"devDependencies": {
"typescript": "^5.4.5",
"ts-node": "^10.9.2",
"@types/express": "^4.17.21",
"@types/inquirer": "^9.0.7",
"@types/node": "^20.12.12",
"nodemon": "^3.1.1"
"nodemon": "^3.1.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
}
}

@@ -1,23 +0,24 @@

## SecureFlow Configuration Generator
## SecureFlow
The SecureFlow Configuration Generator (`create-secureflow-config`) is a command-line tool that allows you to quickly create a configuration file for SecureFlow. This configuration file includes encryption settings required for SecureFlow to securely encrypt and decrypt data.
The secure-flow provides the functionality for encrypting and decrypting text using the Node.js crypto module, with configurations loaded from a specified source.
## Installation
You can install the `create-secureflow-config` package globally using npm or yarn:
```bash
npm install -g your-package-name
npm install -g secure-flow
# or
yarn global add your-package-name
yarn global add secure-flow
```
Usage
## Usage
Once installed, you can run the following command to generate the secureflow.config.ts file in your current working directory:
```bash
create-secureflow-config
npx create-secureflow-config --javascript
# or
npx create-secureflow-config --typescript
```
This will create a file named secureflow.config.ts with the following content:
This will create a file named secureflow.config.ts or secureflow.config.cjs file with the following content:

@@ -32,34 +33,43 @@ ```typescript

## Configuration
And you can import the encrypt or decrypt methods:
encryptionAlgorithm: The encryption algorithm used by SecureFlow. Default is 'aes-256-cbc'.
encryptionKey: A 32-character string used as the encryption key. Replace 'your-32-character-encryption-key' with your actual encryption key.
iv: Initialization Vector (IV) used for encryption. Should be a 16-character Buffer. Replace 'your-16-character-iv' with your actual IV.
```typescript
import { encrypt, decrypt } from "secure-flow";
```
## Example
Here's an example of how to use the generated secureflow.config.ts file in your SecureFlow application:
## Example usage with Express
```typescript
// secureflow.config.ts
module.exports = {
encryptionAlgorithm: "aes-256-cbc",
encryptionKey: "your-32-character-encryption-key",
iv: Buffer.from("your-16-character-iv"),
};
app.get("/encrypt", (req, res) => {
const data = JSON.stringify({ data: "Hello, World!" });
res.status(200).json(encrypt(data));
});
// Your SecureFlow application
import { config } from "./secureflow.config";
app.get("/decrypt", (req, res) => {
const data = req.body;
res.status(200).json(decrypt(data));
});
```
## Configuration
encryptionAlgorithm: The encryption algorithm used by SecureFlow. Default is 'aes-256-cbc'.
encryptionKey: A 32-character string used as the encryption key. Replace 'your-32-character-encryption-key' with your actual encryption key.
iv: Initialization Vector (IV) used for encryption. Should be a 16-character Buffer. Replace 'your-16-character-iv' with your actual IV.
## License
This package is licensed under the MIT License.
## Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.
## Bug Reports
If you find any issues with the package, please report them on the GitHub issues page.
## Author
Adarsh M
GitHub: `[Profile](https://github.com/adarshm07/)`

@@ -16,3 +16,3 @@ import fs from 'fs';

} else if (args.includes('--javascript')) {
configPath = path.resolve(process.cwd(), 'secureflow.config.js');
configPath = path.resolve(process.cwd(), 'secureflow.config.cjs');
} else {

@@ -24,3 +24,3 @@ console.error('Invalid argument. Use --typescript or --javascript.', args);

if (fs.existsSync(configPath)) {
console.error(args.includes('--typescript') ? 'secureflow.config.js already exists in the root directory.' : 'secureflow.config.ts already exists in the root directory.');
console.error(args.includes('--typescript') ? 'secureflow.config.ts already exists in the root directory.' : 'secureflow.config.cjs already exists in the root directory.');
process.exit(1);

@@ -27,0 +27,0 @@ }

export const defaultConfig = {
encryptionAlgorithm: "aes-256-cbc",
encryptionKey: "12345678901234567890123456789012", // Must be 32 characters
iv: Buffer.from("1234567890123456"),
encryptionKey: "", // Must be 32 characters
iv: Buffer.from(""),
};
export type Config = typeof defaultConfig;

@@ -1,4 +0,4 @@

import crypto from "crypto";
import { loadConfig } from './loadConfig.js';
import { Config } from './config.js';
import { createCipheriv, createDecipheriv } from 'node:crypto';

@@ -10,3 +10,3 @@ const config: Config = loadConfig();

try {
const cipher = crypto.createCipheriv(
const cipher = createCipheriv(
config.encryptionAlgorithm,

@@ -27,3 +27,3 @@ Buffer.from(config.encryptionKey),

try {
const decipher = crypto.createDecipheriv(
const decipher = createDecipheriv(
config.encryptionAlgorithm,

@@ -30,0 +30,0 @@ Buffer.from(config.encryptionKey),

@@ -1,2 +0,2 @@

import { defaultConfig, Config } from './config.js';
import { Config, defaultConfig } from './config.js';
import path from 'path';

@@ -7,11 +7,9 @@ import fs from 'fs';

let customConfigPath: string;
const args = process.argv.slice(2);
// const args = process.argv.slice(2);
let configPath = path.resolve(process.cwd(), 'tsconfig.json');
if (args.includes('--typescript')) {
if (fs.existsSync(configPath)) {
customConfigPath = path.resolve(process.cwd(), 'secureflow.config.ts');
} else if (args.includes('--javascript')) {
customConfigPath = path.resolve(process.cwd(), 'secureflow.config.js');
} else {
// Default to JavaScript if no argument is provided
customConfigPath = path.resolve(process.cwd(), 'secureflow.config.js');
customConfigPath = path.resolve(process.cwd(), 'secureflow.config.cjs');
}

@@ -23,4 +21,4 @@

} else {
return defaultConfig;
throw new Error(`No config file found at ${customConfigPath}`);
}
}

@@ -5,10 +5,17 @@ {

"outDir": "dist",
"target": "ES6",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"declaration": true,
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "Node",
"esModuleInterop": true,
"types": ["node"]
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": ["./types", "./node_modules/@types"],
"baseUrl": "/",
"paths": {
"*": ["src/*", "types/*"]
}
},
"include": ["src/**/*.ts", "**/*.tsx"],
"include": ["src/**/*.ts", "types/**/*.d.ts"],
"exclude": ["node_modules"]
}
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