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

39 lines (38 loc) 1.38 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.deleteCommand = deleteCommand; const commander_1 = require("commander"); const fs_1 = __importDefault(require("fs")); const paths_1 = require("../config/paths"); const vault_1 = require("../utils/vault"); const session_1 = require("../utils/session"); function deleteCommand() { const command = new commander_1.Command('del'); command .arguments('<key>') .description('Delete a secret key from the vault') .action((key) => { const session = (0, session_1.getSession)(); if (!session) { console.log('❌ Please login first using `cloak login`.'); return; } const vault = (0, vault_1.loadVault)(); if (!vault || !vault[key]) { console.log(`❌ Key "${key}" not found in vault.`); return; } delete vault[key]; try { fs_1.default.writeFileSync(paths_1.vaultPath, JSON.stringify(vault, null, 2)); console.log(`🗑️ Key "${key}" has been deleted.`); } catch (err) { console.error('⚠️ Failed to update vault:', err); } }); return command; }