@neuraiproject/neurai-depin-terminal 2.0.0 → 2.0.2
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/README.md +3 -2
- package/dist/index.cjs +53 -53
- package/package.json +2 -2
- package/src/config/ConfigManager.js +20 -22
- package/src/utils.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neuraiproject/neurai-depin-terminal",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Neurai DePIN terminal messaging client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
"esbuild": "^0.27.2",
|
|
59
59
|
"pkg": "^5.8.1"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
SUCCESS_MESSAGES
|
|
19
19
|
} from '../constants.js';
|
|
20
20
|
import { ConfigError, PasswordError, EncryptionError } from '../errors.js';
|
|
21
|
-
import { readPassword, validatePassword, isValidUrl, isValidTimezone } from '../utils.js';
|
|
21
|
+
import { readPassword, validatePassword, isValidUrl, isValidTimezone, drainInput } from '../utils.js';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Manages application configuration with encrypted private key storage
|
|
@@ -225,6 +225,9 @@ export class ConfigManager {
|
|
|
225
225
|
* @returns {Promise<void>}
|
|
226
226
|
*/
|
|
227
227
|
async runWizard() {
|
|
228
|
+
// Ensure input buffer is clean before starting wizard
|
|
229
|
+
await drainInput(process.stdin);
|
|
230
|
+
|
|
228
231
|
const rl = readline.createInterface({
|
|
229
232
|
input: process.stdin,
|
|
230
233
|
output: process.stdout
|
|
@@ -268,24 +271,9 @@ export class ConfigManager {
|
|
|
268
271
|
}
|
|
269
272
|
}
|
|
270
273
|
|
|
271
|
-
//
|
|
272
|
-
rl.close();
|
|
273
|
-
|
|
274
|
-
// Get password and encrypt private key
|
|
275
|
-
const password = await this.promptForPasswordCreation();
|
|
276
|
-
process.stdout.write('Encrypting private key...');
|
|
277
|
-
const encryptedPrivateKey = await this.encryptPrivateKey(privateKey, password);
|
|
278
|
-
process.stdout.write('\r\x1b[K'); // Clear the "Encrypting..." line
|
|
279
|
-
console.log('✓ Private key encrypted successfully\n');
|
|
280
|
-
|
|
281
|
-
// Create new readline for remaining questions
|
|
282
|
-
const rl2 = readline.createInterface({
|
|
283
|
-
input: process.stdin,
|
|
284
|
-
output: process.stdout
|
|
285
|
-
});
|
|
286
|
-
|
|
274
|
+
// Collect polling interval
|
|
287
275
|
const pollIntervalStr = await this.promptInput(
|
|
288
|
-
|
|
276
|
+
rl,
|
|
289
277
|
`Polling interval in ms [${POLLING.DEFAULT_INTERVAL}]: `
|
|
290
278
|
) || String(POLLING.DEFAULT_INTERVAL);
|
|
291
279
|
|
|
@@ -293,12 +281,12 @@ export class ConfigManager {
|
|
|
293
281
|
let timezone = '';
|
|
294
282
|
while (!timezone) {
|
|
295
283
|
const input = await this.promptInput(
|
|
296
|
-
|
|
284
|
+
rl,
|
|
297
285
|
'Timezone offset (e.g., +1, -5, +5.5, UTC) [default: UTC]: '
|
|
298
286
|
);
|
|
299
|
-
|
|
287
|
+
|
|
300
288
|
const candidate = input || 'UTC';
|
|
301
|
-
|
|
289
|
+
|
|
302
290
|
if (isValidTimezone(candidate)) {
|
|
303
291
|
timezone = candidate;
|
|
304
292
|
} else {
|
|
@@ -306,7 +294,17 @@ export class ConfigManager {
|
|
|
306
294
|
}
|
|
307
295
|
}
|
|
308
296
|
|
|
309
|
-
|
|
297
|
+
// Close readline before password input (uses raw mode)
|
|
298
|
+
rl.close();
|
|
299
|
+
|
|
300
|
+
// Get password and encrypt private key
|
|
301
|
+
const password = await this.promptForPasswordCreation();
|
|
302
|
+
process.stdout.write('Encrypting private key...');
|
|
303
|
+
const encryptedPrivateKey = await this.encryptPrivateKey(privateKey, password);
|
|
304
|
+
process.stdout.write('\r\x1b[K'); // Clear the "Encrypting..." line
|
|
305
|
+
console.log('✓ Private key encrypted successfully\n');
|
|
306
|
+
|
|
307
|
+
|
|
310
308
|
|
|
311
309
|
// Build configuration object
|
|
312
310
|
const config = {
|
package/src/utils.js
CHANGED
|
@@ -221,8 +221,8 @@ export async function readPassword(prompt, maskChar = '*') {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
//
|
|
225
|
-
|
|
224
|
+
// Pause stdin to ensure clean state for next consumer (e.g. readline)
|
|
225
|
+
stdin.pause();
|
|
226
226
|
};
|
|
227
227
|
|
|
228
228
|
// Ensure stdin is in correct initial state
|