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.d.cts
CHANGED
|
@@ -647,7 +647,13 @@ declare class VaultKeeper {
|
|
|
647
647
|
* Runs doctor checks (unless skipped), loads config, and sets up the key manager.
|
|
648
648
|
*/
|
|
649
649
|
static init(options?: VaultKeeperOptions): Promise<VaultKeeper>;
|
|
650
|
-
/**
|
|
650
|
+
/**
|
|
651
|
+
* Run doctor checks without full initialization.
|
|
652
|
+
*
|
|
653
|
+
* Uses conservative platform defaults — all platform-native dependency
|
|
654
|
+
* checks are treated as required regardless of any backend configuration.
|
|
655
|
+
* For config-aware scoping, call `runDoctor({ backends })` directly.
|
|
656
|
+
*/
|
|
651
657
|
static doctor(): Promise<PreflightResult>;
|
|
652
658
|
/**
|
|
653
659
|
* Retrieve a secret from the backend and return a JWE token that encapsulates it.
|
|
@@ -813,6 +819,18 @@ type Platform = 'darwin' | 'win32' | 'linux';
|
|
|
813
819
|
interface RunDoctorOptions {
|
|
814
820
|
/** Override the platform detection (useful for testing). */
|
|
815
821
|
platform?: Platform;
|
|
822
|
+
/**
|
|
823
|
+
* When provided, doctor checks are scoped to the given backends.
|
|
824
|
+
* Platform-native dependency checks (e.g. `secret-tool`, `security`,
|
|
825
|
+
* `powershell`) are demoted from required to optional when the
|
|
826
|
+
* corresponding backend is not enabled. Plugin tool checks (`op`,
|
|
827
|
+
* `ykman`) are promoted from optional to required when their backend
|
|
828
|
+
* (`1password`, `yubikey`) is explicitly enabled.
|
|
829
|
+
*
|
|
830
|
+
* When omitted, all platform-default checks are treated as required
|
|
831
|
+
* (backward-compatible behavior).
|
|
832
|
+
*/
|
|
833
|
+
backends?: BackendConfig[];
|
|
816
834
|
}
|
|
817
835
|
/**
|
|
818
836
|
* Run all platform-appropriate preflight checks and aggregate the results.
|
package/dist/index.d.ts
CHANGED
|
@@ -647,7 +647,13 @@ declare class VaultKeeper {
|
|
|
647
647
|
* Runs doctor checks (unless skipped), loads config, and sets up the key manager.
|
|
648
648
|
*/
|
|
649
649
|
static init(options?: VaultKeeperOptions): Promise<VaultKeeper>;
|
|
650
|
-
/**
|
|
650
|
+
/**
|
|
651
|
+
* Run doctor checks without full initialization.
|
|
652
|
+
*
|
|
653
|
+
* Uses conservative platform defaults — all platform-native dependency
|
|
654
|
+
* checks are treated as required regardless of any backend configuration.
|
|
655
|
+
* For config-aware scoping, call `runDoctor({ backends })` directly.
|
|
656
|
+
*/
|
|
651
657
|
static doctor(): Promise<PreflightResult>;
|
|
652
658
|
/**
|
|
653
659
|
* Retrieve a secret from the backend and return a JWE token that encapsulates it.
|
|
@@ -813,6 +819,18 @@ type Platform = 'darwin' | 'win32' | 'linux';
|
|
|
813
819
|
interface RunDoctorOptions {
|
|
814
820
|
/** Override the platform detection (useful for testing). */
|
|
815
821
|
platform?: Platform;
|
|
822
|
+
/**
|
|
823
|
+
* When provided, doctor checks are scoped to the given backends.
|
|
824
|
+
* Platform-native dependency checks (e.g. `secret-tool`, `security`,
|
|
825
|
+
* `powershell`) are demoted from required to optional when the
|
|
826
|
+
* corresponding backend is not enabled. Plugin tool checks (`op`,
|
|
827
|
+
* `ykman`) are promoted from optional to required when their backend
|
|
828
|
+
* (`1password`, `yubikey`) is explicitly enabled.
|
|
829
|
+
*
|
|
830
|
+
* When omitted, all platform-default checks are treated as required
|
|
831
|
+
* (backward-compatible behavior).
|
|
832
|
+
*/
|
|
833
|
+
backends?: BackendConfig[];
|
|
816
834
|
}
|
|
817
835
|
/**
|
|
818
836
|
* Run all platform-appropriate preflight checks and aggregate the results.
|
package/dist/index.js
CHANGED
|
@@ -2261,7 +2261,8 @@ async function runDoctor(options) {
|
|
|
2261
2261
|
nextSteps: ["Unsupported platform. vaultkeeper supports macOS, Linux, and Windows."]
|
|
2262
2262
|
};
|
|
2263
2263
|
}
|
|
2264
|
-
const
|
|
2264
|
+
const enabledTypes = enabledBackendTypes(options?.backends);
|
|
2265
|
+
const entries = buildCheckList(platform, enabledTypes);
|
|
2265
2266
|
const resolved = await Promise.all(
|
|
2266
2267
|
entries.map(async ({ check, required }) => {
|
|
2267
2268
|
const result = await check();
|
|
@@ -2295,19 +2296,42 @@ async function runDoctor(options) {
|
|
|
2295
2296
|
const checks = resolved.map(({ result }) => result);
|
|
2296
2297
|
return { checks, ready, warnings, nextSteps };
|
|
2297
2298
|
}
|
|
2298
|
-
function
|
|
2299
|
+
function enabledBackendTypes(backends) {
|
|
2300
|
+
if (backends === void 0) return null;
|
|
2301
|
+
const types = /* @__PURE__ */ new Set();
|
|
2302
|
+
for (const b of backends) {
|
|
2303
|
+
if (b.enabled) types.add(b.type);
|
|
2304
|
+
}
|
|
2305
|
+
return types;
|
|
2306
|
+
}
|
|
2307
|
+
function buildCheckList(platform, enabledTypes) {
|
|
2299
2308
|
const entries = [{ check: checkOpenssl, required: true }];
|
|
2300
2309
|
if (platform === "darwin") {
|
|
2301
|
-
entries.push({
|
|
2310
|
+
entries.push({
|
|
2311
|
+
check: checkSecurity,
|
|
2312
|
+
required: enabledTypes === null || enabledTypes.has("keychain")
|
|
2313
|
+
});
|
|
2302
2314
|
entries.push({ check: checkBash, required: false });
|
|
2303
2315
|
} else if (platform === "win32") {
|
|
2304
|
-
entries.push({
|
|
2316
|
+
entries.push({
|
|
2317
|
+
check: checkPowershell,
|
|
2318
|
+
required: enabledTypes === null || enabledTypes.has("dpapi")
|
|
2319
|
+
});
|
|
2305
2320
|
} else {
|
|
2306
2321
|
entries.push({ check: checkBash, required: true });
|
|
2307
|
-
entries.push({
|
|
2322
|
+
entries.push({
|
|
2323
|
+
check: checkSecretTool,
|
|
2324
|
+
required: enabledTypes === null || enabledTypes.has("secret-tool")
|
|
2325
|
+
});
|
|
2308
2326
|
}
|
|
2309
|
-
entries.push({
|
|
2310
|
-
|
|
2327
|
+
entries.push({
|
|
2328
|
+
check: checkOp,
|
|
2329
|
+
required: enabledTypes?.has("1password") ?? false
|
|
2330
|
+
});
|
|
2331
|
+
entries.push({
|
|
2332
|
+
check: checkYkman,
|
|
2333
|
+
required: enabledTypes?.has("yubikey") ?? false
|
|
2334
|
+
});
|
|
2311
2335
|
return entries;
|
|
2312
2336
|
}
|
|
2313
2337
|
|
|
@@ -2329,23 +2353,29 @@ var VaultKeeper = class _VaultKeeper {
|
|
|
2329
2353
|
* Runs doctor checks (unless skipped), loads config, and sets up the key manager.
|
|
2330
2354
|
*/
|
|
2331
2355
|
static async init(options) {
|
|
2356
|
+
const configDir = options?.configDir ?? getDefaultConfigDir();
|
|
2357
|
+
const config = options?.config ?? await loadConfig(configDir);
|
|
2332
2358
|
if (options?.skipDoctor !== true) {
|
|
2333
|
-
const doctorResult = await runDoctor();
|
|
2359
|
+
const doctorResult = await runDoctor({ backends: config.backends });
|
|
2334
2360
|
if (!doctorResult.ready) {
|
|
2335
2361
|
throw new VaultError(
|
|
2336
2362
|
`System not ready: ${doctorResult.nextSteps.join("; ")}`
|
|
2337
2363
|
);
|
|
2338
2364
|
}
|
|
2339
2365
|
}
|
|
2340
|
-
const configDir = options?.configDir ?? getDefaultConfigDir();
|
|
2341
|
-
const config = options?.config ?? await loadConfig(configDir);
|
|
2342
2366
|
const keyManager = new KeyManager();
|
|
2343
2367
|
await keyManager.init();
|
|
2344
2368
|
const vault = new _VaultKeeper(config, keyManager, configDir);
|
|
2345
2369
|
vault.#backend = vault.#resolveBackend();
|
|
2346
2370
|
return vault;
|
|
2347
2371
|
}
|
|
2348
|
-
/**
|
|
2372
|
+
/**
|
|
2373
|
+
* Run doctor checks without full initialization.
|
|
2374
|
+
*
|
|
2375
|
+
* Uses conservative platform defaults — all platform-native dependency
|
|
2376
|
+
* checks are treated as required regardless of any backend configuration.
|
|
2377
|
+
* For config-aware scoping, call `runDoctor({ backends })` directly.
|
|
2378
|
+
*/
|
|
2349
2379
|
static async doctor() {
|
|
2350
2380
|
return runDoctor();
|
|
2351
2381
|
}
|