localssl-cli 0.1.6 → 0.1.7

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 CHANGED
@@ -151,6 +151,7 @@ It never stores CA private keys.
151
151
  - localssl-cli first trusts certs in `CurrentUser\\Root` (no admin expected)
152
152
  - if needed, it prompts: `Admin access needed for machine-wide trust. Continue? (y/N)`
153
153
  - choosing `No` keeps safe mode and skips machine-wide trust
154
+ - even if trust-store writes fail, localssl continues project cert setup (non-blocking)
154
155
  - rerunning `localssl-cli init` repairs trust if CA already exists
155
156
 
156
157
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "localssl-cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "One-command local HTTPS setup for teams",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
package/src/bootstrap.js CHANGED
@@ -138,19 +138,37 @@ async function initMachine({ quiet = false } = {}) {
138
138
 
139
139
  const hasCA = await fs.pathExists(LOCALSSL_CA_PUBLIC);
140
140
  if (hasCA) {
141
- let repairSummary = 'already configured';
141
+ let systemResult = 'system trust skipped';
142
+ let nodeResult = 'NODE_EXTRA_CA_CERTS skipped';
143
+ let firefoxResult = { trusted: false };
144
+ let chromiumResult = { trusted: false };
145
+
142
146
  try {
143
- const systemResult = await trustSystem(LOCALSSL_CA_PUBLIC);
144
- const firefoxResult = await trustInFirefox(LOCALSSL_CA_PUBLIC);
145
- const chromiumResult = await trustInChromium(LOCALSSL_CA_PUBLIC);
146
- const nodeResult = await configureNodeExtraCACerts();
147
- repairSummary = `${systemResult}; ${nodeResult}; Firefox ${firefoxResult.trusted ? 'ok' : 'skipped'}; Chrome/Edge ${chromiumResult.trusted ? 'ok' : 'skipped'}`;
147
+ systemResult = await trustSystem(LOCALSSL_CA_PUBLIC);
148
148
  } catch (error) {
149
- if (!quiet) {
150
- warn(`Trust repair skipped: ${error.message}`);
151
- }
149
+ if (!quiet) warn(`System trust repair skipped: ${error.message}`);
150
+ }
151
+
152
+ try {
153
+ firefoxResult = await trustInFirefox(LOCALSSL_CA_PUBLIC);
154
+ } catch {
155
+ firefoxResult = { trusted: false };
156
+ }
157
+
158
+ try {
159
+ chromiumResult = await trustInChromium(LOCALSSL_CA_PUBLIC);
160
+ } catch {
161
+ chromiumResult = { trusted: false };
152
162
  }
153
163
 
164
+ try {
165
+ nodeResult = await configureNodeExtraCACerts();
166
+ } catch (error) {
167
+ if (!quiet) warn(`NODE_EXTRA_CA_CERTS repair skipped: ${error.message}`);
168
+ }
169
+
170
+ const repairSummary = `${systemResult}; ${nodeResult}; Firefox ${firefoxResult.trusted ? 'ok' : 'skipped'}; Chrome/Edge ${chromiumResult.trusted ? 'ok' : 'skipped'}`;
171
+
154
172
  if (!quiet) {
155
173
  step(1, 1, 'Machine CA setup', 'skip', `(${repairSummary})`);
156
174
  }
@@ -167,10 +185,34 @@ async function initMachine({ quiet = false } = {}) {
167
185
  }
168
186
  warn('Java trust store update skipped (no admin access). System/browser trust still configured.');
169
187
  }
170
- const systemResult = await trustSystem(LOCALSSL_CA_PUBLIC);
171
- const firefoxResult = await trustInFirefox(LOCALSSL_CA_PUBLIC);
172
- const chromiumResult = await trustInChromium(LOCALSSL_CA_PUBLIC);
173
- const nodeResult = await configureNodeExtraCACerts();
188
+ let systemResult = 'system trust skipped';
189
+ let firefoxResult = { trusted: false, reason: 'not attempted' };
190
+ let chromiumResult = { trusted: false, reason: 'not attempted' };
191
+ let nodeResult = 'NODE_EXTRA_CA_CERTS skipped';
192
+
193
+ try {
194
+ systemResult = await trustSystem(LOCALSSL_CA_PUBLIC);
195
+ } catch (error) {
196
+ warn(`System trust skipped: ${error.message}`);
197
+ }
198
+
199
+ try {
200
+ firefoxResult = await trustInFirefox(LOCALSSL_CA_PUBLIC);
201
+ } catch (error) {
202
+ firefoxResult = { trusted: false, reason: error.message };
203
+ }
204
+
205
+ try {
206
+ chromiumResult = await trustInChromium(LOCALSSL_CA_PUBLIC);
207
+ } catch (error) {
208
+ chromiumResult = { trusted: false, reason: error.message };
209
+ }
210
+
211
+ try {
212
+ nodeResult = await configureNodeExtraCACerts();
213
+ } catch (error) {
214
+ warn(`NODE_EXTRA_CA_CERTS skipped: ${error.message}`);
215
+ }
174
216
 
175
217
  if (!quiet) {
176
218
  const firefoxText = firefoxResult.trusted ? `+ Firefox (${firefoxResult.reason})` : `+ Firefox skipped (${firefoxResult.reason})`;
@@ -178,6 +220,10 @@ async function initMachine({ quiet = false } = {}) {
178
220
  step(1, 1, 'Installing local CA', 'ok', `(${systemResult} ${firefoxText} ${chromiumText}; ${nodeResult})`);
179
221
  }
180
222
 
223
+ if (/unavailable|skipped/i.test(systemResult)) {
224
+ warn('Windows trust was not installed. You can still run HTTPS, but browser may warn until trust is added.');
225
+ }
226
+
181
227
  if (!firefoxResult.trusted) {
182
228
  warn(`Firefox trust skipped: ${firefoxResult.reason}`);
183
229
  }
@@ -18,7 +18,7 @@ async function trustMachineWithElevation(certPath) {
18
18
  }
19
19
 
20
20
  function trustCertificate(certPath) {
21
- return new Promise(async (resolve, reject) => {
21
+ return new Promise(async (resolve) => {
22
22
  const userViaCertutil = await run('certutil', ['-user', '-addstore', '-f', 'ROOT', certPath]);
23
23
  if (userViaCertutil) {
24
24
  resolve('Windows CurrentUser Root');
@@ -43,7 +43,7 @@ function trustCertificate(certPath) {
43
43
  return;
44
44
  }
45
45
 
46
- reject(new Error('Could not install CA in Windows trust stores. Safe mode preserved (no insecure fallback used).'));
46
+ resolve('Windows trust unavailable (no changes made)');
47
47
  });
48
48
  }
49
49