@alilis/k-hat 0.2.1 → 0.2.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/dist/cli.js +21 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -35,7 +35,7 @@ Setup
|
|
|
35
35
|
log [--tail <n>] show recent masked proxy request logs
|
|
36
36
|
ui issue a one-time browser ticket for the management page
|
|
37
37
|
tui open the interactive terminal management UI
|
|
38
|
-
export <file> export encrypted portable vault
|
|
38
|
+
export <file> export encrypted portable vault (use a .khat suffix)
|
|
39
39
|
import <file> [--force] import encrypted portable vault
|
|
40
40
|
|
|
41
41
|
Access token
|
|
@@ -135,16 +135,26 @@ async function promptPassword(label) {
|
|
|
135
135
|
return new Promise((resolve, reject) => {
|
|
136
136
|
const stdin = process.stdin;
|
|
137
137
|
let value = '';
|
|
138
|
-
const onData = (chunk) => { const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
const onData = (chunk) => { for (const ch of chunk.toString()) {
|
|
139
|
+
if (ch === '\n' || ch === '\r') {
|
|
140
|
+
stdin.setRawMode?.(false);
|
|
141
|
+
stdin.pause();
|
|
142
|
+
stdin.off('data', onData);
|
|
143
|
+
process.stdout.write('\n');
|
|
144
|
+
value = value.trim();
|
|
145
|
+
return value ? resolve(value) : reject(new Error('empty password'));
|
|
146
|
+
}
|
|
147
|
+
if (ch === '\u007f' || ch === '\b') {
|
|
148
|
+
if (value) {
|
|
149
|
+
value = value.slice(0, -1);
|
|
150
|
+
process.stdout.write('\b \b');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
value += ch;
|
|
155
|
+
process.stdout.write('*');
|
|
156
|
+
}
|
|
157
|
+
} };
|
|
148
158
|
stdin.setRawMode?.(true);
|
|
149
159
|
stdin.resume();
|
|
150
160
|
stdin.on('data', onData);
|