neozip-cli 0.90.0 → 0.95.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.
Files changed (74) hide show
  1. package/AGENTS.md +93 -0
  2. package/CHANGELOG.md +58 -1
  3. package/DOCUMENTATION.md +22 -30
  4. package/README.md +104 -42
  5. package/dist/src/account/account-state.js +95 -0
  6. package/dist/src/account/format-account-status.js +62 -0
  7. package/dist/src/account/identity-provision.js +79 -0
  8. package/dist/src/account/identity-wrap.js +106 -0
  9. package/dist/src/account/profile-crypto.js +85 -0
  10. package/dist/src/account/profile-store.js +129 -0
  11. package/dist/src/account/require-account.js +32 -0
  12. package/dist/src/account/types.js +3 -0
  13. package/dist/src/account/wallet-evm.js +46 -0
  14. package/dist/src/account/wallet-setup.js +33 -0
  15. package/dist/src/archive/crypto-self.js +117 -0
  16. package/dist/src/archive/identity-key.js +217 -0
  17. package/dist/src/archive/recipient-lookup.js +61 -0
  18. package/dist/src/cli/output.js +100 -0
  19. package/dist/src/cli/params.js +122 -0
  20. package/dist/src/cli/schema.js +186 -0
  21. package/dist/src/cli/validate.js +119 -0
  22. package/dist/src/commands/mintTimestampProof.js +26 -14
  23. package/dist/src/config/ConfigSetup.js +82 -423
  24. package/dist/src/connect/command.js +364 -0
  25. package/dist/src/connection/bootstrap.js +50 -0
  26. package/dist/src/connection/cli-guidance.js +101 -0
  27. package/dist/src/connection/cli-prefs.js +180 -0
  28. package/dist/src/connection/cli-settings.js +140 -0
  29. package/dist/src/connection/cli-types.js +14 -0
  30. package/dist/src/connection/coordinator.js +83 -0
  31. package/dist/src/connection/credentials.js +33 -0
  32. package/dist/src/connection/crypto.js +96 -0
  33. package/dist/src/connection/dump.js +117 -0
  34. package/dist/src/connection/funding.js +187 -0
  35. package/dist/src/connection/incomplete-setup.js +89 -0
  36. package/dist/src/connection/interactive.js +871 -0
  37. package/dist/src/connection/legacy-profile-reader.js +87 -0
  38. package/dist/src/connection/magic-link.js +142 -0
  39. package/dist/src/connection/migrate.js +115 -0
  40. package/dist/src/connection/onboarding.js +616 -0
  41. package/dist/src/connection/origin.js +69 -0
  42. package/dist/src/connection/phase.js +101 -0
  43. package/dist/src/connection/phone.js +26 -0
  44. package/dist/src/connection/promote-active.js +56 -0
  45. package/dist/src/connection/reset.js +56 -0
  46. package/dist/src/connection/status-report.js +52 -0
  47. package/dist/src/connection/store.js +406 -0
  48. package/dist/src/connection/token-auth.js +44 -0
  49. package/dist/src/connection/types.js +3 -0
  50. package/dist/src/connection/wallet-json-migration.js +155 -0
  51. package/dist/src/connection/wallet-login.js +65 -0
  52. package/dist/src/connection/wallet-setup.js +83 -0
  53. package/dist/src/constants/wallet-identity.js +14 -0
  54. package/dist/src/exit-codes.js +54 -10
  55. package/dist/src/neolist.js +93 -9
  56. package/dist/src/neounzip.js +217 -59
  57. package/dist/src/neozip/blockchain.js +18 -18
  58. package/dist/src/neozip/createZip.js +114 -91
  59. package/dist/src/neozip/upgradeZip.js +14 -11
  60. package/dist/src/neozip.js +252 -75
  61. package/dist/src/skills/command.js +256 -0
  62. package/dist/src/skills/locate.js +99 -0
  63. package/dist/src/util/mask.js +34 -0
  64. package/dist/src/util/token-service-fetch.js +26 -0
  65. package/env.example +18 -85
  66. package/package.json +89 -82
  67. package/skills/neozip-connect/SKILL.md +95 -0
  68. package/skills/neozip-create/SKILL.md +57 -0
  69. package/skills/neozip-extract/SKILL.md +58 -0
  70. package/skills/neozip-legacy/SKILL.md +48 -0
  71. package/skills/neozip-list/SKILL.md +56 -0
  72. package/skills/neozip-shared/SKILL.md +60 -0
  73. package/dist/src/commands/verifyEmail.js +0 -146
  74. package/dist/src/config/ConfigStore.js +0 -406
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: neozip-shared
3
+ description: "NeoZip global flags for agents: JSON output, --params/--json input, schema introspection, dry-run, and exit codes. Prerequisite for the other neozip skills."
4
+ metadata:
5
+ version: 0.90.0
6
+ openclaw:
7
+ category: "productivity"
8
+ requires:
9
+ bins:
10
+ - neozip
11
+ - neounzip
12
+ - neolist
13
+ cliHelp: "neozip --help"
14
+ ---
15
+
16
+ # NeoZip — shared agent conventions
17
+
18
+ Read this before the per-command skills. It applies to `neozip`, `neounzip`, and
19
+ `neolist`.
20
+
21
+ ## Get machine-readable output
22
+
23
+ Add `--format json` to any command. Output is a single JSON object on stdout:
24
+
25
+ - Success: `{ "ok": true, ... }`
26
+ - Error: `{ "ok": false, "error": { "code", "exitCode", "message", "nextCommand"? } }`
27
+
28
+ stdout carries only the JSON object. Human hints/progress go to stderr. Always
29
+ parse stdout; never parse human text.
30
+
31
+ ## Introspect before calling
32
+
33
+ ```bash
34
+ neozip schema neozip # or: neounzip | neolist | connect
35
+ ```
36
+
37
+ Returns accepted `--params` fields, the `--json` payload shape, defaults, and
38
+ exit codes. Use it to build your `--params`/`--json` objects.
39
+
40
+ ## Provide input as JSON
41
+
42
+ - `--params '<JSON>'` — options ("how").
43
+ - `--json '<JSON>'` — payload ("what": archive + files/targets).
44
+ - Either accepts `-` to read JSON from stdin.
45
+ - Explicit CLI flags override values from `--params`/`--json`.
46
+
47
+ ## Always dry-run mutations first
48
+
49
+ ```bash
50
+ neozip --format json --dry-run --json '{"archive":"out.zip","files":["src/"]}'
51
+ neounzip --format json --dry-run --params '{"exdir":"out"}' in.zip
52
+ ```
53
+
54
+ `--dry-run` resolves the full plan and writes nothing.
55
+
56
+ ## Branch on exit codes
57
+
58
+ Exit codes are InfoZip-compatible and echoed in `error.exitCode`. Common:
59
+ `0` success, `10` parameter/option error, `9` files not found, `82` bad password.
60
+ When an error includes `nextCommand`, run it to recover.
@@ -1,146 +0,0 @@
1
- "use strict";
2
- /**
3
- * Verify email for Zipstamp timestamping
4
- *
5
- * Sets a default email for Zipstamp timestamps. Checks with the server whether
6
- * the email is already verified; if not, sends a magic link. Always saves as default.
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.runVerifyEmail = runVerifyEmail;
43
- const readline = __importStar(require("readline"));
44
- const zipstamp_server_1 = require("neozip-blockchain/zipstamp-server");
45
- const ConfigStore_1 = require("../config/ConfigStore");
46
- const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
47
- function isValidEmail(email) {
48
- return EMAIL_REGEX.test(email.trim());
49
- }
50
- function isAlreadyVerifiedMessage(msg) {
51
- if (!msg)
52
- return false;
53
- const lower = msg.toLowerCase();
54
- return ((lower.includes('already') && (lower.includes('verified') || lower.includes('registered'))) ||
55
- lower.includes('already verified') ||
56
- lower.includes('email already'));
57
- }
58
- /**
59
- * Run the verify-email flow.
60
- * Calls the server to check verification status; if already verified, sets as default.
61
- * If not, sends magic link and sets as default. Always saves email to config.
62
- */
63
- async function runVerifyEmail(options) {
64
- const rl = readline.createInterface({
65
- input: process.stdin,
66
- output: process.stdout,
67
- });
68
- const prompt = (question, defaultValue) => {
69
- return new Promise((resolve) => {
70
- const display = defaultValue ? `${question} (${defaultValue}): ` : `${question}: `;
71
- rl.question(display, (answer) => {
72
- resolve((answer.trim() || defaultValue || '').trim());
73
- });
74
- });
75
- };
76
- try {
77
- console.log('\n📧 Zipstamp Email Configuration\n');
78
- console.log('Zipstamp requires a verified email to create timestamped ZIP files.');
79
- console.log('');
80
- const config = ConfigStore_1.ConfigStore.getConfig();
81
- const defaultEmail = options?.email || config.timestampEmail || '';
82
- const email = await prompt('Email address', defaultEmail || undefined);
83
- if (!email) {
84
- console.error('❌ Email is required');
85
- rl.close();
86
- return false;
87
- }
88
- if (!isValidEmail(email)) {
89
- console.error('❌ Invalid email format');
90
- rl.close();
91
- return false;
92
- }
93
- // --set-default: skip server check, just save
94
- if (options?.setDefaultOnly) {
95
- const saved = ConfigStore_1.ConfigStore.set('zipstamp.timestampEmail', email);
96
- if (!saved) {
97
- console.error('❌ Failed to save email to configuration');
98
- rl.close();
99
- return false;
100
- }
101
- console.log(`\n✅ ${email} set as default for Zipstamp timestamps.`);
102
- console.log('\n💡 You can now create timestamped ZIPs: neozip -ts <archive> <files>\n');
103
- rl.close();
104
- return true;
105
- }
106
- // Check with server: register returns status (already verified vs magic link sent)
107
- console.log(`\n📤 Checking verification status for ${email}...`);
108
- const registerResult = await (0, zipstamp_server_1.registerEmail)(email, {
109
- debug: options?.debug,
110
- });
111
- if (!registerResult.success) {
112
- console.error('❌ Failed to register email:', registerResult.error || 'Unknown error');
113
- rl.close();
114
- return false;
115
- }
116
- const res = registerResult;
117
- const msg = res.message || '';
118
- const alreadyVerified = res.verified === true ||
119
- res.alreadyVerified === true ||
120
- isAlreadyVerifiedMessage(msg);
121
- const saved = ConfigStore_1.ConfigStore.set('zipstamp.timestampEmail', email);
122
- if (!saved) {
123
- console.error('❌ Failed to save email to configuration');
124
- rl.close();
125
- return false;
126
- }
127
- if (alreadyVerified) {
128
- console.log('\n✅ Email is already verified. Set as default.');
129
- }
130
- else {
131
- console.log('\n✅ Verification link sent. Check your inbox (and spam folder).');
132
- console.log(' Click the magic link in the email to complete verification.');
133
- console.log(` ${email} has been set as default and will work once you've clicked the link.`);
134
- }
135
- console.log('\n💡 You can now create timestamped ZIPs: neozip -ts <archive> <files>\n');
136
- rl.close();
137
- return true;
138
- }
139
- catch (error) {
140
- const msg = error instanceof Error ? error.message : String(error);
141
- console.error('❌ Error:', msg);
142
- rl.close();
143
- return false;
144
- }
145
- }
146
- //# sourceMappingURL=verifyEmail.js.map
@@ -1,406 +0,0 @@
1
- "use strict";
2
- /**
3
- * ConfigStore - Configuration storage and retrieval manager for NeoZip
4
- * Handles wallet.json file I/O, environment variable resolution, and config validation
5
- * This is the data layer - handles all config storage/retrieval operations
6
- */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- var desc = Object.getOwnPropertyDescriptor(m, k);
10
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
- desc = { enumerable: true, get: function() { return m[k]; } };
12
- }
13
- Object.defineProperty(o, k2, desc);
14
- }) : (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- o[k2] = m[k];
17
- }));
18
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
- Object.defineProperty(o, "default", { enumerable: true, value: v });
20
- }) : function(o, v) {
21
- o["default"] = v;
22
- });
23
- var __importStar = (this && this.__importStar) || (function () {
24
- var ownKeys = function(o) {
25
- ownKeys = Object.getOwnPropertyNames || function (o) {
26
- var ar = [];
27
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
- return ar;
29
- };
30
- return ownKeys(o);
31
- };
32
- return function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- })();
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.ConfigStore = void 0;
42
- const fs = __importStar(require("fs"));
43
- const path = __importStar(require("path"));
44
- const os = __importStar(require("os"));
45
- const neozip_blockchain_1 = require("neozip-blockchain");
46
- const DEFAULTS = {
47
- network: 'base-sepolia',
48
- timestampEmail: null,
49
- rpcUrls: {
50
- baseSepolia: 'https://sepolia.base.org',
51
- baseMainnet: 'https://mainnet.base.org',
52
- },
53
- gas: {
54
- multiplier: 1.0,
55
- maxPriceGwei: 100,
56
- },
57
- debug: {
58
- verbose: false,
59
- enabled: false,
60
- },
61
- };
62
- class ConfigStore {
63
- /**
64
- * Get the configuration directory path
65
- */
66
- static getConfigDir() {
67
- return this.configDir;
68
- }
69
- /**
70
- * Get the configuration file path
71
- */
72
- static getConfigPath() {
73
- return this.configPath;
74
- }
75
- /**
76
- * Check if wallet.json exists
77
- */
78
- static exists() {
79
- return fs.existsSync(this.getConfigPath());
80
- }
81
- /**
82
- * Load configuration from wallet.json
83
- */
84
- static load() {
85
- if (!this.exists()) {
86
- return null;
87
- }
88
- try {
89
- const content = fs.readFileSync(this.getConfigPath(), 'utf-8');
90
- return JSON.parse(content);
91
- }
92
- catch (error) {
93
- console.error(`⚠️ Failed to load wallet.json: ${error}`);
94
- return null;
95
- }
96
- }
97
- /**
98
- * Save configuration to wallet.json
99
- */
100
- static save(config) {
101
- try {
102
- // Ensure config directory exists
103
- const configDir = this.getConfigDir();
104
- if (!fs.existsSync(configDir)) {
105
- fs.mkdirSync(configDir, { recursive: true, mode: 0o700 });
106
- }
107
- // Write config file with restricted permissions
108
- fs.writeFileSync(this.getConfigPath(), JSON.stringify(config, null, 2), { mode: 0o600 });
109
- return true;
110
- }
111
- catch (error) {
112
- console.error(`❌ Failed to save wallet.json: ${error}`);
113
- return false;
114
- }
115
- }
116
- /**
117
- * Delete wallet.json configuration
118
- */
119
- static reset() {
120
- try {
121
- if (this.exists()) {
122
- fs.unlinkSync(this.getConfigPath());
123
- }
124
- return true;
125
- }
126
- catch (error) {
127
- console.error(`❌ Failed to delete wallet.json: ${error}`);
128
- return false;
129
- }
130
- }
131
- /**
132
- * Get resolved configuration with precedence: CLI args > ENV vars > wallet.json > defaults
133
- * @param cliWalletKey - Wallet key from CLI argument (highest priority)
134
- */
135
- static getConfig(cliWalletKey) {
136
- const jsonConfig = this.load();
137
- // Wallet key precedence: CLI > ENV > wallet.json
138
- let walletKey = null;
139
- if (cliWalletKey) {
140
- walletKey = cliWalletKey;
141
- }
142
- else if (process.env.NEOZIP_WALLET_PASSKEY) {
143
- walletKey = process.env.NEOZIP_WALLET_PASSKEY;
144
- }
145
- else if (jsonConfig?.wallet?.privateKey) {
146
- walletKey = jsonConfig.wallet.privateKey;
147
- }
148
- // Network precedence: ENV > wallet.json > default
149
- const network = process.env.NEOZIP_NETWORK ||
150
- jsonConfig?.wallet?.network ||
151
- DEFAULTS.network;
152
- // Timestamp email precedence: ENV > wallet.json > default (for Zipstamp)
153
- const timestampEmail = process.env.NEOZIP_TIMESTAMP_EMAIL ||
154
- jsonConfig?.zipstamp?.timestampEmail ||
155
- null;
156
- // RPC URLs precedence: ENV > wallet.json > default
157
- const rpcUrls = {
158
- baseSepolia: process.env.NEOZIP_BASE_SEPOLIA_RPC_URL ||
159
- jsonConfig?.rpc?.baseSepolia ||
160
- DEFAULTS.rpcUrls.baseSepolia,
161
- baseMainnet: process.env.NEOZIP_BASE_MAINNET_RPC_URL ||
162
- jsonConfig?.rpc?.baseMainnet ||
163
- DEFAULTS.rpcUrls.baseMainnet,
164
- };
165
- // Gas settings precedence: ENV > wallet.json > default
166
- const gas = {
167
- multiplier: process.env.NEOZIP_GAS_MULTIPLIER ?
168
- parseFloat(process.env.NEOZIP_GAS_MULTIPLIER) :
169
- jsonConfig?.gas?.multiplier ||
170
- DEFAULTS.gas.multiplier,
171
- maxPriceGwei: process.env.NEOZIP_MAX_GAS_PRICE ?
172
- parseInt(process.env.NEOZIP_MAX_GAS_PRICE) :
173
- jsonConfig?.gas?.maxPriceGwei ||
174
- DEFAULTS.gas.maxPriceGwei,
175
- };
176
- // Debug settings precedence: ENV > wallet.json > default
177
- const debug = {
178
- verbose: process.env.NEOZIP_VERBOSE === 'true' ||
179
- jsonConfig?.debug?.verbose ||
180
- DEFAULTS.debug.verbose,
181
- enabled: process.env.NEOZIP_DEBUG === 'true' ||
182
- jsonConfig?.debug?.enabled ||
183
- DEFAULTS.debug.enabled,
184
- };
185
- return {
186
- walletKey,
187
- network,
188
- timestampEmail,
189
- rpcUrls,
190
- gas,
191
- debug,
192
- };
193
- }
194
- /**
195
- * Validate wallet private key format
196
- */
197
- static validatePrivateKey(key) {
198
- // Must be 66 characters (0x + 64 hex chars) or 64 characters (without 0x)
199
- const withPrefix = /^0x[0-9a-fA-F]{64}$/;
200
- const withoutPrefix = /^[0-9a-fA-F]{64}$/;
201
- return withPrefix.test(key) || withoutPrefix.test(key);
202
- }
203
- /**
204
- * Validate network name (uses nameAliases from CONTRACT_CONFIGS)
205
- */
206
- static validateNetwork(network) {
207
- return (0, neozip_blockchain_1.getChainIdByName)(network) !== null;
208
- }
209
- /**
210
- * Update a specific configuration value
211
- */
212
- static set(key, value) {
213
- let config = this.load() || {
214
- wallet: {},
215
- rpc: {},
216
- gas: {},
217
- debug: {},
218
- };
219
- // Parse the key path (e.g., "wallet.privateKey", "gas.multiplier")
220
- const parts = key.split('.');
221
- switch (parts[0]) {
222
- case 'zipstamp':
223
- if (!config.zipstamp)
224
- config.zipstamp = {};
225
- if (parts[1] === 'timestampEmail') {
226
- config.zipstamp.timestampEmail = value;
227
- }
228
- else {
229
- console.error(`❌ Unknown zipstamp key: ${parts[1]}`);
230
- return false;
231
- }
232
- break;
233
- case 'wallet':
234
- if (parts[1] === 'privateKey') {
235
- if (!this.validatePrivateKey(value)) {
236
- console.error('❌ Invalid private key format');
237
- return false;
238
- }
239
- config.wallet.privateKey = value.startsWith('0x') ? value : `0x${value}`;
240
- }
241
- else if (parts[1] === 'network') {
242
- if (!this.validateNetwork(value)) {
243
- const supportedNetworks = (0, neozip_blockchain_1.getSupportedNetworkNames)();
244
- console.error(`❌ Invalid network: "${value}"`);
245
- console.error(`Supported networks: ${supportedNetworks.join(', ')}`);
246
- return false;
247
- }
248
- config.wallet.network = value;
249
- }
250
- break;
251
- case 'rpc':
252
- if (!config.rpc)
253
- config.rpc = {};
254
- // Support both legacy keys and dynamic network keys
255
- if (parts[1] === 'baseSepolia') {
256
- config.rpc.baseSepolia = value;
257
- }
258
- else if (parts[1] === 'baseMainnet') {
259
- config.rpc.baseMainnet = value;
260
- }
261
- else {
262
- // Allow dynamic network keys (e.g., "rpc.baseSepolia", "rpc.arbitrumSepolia")
263
- config.rpc[parts[1]] = value;
264
- }
265
- break;
266
- case 'gas':
267
- if (!config.gas)
268
- config.gas = {};
269
- if (parts[1] === 'multiplier') {
270
- config.gas.multiplier = parseFloat(value);
271
- }
272
- else if (parts[1] === 'maxPriceGwei') {
273
- config.gas.maxPriceGwei = parseInt(value);
274
- }
275
- break;
276
- case 'debug':
277
- if (!config.debug)
278
- config.debug = {};
279
- if (parts[1] === 'verbose') {
280
- config.debug.verbose = value === 'true';
281
- }
282
- else if (parts[1] === 'enabled') {
283
- config.debug.enabled = value === 'true';
284
- }
285
- break;
286
- default:
287
- console.error(`❌ Unknown configuration key: ${key}`);
288
- return false;
289
- }
290
- return this.save(config);
291
- }
292
- /**
293
- * Delete a specific configuration key
294
- */
295
- static delete(key) {
296
- const config = this.load();
297
- if (!config) {
298
- console.error('❌ No configuration found');
299
- return false;
300
- }
301
- // Parse the key path (e.g., "wallet.privateKey", "gas.multiplier")
302
- const parts = key.split('.');
303
- switch (parts[0]) {
304
- case 'zipstamp':
305
- if (!config.zipstamp) {
306
- console.error('❌ No Zipstamp configuration found');
307
- return false;
308
- }
309
- if (parts[1] === 'timestampEmail') {
310
- delete config.zipstamp.timestampEmail;
311
- }
312
- else {
313
- console.error(`❌ Unknown zipstamp key: ${parts[1]}`);
314
- return false;
315
- }
316
- break;
317
- case 'wallet':
318
- if (parts[1] === 'privateKey') {
319
- delete config.wallet.privateKey;
320
- }
321
- else if (parts[1] === 'network') {
322
- delete config.wallet.network;
323
- }
324
- else {
325
- console.error(`❌ Unknown wallet key: ${parts[1]}`);
326
- return false;
327
- }
328
- break;
329
- case 'rpc':
330
- if (!config.rpc) {
331
- console.error('❌ No RPC configuration found');
332
- return false;
333
- }
334
- // Support both legacy keys and dynamic network keys
335
- if (parts[1] === 'baseSepolia' || parts[1] === 'baseMainnet' || parts[1] in config.rpc) {
336
- delete config.rpc[parts[1]];
337
- }
338
- else {
339
- console.error(`❌ Unknown RPC key: ${parts[1]}`);
340
- return false;
341
- }
342
- break;
343
- case 'gas':
344
- if (!config.gas) {
345
- console.error('❌ No gas configuration found');
346
- return false;
347
- }
348
- if (parts[1] === 'multiplier') {
349
- delete config.gas.multiplier;
350
- }
351
- else if (parts[1] === 'maxPriceGwei') {
352
- delete config.gas.maxPriceGwei;
353
- }
354
- else {
355
- console.error(`❌ Unknown gas key: ${parts[1]}`);
356
- return false;
357
- }
358
- break;
359
- case 'debug':
360
- if (!config.debug) {
361
- console.error('❌ No debug configuration found');
362
- return false;
363
- }
364
- if (parts[1] === 'verbose') {
365
- delete config.debug.verbose;
366
- }
367
- else if (parts[1] === 'enabled') {
368
- delete config.debug.enabled;
369
- }
370
- else {
371
- console.error(`❌ Unknown debug key: ${parts[1]}`);
372
- return false;
373
- }
374
- break;
375
- default:
376
- console.error(`❌ Unknown configuration key: ${key}`);
377
- return false;
378
- }
379
- return this.save(config);
380
- }
381
- /**
382
- * Get a masked version of the config for display (hides sensitive data)
383
- */
384
- static getMaskedConfig() {
385
- const config = this.getConfig();
386
- const masked = {
387
- wallet: {
388
- privateKey: config.walletKey ?
389
- `${config.walletKey.substring(0, 6)}...${config.walletKey.substring(config.walletKey.length - 4)}` :
390
- '(not set)',
391
- network: config.network,
392
- },
393
- zipstamp: {
394
- timestampEmail: config.timestampEmail || '(not set)',
395
- },
396
- rpc: config.rpcUrls,
397
- gas: config.gas,
398
- debug: config.debug,
399
- };
400
- return JSON.stringify(masked, null, 2);
401
- }
402
- }
403
- exports.ConfigStore = ConfigStore;
404
- ConfigStore.configDir = path.join(os.homedir(), '.neozip');
405
- ConfigStore.configPath = path.join(ConfigStore.configDir, 'wallet.json');
406
- //# sourceMappingURL=ConfigStore.js.map