UNPKG

cloakx

Version:

Cloakx is a secure, lightweight CLI tool to manage your development secrets locally — no cloud, no hassle. Store, retrieve, and manage secrets across projects with encryption and ease. 🔐 Perfect for solo devs, indie hackers, and teams who value speed, si

26 lines (25 loc) 1.1 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.setCommand = setCommand; const commander_1 = require("commander"); const fs_1 = __importDefault(require("fs")); const crypto_1 = require("../utils/crypto"); const session_1 = require("../utils/session"); const paths_1 = require("../config/paths"); function setCommand() { const cmd = new commander_1.Command('set').aliases(['add']); cmd.arguments('<key> <value>').action((key, value) => { const password = (0, session_1.getSessionPassword)(); let data = {}; // ✅ Correctly typed object if (fs_1.default.existsSync(paths_1.vaultPath)) { data = JSON.parse(fs_1.default.readFileSync(paths_1.vaultPath, 'utf-8')); } data[key] = (0, crypto_1.encrypt)(value, password); fs_1.default.writeFileSync(paths_1.vaultPath, JSON.stringify(data, null, 2)); console.log(`Saved ${key}`); }); return cmd; }