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

36 lines (35 loc) 1.12 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadVault = loadVault; exports.saveVault = saveVault; const fs_1 = __importDefault(require("fs")); const paths_1 = require("../config/paths"); function loadVault() { if (!fs_1.default.existsSync(paths_1.vaultPath)) return {}; try { const raw = fs_1.default.readFileSync(paths_1.vaultPath, 'utf-8'); const parsed = JSON.parse(raw); if (!parsed || typeof parsed !== 'object') { console.warn('⚠️ Vault is empty or invalid.'); return {}; } return parsed; } catch (err) { console.error('⚠️ Failed to load vault:', err); return {}; } } function saveVault(vault) { try { fs_1.default.writeFileSync(paths_1.vaultPath, JSON.stringify(vault, null, 2), 'utf-8'); } catch (err) { console.error('❌ Failed to save vault:', err); process.exit(1); } }