plotlink-ows 0.1.14 → 0.1.15
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/bin/plotlink-ows.js +11 -11
- package/package.json +1 -1
package/bin/plotlink-ows.js
CHANGED
|
@@ -55,31 +55,34 @@ function ask(rl, question) {
|
|
|
55
55
|
|
|
56
56
|
function askSecret(question) {
|
|
57
57
|
return new Promise((resolve) => {
|
|
58
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
59
58
|
process.stdout.write(question);
|
|
60
59
|
const stdin = process.stdin;
|
|
61
60
|
const wasRaw = stdin.isRaw;
|
|
62
61
|
if (stdin.setRawMode) stdin.setRawMode(true);
|
|
62
|
+
stdin.resume();
|
|
63
63
|
let input = "";
|
|
64
64
|
const onData = (ch) => {
|
|
65
65
|
const c = ch.toString();
|
|
66
66
|
if (c === "\n" || c === "\r") {
|
|
67
67
|
if (stdin.setRawMode) stdin.setRawMode(wasRaw);
|
|
68
68
|
stdin.removeListener("data", onData);
|
|
69
|
+
stdin.pause();
|
|
69
70
|
process.stdout.write("\n");
|
|
70
|
-
rl.close();
|
|
71
71
|
resolve(input);
|
|
72
72
|
} else if (c === "\u0003") {
|
|
73
|
+
if (stdin.setRawMode) stdin.setRawMode(wasRaw);
|
|
73
74
|
process.exit(0);
|
|
74
75
|
} else if (c === "\u007F" || c === "\b") {
|
|
75
|
-
input
|
|
76
|
+
if (input.length > 0) {
|
|
77
|
+
input = input.slice(0, -1);
|
|
78
|
+
process.stdout.write("\b \b");
|
|
79
|
+
}
|
|
76
80
|
} else {
|
|
77
81
|
input += c;
|
|
78
82
|
process.stdout.write("*");
|
|
79
83
|
}
|
|
80
84
|
};
|
|
81
85
|
stdin.on("data", onData);
|
|
82
|
-
stdin.resume();
|
|
83
86
|
});
|
|
84
87
|
}
|
|
85
88
|
|
|
@@ -113,8 +116,6 @@ async function cmdInit() {
|
|
|
113
116
|
header("PlotLink OWS — Setup Wizard");
|
|
114
117
|
log("Let's get your local writer app configured.\n");
|
|
115
118
|
|
|
116
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
117
|
-
|
|
118
119
|
// Step 1: Prerequisites
|
|
119
120
|
header("Step 1: Prerequisites");
|
|
120
121
|
const nodeVersion = process.version;
|
|
@@ -136,18 +137,19 @@ async function cmdInit() {
|
|
|
136
137
|
|
|
137
138
|
// Step 2: Passphrase
|
|
138
139
|
header("Step 2: Passphrase");
|
|
139
|
-
log("
|
|
140
|
+
log("This passphrase encrypts your OWS (Open Wallet Standard) wallet.");
|
|
141
|
+
log("Your private key is stored locally and never leaves your machine.");
|
|
142
|
+
log("The passphrase protects signing and app access.\n");
|
|
143
|
+
log("Learn more: https://docs.openwallet.sh/\n");
|
|
140
144
|
const passphrase = await askSecret(" Passphrase (min 8 chars): ");
|
|
141
145
|
const confirm = await askSecret(" Confirm: ");
|
|
142
146
|
|
|
143
147
|
if (passphrase !== confirm) {
|
|
144
148
|
error("Passphrases don't match.");
|
|
145
|
-
rl.close();
|
|
146
149
|
process.exit(1);
|
|
147
150
|
}
|
|
148
151
|
if (passphrase.length < 8) {
|
|
149
152
|
error("Passphrase must be at least 8 characters.");
|
|
150
|
-
rl.close();
|
|
151
153
|
process.exit(1);
|
|
152
154
|
}
|
|
153
155
|
|
|
@@ -180,8 +182,6 @@ async function cmdInit() {
|
|
|
180
182
|
warn("You can create it later from the app.");
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
rl.close();
|
|
184
|
-
|
|
185
185
|
// Save config
|
|
186
186
|
const config = {
|
|
187
187
|
port: 7777,
|