cf-keys 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 [Tu Nombre Real o Usuario]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ <div align="center">
2
+ <br />
3
+ <p align="center">
4
+ <img src="https://raw.githubusercontent.com/choco-latito29/choco-latito29/main/Assets/cf-keys.png" width="150" alt="cf-keys-logo">
5
+ </p>
6
+
7
+ <h1><code>cf-keys</code></h1>
8
+
9
+ <p align="center">
10
+ <strong>Security & Utility Suite for Systems Engineering</strong>
11
+ <br />
12
+ <i>Una navaja suiza modular para la gestión de credenciales, seguridad JWT y automatización de tokens.</i>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <img src="https://img.shields.io/npm/v/cf-keys?style=for-the-badge&logo=npm&logoColor=white" alt="npm version" />
17
+ <img src="https://img.shields.io/npm/dt/cf-keys?style=for-the-badge&logo=npm&logoColor=white" alt="npm downloads" />
18
+ <img src="https://img.shields.io/github/license/tu-usuario/cf-keys?style=for-the-badge&logo=github&logoColor=white" alt="license" />
19
+ <img src="https://img.shields.io/badge/Node.js-18+-339933?style=for-the-badge&logo=nodedotjs&logoColor=white" alt="Node.js" />
20
+ <img src="https://img.shields.io/badge/TypeScript-5.x-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />
21
+ </p>
22
+
23
+ <p align="center">
24
+ <a href="#-características">Características</a> •
25
+ <a href="#-instalación">Instalación</a> •
26
+ <a href="#-uso-programático">Uso Programático</a> •
27
+ <a href="#-licencia">Licencia</a>
28
+ </p>
29
+ </div>
30
+
31
+ <hr />
32
+
33
+ ## ✨ Características Principales
34
+
35
+ <table width="100%">
36
+ <tr>
37
+ <td width="50%" style="border: none; vertical-align: top;">
38
+ <h3>🔐 Módulos de Seguridad</h3>
39
+ <ul>
40
+ <li><strong>JWT Engine:</strong> Firma tokens con algoritmos industriales para bots y dashboards.</li>
41
+ <li><strong>Secure Passwords:</strong> Generación aleatoria con alta entropía mediante <code>node:crypto</code>.</li>
42
+ <li><strong>Hash Integrity:</strong> Verificación de archivos vía MD5, SHA-256 y SHA-512.</li>
43
+ </ul>
44
+ </td>
45
+ <td width="50%" style="border: none; vertical-align: top;">
46
+ <h3>🛠️ Utilidades de Infraestructura</h3>
47
+ <ul>
48
+ <li><strong>YouTube Auth:</strong> Extracción automática de <code>poToken</code> y <code>visitorData</code> para bots de música.</li>
49
+ <li><strong>Data Utils:</strong> Encoding y Decoding instantáneo para Base64 y URL.</li>
50
+ <li><strong>Hybrid Architecture:</strong> Funciona como comando CLI global y como SDK para Node.js.</li>
51
+ </ul>
52
+ </td>
53
+ </tr>
54
+ </table>
55
+
56
+ ## 🚀 Instalación
57
+
58
+ ### Uso Global (Terminal)
59
+
60
+ Ideal para tareas rápidas de administración de servidores o cualquier parte del mundo:
61
+
62
+ ```bash
63
+ npm install -g cf-keys
64
+
65
+ ```
66
+
67
+ ### Como Dependencia (Bots/Backend)
68
+
69
+ Instala `cf-keys` en tus proyectos de **Discord.js**:
70
+
71
+ ```bash
72
+ npm install cf-keys
73
+
74
+ ```
75
+
76
+ ## 💻 Uso Programático (SDK)
77
+
78
+ Gracias a su arquitectura de entrada dual, puedes importar la lógica pura directamente en tu código de **TypeScript** o **JavaScript**:
79
+
80
+ ```typescript
81
+ import { signJWT, getYoutubeTokens, generateSecurePassword } from "cf-keys";
82
+
83
+ async function setupBot() {
84
+ // Generar tokens para bypass de YouTube
85
+ const tokens = await getYoutubeTokens();
86
+
87
+ // Firmar acceso para el dashboard de ChocoFactory.dev
88
+ const token = signJWT({ bot: "KiwiChan" }, "tu_secreto_secreta");
89
+
90
+ // Generar credenciales de base de datos
91
+ const dbPass = generateSecurePassword(32);
92
+
93
+ console.log({ tokens, token, dbPass });
94
+ }
95
+ ```
96
+
97
+ ## 🛠️ Stack Tecnológico
98
+
99
+ <div align="left">
100
+ <img src="https://img.shields.io/badge/Node.js-339933?style=flat-square&logo=nodedotjs&logoColor=white" alt="Node.js Badge" />
101
+ <img src="https://img.shields.io/badge/TypeScript-007ACC?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript Badge" />
102
+ <img src="https://img.shields.io/badge/Commander.js-FFD700?style=flat-square&logo=commanderdotjs&logoColor=black" alt="Commander.js Badge" />
103
+ <img src="https://img.shields.io/badge/JSONWebToken-black?style=flat-square&logo=jsonwebtokens&logoColor=white" alt="JWT Badge" />
104
+ </div>
105
+
106
+ ## 📄 Licencia
107
+
108
+ Este proyecto está bajo la **Licencia MIT**. Esto significa que puedes usarlo libremente en tus proyectos personales o comerciales siempre que mantengas la atribución original.
109
+
110
+ ---
111
+
112
+ <div align="center">
113
+
114
+ <a href="https://www.google.com/search?q=https://chocofactory.dev"><strong>Visitar ChocoFactory.dev</strong></a>
115
+
116
+ </div>
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.hashCmd = exports.generateHash = void 0;
7
+ const commander_1 = require("commander");
8
+ const node_crypto_1 = __importDefault(require("node:crypto"));
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ /**
12
+ * Core logic for generating hashes.
13
+ * Can be imported directly into other projects.
14
+ */
15
+ const generateHash = (data, algo = "sha256") => {
16
+ return node_crypto_1.default.createHash(algo).update(data).digest("hex");
17
+ };
18
+ exports.generateHash = generateHash;
19
+ exports.hashCmd = new commander_1.Command("hash")
20
+ .description("Generate a cryptographic hash for text or files")
21
+ .argument("<data>", "The text or file path to hash")
22
+ .option("-a, --algo <algorithm>", "Hash algorithm (sha256, sha512, md5)", "sha256")
23
+ .option("-f, --file", "Treat data as a file path")
24
+ .action((data, options) => {
25
+ try {
26
+ let content = data;
27
+ if (options.file) {
28
+ const filePath = node_path_1.default.resolve(data);
29
+ if (!node_fs_1.default.existsSync(filePath))
30
+ throw new Error("File not found");
31
+ content = node_fs_1.default.readFileSync(filePath);
32
+ }
33
+ const hash = (0, exports.generateHash)(content, options.algo);
34
+ console.info(JSON.stringify({
35
+ type: "hash",
36
+ algorithm: options.algo,
37
+ input: options.file ? "file" : "text",
38
+ result: hash,
39
+ }, null, 2));
40
+ }
41
+ catch (error) {
42
+ console.error(JSON.stringify({ status: "error", details: error.message }, null, 2));
43
+ }
44
+ });
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.jwtCmd = exports.signJWT = void 0;
7
+ const commander_1 = require("commander");
8
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ /**
12
+ * Core logic to sign JWT tokens.
13
+ * Can be imported directly into other projects for bot authentication.
14
+ */
15
+ const signJWT = (payload, secret, expires = "24h") => {
16
+ const options = {
17
+ expiresIn: expires,
18
+ };
19
+ return jsonwebtoken_1.default.sign(payload, secret, options);
20
+ };
21
+ exports.signJWT = signJWT;
22
+ exports.jwtCmd = new commander_1.Command("jwt")
23
+ .description("Generate and sign a JSON Web Token (JWT)")
24
+ .option("-p, --payload <json>", "Token payload in JSON string format")
25
+ .option("-f, --file <path>", "Path to a .json file containing the payload")
26
+ .option("-a, --args <pairs...>", "Key-value pairs (e.g., user=admin role=dev)")
27
+ .requiredOption("-s, --secret <key>", "Secret key to sign")
28
+ .option("-e, --expires <time>", 'Expiration time (e.g., "1h", "7d")', "24h")
29
+ .action((options) => {
30
+ try {
31
+ let payloadObj = {};
32
+ if (options.file) {
33
+ const filePath = node_path_1.default.resolve(options.file);
34
+ if (!node_fs_1.default.existsSync(filePath)) {
35
+ throw new Error(`The file does not exist at: ${filePath}`);
36
+ }
37
+ payloadObj = JSON.parse(node_fs_1.default.readFileSync(filePath, "utf8"));
38
+ }
39
+ else if (options.payload) {
40
+ payloadObj = JSON.parse(options.payload);
41
+ }
42
+ else if (options.args) {
43
+ options.args.forEach((pair) => {
44
+ const [key, value] = pair.split("=");
45
+ if (key && value) {
46
+ if (value === "true")
47
+ payloadObj[key] = true;
48
+ else if (value === "false")
49
+ payloadObj[key] = false;
50
+ else if (!isNaN(Number(value)))
51
+ payloadObj[key] = Number(value);
52
+ else
53
+ payloadObj[key] = value;
54
+ }
55
+ });
56
+ }
57
+ else {
58
+ throw new Error("You must provide a payload using -p, -f, or -a");
59
+ }
60
+ const token = (0, exports.signJWT)(payloadObj, options.secret, options.expires);
61
+ console.info(JSON.stringify({
62
+ type: "jwt",
63
+ token,
64
+ source: options.args ? "args" : options.file ? "file" : "payload",
65
+ expiresIn: options.expires,
66
+ decodedPayload: payloadObj,
67
+ }, null, 2));
68
+ }
69
+ catch (error) {
70
+ console.error(JSON.stringify({
71
+ status: "error",
72
+ message: "Error in JWT generation",
73
+ details: error.message,
74
+ }, null, 2));
75
+ }
76
+ });
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.passwordCmd = exports.generateSecurePassword = void 0;
7
+ const commander_1 = require("commander");
8
+ const node_crypto_1 = __importDefault(require("node:crypto"));
9
+ /**
10
+ * Core logic for secure password generation.
11
+ * This can be imported by your Discord bots or backend services.
12
+ */
13
+ const generateSecurePassword = (length = 16, includeNumbers = true, includeSymbols = true) => {
14
+ let charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
15
+ if (includeNumbers)
16
+ charset += "0123456789";
17
+ if (includeSymbols)
18
+ charset += "!@#$%^&*()_+~`|}{[]:;?><,./-=";
19
+ let password = "";
20
+ for (let i = 0; i < length; i++) {
21
+ const randomIndex = node_crypto_1.default.randomInt(0, charset.length);
22
+ password += charset[randomIndex];
23
+ }
24
+ return password;
25
+ };
26
+ exports.generateSecurePassword = generateSecurePassword;
27
+ exports.passwordCmd = new commander_1.Command("password")
28
+ .description("Generates a cryptographically secure password")
29
+ .option("-l, --length <numero>", "Password length", "16")
30
+ .option("--no-symbols", "Exclude special characters")
31
+ .option("--no-numbers", "Exclude numbers")
32
+ .action((options) => {
33
+ try {
34
+ const length = parseInt(options.length, 10);
35
+ const password = (0, exports.generateSecurePassword)(length, options.numbers, options.symbols);
36
+ console.info(JSON.stringify({
37
+ type: "password",
38
+ value: password,
39
+ length: length,
40
+ config: {
41
+ symbols: options.symbols,
42
+ numbers: options.numbers,
43
+ },
44
+ }, null, 2));
45
+ }
46
+ catch (error) {
47
+ console.error(JSON.stringify({ status: "error", details: error.message }, null, 2));
48
+ }
49
+ });
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.utilsCmd = exports.decodeData = exports.encodeData = void 0;
4
+ const commander_1 = require("commander");
5
+ /**
6
+ * Core logic for encoding data.
7
+ * Useful for Cloudflare API integrations or bot metadata.
8
+ */
9
+ const encodeData = (text, isUrl = false) => {
10
+ return isUrl
11
+ ? encodeURIComponent(text)
12
+ : Buffer.from(text).toString("base64");
13
+ };
14
+ exports.encodeData = encodeData;
15
+ /**
16
+ * Core logic for decoding data.
17
+ */
18
+ const decodeData = (data, isUrl = false) => {
19
+ return isUrl
20
+ ? decodeURIComponent(data)
21
+ : Buffer.from(data, "base64").toString("utf8");
22
+ };
23
+ exports.decodeData = decodeData;
24
+ exports.utilsCmd = new commander_1.Command("utils").description("Data encoding and decoding utilities");
25
+ exports.utilsCmd
26
+ .command("encode")
27
+ .description("Encode text to Base64 or URL format")
28
+ .argument("<text>", "Text to encode")
29
+ .option("-u, --url", "Use URL encoding instead of Base64")
30
+ .action((text, options) => {
31
+ const result = (0, exports.encodeData)(text, options.url);
32
+ console.log(JSON.stringify({ action: "encode", result }, null, 2));
33
+ });
34
+ exports.utilsCmd
35
+ .command("decode")
36
+ .description("Decode Base64 or URL formatted text")
37
+ .argument("<data>", "Data to decode")
38
+ .option("-u, --url", "Use URL decoding instead of Base64")
39
+ .action((data, options) => {
40
+ try {
41
+ const result = (0, exports.decodeData)(data, options.url);
42
+ console.log(JSON.stringify({ action: "decode", result }, null, 2));
43
+ }
44
+ catch (error) {
45
+ console.error(JSON.stringify({ status: "error", details: "Invalid input" }, null, 2));
46
+ }
47
+ });
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.youtubeCmd = exports.getYoutubeTokens = void 0;
4
+ const commander_1 = require("commander");
5
+ const youtube_po_token_generator_1 = require("youtube-po-token-generator");
6
+ /**
7
+ * Core logic to generate YouTube tokens.
8
+ * Essential for bypass systems in Music Bots like Kiwi Chan.
9
+ */
10
+ const getYoutubeTokens = async () => {
11
+ return await (0, youtube_po_token_generator_1.generate)();
12
+ };
13
+ exports.getYoutubeTokens = getYoutubeTokens;
14
+ exports.youtubeCmd = new commander_1.Command("youtube")
15
+ .description("Generate a valid token and visitor data from YouTube.")
16
+ .action(async () => {
17
+ try {
18
+ const tokens = await (0, exports.getYoutubeTokens)();
19
+ console.info(JSON.stringify({
20
+ type: "youtube_tokens",
21
+ visitorData: tokens.visitorData,
22
+ poToken: tokens.poToken,
23
+ timestamp: new Date().toISOString(),
24
+ }, null, 2));
25
+ }
26
+ catch (error) {
27
+ console.error(JSON.stringify({
28
+ status: "error",
29
+ message: "Failed to generate YouTube tokens.",
30
+ details: error.message,
31
+ }, null, 2));
32
+ }
33
+ });
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const password_1 = require("./Commands/password");
9
+ const youtube_1 = require("./Commands/youtube");
10
+ const jwt_1 = require("./Commands/jwt");
11
+ const hash_1 = require("./Commands/hash");
12
+ const utils_1 = require("./Commands/utils");
13
+ const node_process_1 = __importDefault(require("node:process"));
14
+ const boxen_1 = __importDefault(require("boxen"));
15
+ const chalk_1 = __importDefault(require("chalk"));
16
+ const program = new commander_1.Command();
17
+ const logo = chalk_1.default.cyan.bold(`
18
+ ______ ______ __ __ ______ __ __ _____
19
+ / ____// ____/ / / / // ____/ \\ \\ / / / ___/
20
+ / / / /__ / /_/ // __/ \\ \\_/ / \\__ \\
21
+ / /___ / ___/ / __ // /___ \\ / ___/ /
22
+ \\____//_/ /_/ /_//_____/ /_/ /____/
23
+ `);
24
+ const welcomeBanner = (0, boxen_1.default)(`${logo}\n` +
25
+ chalk_1.default.blueBright.bold(" ➔ Security & Utility Suite for Systems Engineering ") +
26
+ "\n" +
27
+ chalk_1.default.dim("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━") +
28
+ "\n" +
29
+ chalk_1.default.white(" Author: ") +
30
+ chalk_1.default.cyan("@tu_usuario") +
31
+ chalk_1.default.gray(" | ") +
32
+ chalk_1.default.white("Version: ") +
33
+ chalk_1.default.green("1.0.0"), {
34
+ padding: 1,
35
+ margin: { top: 1, bottom: 1, right: 0, left: 0 },
36
+ borderStyle: "round",
37
+ borderColor: "cyan",
38
+ backgroundColor: "#1e1e1e",
39
+ });
40
+ program
41
+ .name("cf-keys")
42
+ .description("A CLI tool to manage Cloudflare API keys and security tokens")
43
+ .version("1.0.0")
44
+ .action(() => {
45
+ console.clear();
46
+ console.log(welcomeBanner);
47
+ program.help();
48
+ });
49
+ program
50
+ .command("ping")
51
+ .description("Ping the Cloudflare API to check connectivity")
52
+ .action(() => {
53
+ console.info(JSON.stringify({
54
+ status: "success",
55
+ message: "Pong! Cloudflare API is reachable.",
56
+ }, null, 2));
57
+ });
58
+ program.addCommand(password_1.passwordCmd);
59
+ program.addCommand(youtube_1.youtubeCmd);
60
+ program.addCommand(jwt_1.jwtCmd);
61
+ program.addCommand(hash_1.hashCmd);
62
+ program.addCommand(utils_1.utilsCmd);
63
+ program.parse(node_process_1.default.argv);
package/dist/lib.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodeData = exports.encodeData = exports.generateSecurePassword = exports.getYoutubeTokens = exports.signJWT = exports.generateHash = void 0;
4
+ var hash_1 = require("./Commands/hash");
5
+ Object.defineProperty(exports, "generateHash", { enumerable: true, get: function () { return hash_1.generateHash; } });
6
+ var jwt_1 = require("./Commands/jwt");
7
+ Object.defineProperty(exports, "signJWT", { enumerable: true, get: function () { return jwt_1.signJWT; } });
8
+ var youtube_1 = require("./Commands/youtube");
9
+ Object.defineProperty(exports, "getYoutubeTokens", { enumerable: true, get: function () { return youtube_1.getYoutubeTokens; } });
10
+ var password_1 = require("./Commands/password");
11
+ Object.defineProperty(exports, "generateSecurePassword", { enumerable: true, get: function () { return password_1.generateSecurePassword; } });
12
+ var utils_1 = require("./Commands/utils");
13
+ Object.defineProperty(exports, "encodeData", { enumerable: true, get: function () { return utils_1.encodeData; } });
14
+ Object.defineProperty(exports, "decodeData", { enumerable: true, get: function () { return utils_1.decodeData; } });
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "cf-keys",
3
+ "version": "1.0.0",
4
+ "description": "Suite global de generación de claves y credenciales",
5
+ "main": "dist/lib.js",
6
+ "types": "dist/lib.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "start": "node dist/index.js",
10
+ "dev": "tsc --watch",
11
+ "prepublishOnly": "npm run build"
12
+ },
13
+ "keywords": [
14
+ "security",
15
+ "cloudflare",
16
+ "jwt",
17
+ "youtube-token",
18
+ "systems-engineering"
19
+ ],
20
+ "author": "",
21
+ "license": "MIT",
22
+ "module": "CommonJS",
23
+ "bin": {
24
+ "cf-keys": "dist/index.js"
25
+ },
26
+ "dependencies": {
27
+ "boxen": "^5.1.2",
28
+ "chalk": "^4.1.2",
29
+ "commander": "^14.0.3",
30
+ "jsonwebtoken": "^9.0.3",
31
+ "youtube-po-token-generator": "^0.6.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/jsonwebtoken": "^9.0.10",
35
+ "@types/node": "^25.3.0",
36
+ "typescript": "^5.9.3"
37
+ }
38
+ }