vaultkeeper 0.5.2 → 0.5.3
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/index.cjs +41 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +41 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2286,7 +2286,8 @@ async function runDoctor(options) {
|
|
|
2286
2286
|
nextSteps: ["Unsupported platform. vaultkeeper supports macOS, Linux, and Windows."]
|
|
2287
2287
|
};
|
|
2288
2288
|
}
|
|
2289
|
-
const
|
|
2289
|
+
const enabledTypes = enabledBackendTypes(options?.backends);
|
|
2290
|
+
const entries = buildCheckList(platform, enabledTypes);
|
|
2290
2291
|
const resolved = await Promise.all(
|
|
2291
2292
|
entries.map(async ({ check, required }) => {
|
|
2292
2293
|
const result = await check();
|
|
@@ -2320,19 +2321,42 @@ async function runDoctor(options) {
|
|
|
2320
2321
|
const checks = resolved.map(({ result }) => result);
|
|
2321
2322
|
return { checks, ready, warnings, nextSteps };
|
|
2322
2323
|
}
|
|
2323
|
-
function
|
|
2324
|
+
function enabledBackendTypes(backends) {
|
|
2325
|
+
if (backends === void 0) return null;
|
|
2326
|
+
const types = /* @__PURE__ */ new Set();
|
|
2327
|
+
for (const b of backends) {
|
|
2328
|
+
if (b.enabled) types.add(b.type);
|
|
2329
|
+
}
|
|
2330
|
+
return types;
|
|
2331
|
+
}
|
|
2332
|
+
function buildCheckList(platform, enabledTypes) {
|
|
2324
2333
|
const entries = [{ check: checkOpenssl, required: true }];
|
|
2325
2334
|
if (platform === "darwin") {
|
|
2326
|
-
entries.push({
|
|
2335
|
+
entries.push({
|
|
2336
|
+
check: checkSecurity,
|
|
2337
|
+
required: enabledTypes === null || enabledTypes.has("keychain")
|
|
2338
|
+
});
|
|
2327
2339
|
entries.push({ check: checkBash, required: false });
|
|
2328
2340
|
} else if (platform === "win32") {
|
|
2329
|
-
entries.push({
|
|
2341
|
+
entries.push({
|
|
2342
|
+
check: checkPowershell,
|
|
2343
|
+
required: enabledTypes === null || enabledTypes.has("dpapi")
|
|
2344
|
+
});
|
|
2330
2345
|
} else {
|
|
2331
2346
|
entries.push({ check: checkBash, required: true });
|
|
2332
|
-
entries.push({
|
|
2347
|
+
entries.push({
|
|
2348
|
+
check: checkSecretTool,
|
|
2349
|
+
required: enabledTypes === null || enabledTypes.has("secret-tool")
|
|
2350
|
+
});
|
|
2333
2351
|
}
|
|
2334
|
-
entries.push({
|
|
2335
|
-
|
|
2352
|
+
entries.push({
|
|
2353
|
+
check: checkOp,
|
|
2354
|
+
required: enabledTypes?.has("1password") ?? false
|
|
2355
|
+
});
|
|
2356
|
+
entries.push({
|
|
2357
|
+
check: checkYkman,
|
|
2358
|
+
required: enabledTypes?.has("yubikey") ?? false
|
|
2359
|
+
});
|
|
2336
2360
|
return entries;
|
|
2337
2361
|
}
|
|
2338
2362
|
|
|
@@ -2354,23 +2378,29 @@ var VaultKeeper = class _VaultKeeper {
|
|
|
2354
2378
|
* Runs doctor checks (unless skipped), loads config, and sets up the key manager.
|
|
2355
2379
|
*/
|
|
2356
2380
|
static async init(options) {
|
|
2381
|
+
const configDir = options?.configDir ?? getDefaultConfigDir();
|
|
2382
|
+
const config = options?.config ?? await loadConfig(configDir);
|
|
2357
2383
|
if (options?.skipDoctor !== true) {
|
|
2358
|
-
const doctorResult = await runDoctor();
|
|
2384
|
+
const doctorResult = await runDoctor({ backends: config.backends });
|
|
2359
2385
|
if (!doctorResult.ready) {
|
|
2360
2386
|
throw new VaultError(
|
|
2361
2387
|
`System not ready: ${doctorResult.nextSteps.join("; ")}`
|
|
2362
2388
|
);
|
|
2363
2389
|
}
|
|
2364
2390
|
}
|
|
2365
|
-
const configDir = options?.configDir ?? getDefaultConfigDir();
|
|
2366
|
-
const config = options?.config ?? await loadConfig(configDir);
|
|
2367
2391
|
const keyManager = new KeyManager();
|
|
2368
2392
|
await keyManager.init();
|
|
2369
2393
|
const vault = new _VaultKeeper(config, keyManager, configDir);
|
|
2370
2394
|
vault.#backend = vault.#resolveBackend();
|
|
2371
2395
|
return vault;
|
|
2372
2396
|
}
|
|
2373
|
-
/**
|
|
2397
|
+
/**
|
|
2398
|
+
* Run doctor checks without full initialization.
|
|
2399
|
+
*
|
|
2400
|
+
* Uses conservative platform defaults — all platform-native dependency
|
|
2401
|
+
* checks are treated as required regardless of any backend configuration.
|
|
2402
|
+
* For config-aware scoping, call `runDoctor({ backends })` directly.
|
|
2403
|
+
*/
|
|
2374
2404
|
static async doctor() {
|
|
2375
2405
|
return runDoctor();
|
|
2376
2406
|
}
|