vaultkeeper 0.7.1 → 0.8.0

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.d.cts CHANGED
@@ -527,6 +527,34 @@ declare class FilesystemError extends VaultError {
527
527
  declare class RotationInProgressError extends VaultError {
528
528
  constructor(message: string);
529
529
  }
530
+ /**
531
+ * Thrown when a test-only double — a class built purely to fabricate a
532
+ * vaultkeeper-internal signal (e.g. a granted presence check, an unlocked
533
+ * backend) for driving negative test cases — refuses to construct because it
534
+ * detected it is running outside a test environment.
535
+ *
536
+ * @remarks
537
+ * A fabricated signal is, by construction, exactly the thing a real
538
+ * deployment must never be able to forge. A loud, typed refusal at
539
+ * construction time is the last of several stacked guards keeping such a
540
+ * double unreachable from production — see, for example,
541
+ * `PresenceSimulatorBackend` in `@vaultkeeper/test-helpers`. Inspect
542
+ * {@link TestDoubleMisuseError.doubleName} for which class refused to
543
+ * construct and {@link TestDoubleMisuseError.detectedEnvironment} for the
544
+ * environment value that triggered the refusal.
545
+ *
546
+ * @public
547
+ */
548
+ declare class TestDoubleMisuseError extends VaultError {
549
+ /** The name of the test double class that refused to construct. */
550
+ readonly doubleName: string;
551
+ /**
552
+ * The environment value (e.g. `process.env.NODE_ENV`) that triggered the
553
+ * refusal.
554
+ */
555
+ readonly detectedEnvironment: string;
556
+ constructor(message: string, doubleName: string, detectedEnvironment: string);
557
+ }
530
558
 
531
559
  /**
532
560
  * Shared types and interfaces for vaultkeeper.
@@ -2128,4 +2156,4 @@ declare function platformNativeBackendType(): string;
2128
2156
  */
2129
2157
  declare function loadConfig(configDir?: string): Promise<VaultConfig>;
2130
2158
 
2131
- export { AccessorConsumedError, AuthorizationDeniedError, type BackendCapabilities, type BackendConfig, type BackendFactory, BackendLockedError, BackendRegistry, type BackendSetupFactory, BackendUnavailableError, CapabilityToken, ConfigParseError, ConfigValidationError, DecryptionError, DeviceNotPresentError, ExecError, type ExecRequest, type ExecResult, ExecutableTrustRequiredError, type ExecutableTrustStatus, FetchError, type FetchRequest, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, InvalidKeyMaterialError, InvalidTokenError, KeyRevokedError, KeyRotatedError, type KeyStatus, type ListableBackend, NotCapableError, type Platform, PluginNotFoundError, type PreflightCheck, type PreflightCheckError, type PreflightCheckErrorKind, type PreflightCheckStatus, type PreflightResult, type PresenceCapableBackend, PresenceDeclinedError, type PresenceOperation, type PresenceRequirementOptions, PresenceTimeoutError, REDACTED, RotationInProgressError, type RunDoctorOptions, type ScopedPreflightCheck, type SecretAccessor, type SecretBackend, SecretNotFoundError, type SecretTokenMap, type SetupChoice, SetupError, type SetupOptions, type SetupOptionsBase, type SetupQuestion, type SetupResult, type SignRequest, type SignResult, type SigningAlgorithm, type SigningBackend, SigningKeyAlreadyExistsError, SigningKeyNotFoundError, SigningNotSupportedError, type SigningPublicKey, TokenExpiredError, TokenRevokedError, type TrustTier, UnknownBackendTypeError, UsageLimitExceededError, type VaultConfig, VaultError, VaultKeeper, type VaultKeeperOptions, type VaultResponse, type VerifyRequest, defaultBackendType, getBackendCapabilities, getDefaultConfigDir, getPlatformDefaultConfigDir, isListableBackend, isPresenceCapableBackend, isSigningBackend, loadConfig, platformNativeBackendType, redactSecrets, runDoctor };
2159
+ export { AccessorConsumedError, AuthorizationDeniedError, type BackendCapabilities, type BackendConfig, type BackendFactory, BackendLockedError, BackendRegistry, type BackendSetupFactory, BackendUnavailableError, CapabilityToken, ConfigParseError, ConfigValidationError, DecryptionError, DeviceNotPresentError, ExecError, type ExecRequest, type ExecResult, ExecutableTrustRequiredError, type ExecutableTrustStatus, FetchError, type FetchRequest, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, InvalidKeyMaterialError, InvalidTokenError, KeyRevokedError, KeyRotatedError, type KeyStatus, type ListableBackend, NotCapableError, type Platform, PluginNotFoundError, type PreflightCheck, type PreflightCheckError, type PreflightCheckErrorKind, type PreflightCheckStatus, type PreflightResult, type PresenceCapableBackend, PresenceDeclinedError, type PresenceOperation, type PresenceRequirementOptions, PresenceTimeoutError, REDACTED, RotationInProgressError, type RunDoctorOptions, type ScopedPreflightCheck, type SecretAccessor, type SecretBackend, SecretNotFoundError, type SecretTokenMap, type SetupChoice, SetupError, type SetupOptions, type SetupOptionsBase, type SetupQuestion, type SetupResult, type SignRequest, type SignResult, type SigningAlgorithm, type SigningBackend, SigningKeyAlreadyExistsError, SigningKeyNotFoundError, SigningNotSupportedError, type SigningPublicKey, TestDoubleMisuseError, TokenExpiredError, TokenRevokedError, type TrustTier, UnknownBackendTypeError, UsageLimitExceededError, type VaultConfig, VaultError, VaultKeeper, type VaultKeeperOptions, type VaultResponse, type VerifyRequest, defaultBackendType, getBackendCapabilities, getDefaultConfigDir, getPlatformDefaultConfigDir, isListableBackend, isPresenceCapableBackend, isSigningBackend, loadConfig, platformNativeBackendType, redactSecrets, runDoctor };
package/dist/index.d.ts CHANGED
@@ -527,6 +527,34 @@ declare class FilesystemError extends VaultError {
527
527
  declare class RotationInProgressError extends VaultError {
528
528
  constructor(message: string);
529
529
  }
530
+ /**
531
+ * Thrown when a test-only double — a class built purely to fabricate a
532
+ * vaultkeeper-internal signal (e.g. a granted presence check, an unlocked
533
+ * backend) for driving negative test cases — refuses to construct because it
534
+ * detected it is running outside a test environment.
535
+ *
536
+ * @remarks
537
+ * A fabricated signal is, by construction, exactly the thing a real
538
+ * deployment must never be able to forge. A loud, typed refusal at
539
+ * construction time is the last of several stacked guards keeping such a
540
+ * double unreachable from production — see, for example,
541
+ * `PresenceSimulatorBackend` in `@vaultkeeper/test-helpers`. Inspect
542
+ * {@link TestDoubleMisuseError.doubleName} for which class refused to
543
+ * construct and {@link TestDoubleMisuseError.detectedEnvironment} for the
544
+ * environment value that triggered the refusal.
545
+ *
546
+ * @public
547
+ */
548
+ declare class TestDoubleMisuseError extends VaultError {
549
+ /** The name of the test double class that refused to construct. */
550
+ readonly doubleName: string;
551
+ /**
552
+ * The environment value (e.g. `process.env.NODE_ENV`) that triggered the
553
+ * refusal.
554
+ */
555
+ readonly detectedEnvironment: string;
556
+ constructor(message: string, doubleName: string, detectedEnvironment: string);
557
+ }
530
558
 
531
559
  /**
532
560
  * Shared types and interfaces for vaultkeeper.
@@ -2128,4 +2156,4 @@ declare function platformNativeBackendType(): string;
2128
2156
  */
2129
2157
  declare function loadConfig(configDir?: string): Promise<VaultConfig>;
2130
2158
 
2131
- export { AccessorConsumedError, AuthorizationDeniedError, type BackendCapabilities, type BackendConfig, type BackendFactory, BackendLockedError, BackendRegistry, type BackendSetupFactory, BackendUnavailableError, CapabilityToken, ConfigParseError, ConfigValidationError, DecryptionError, DeviceNotPresentError, ExecError, type ExecRequest, type ExecResult, ExecutableTrustRequiredError, type ExecutableTrustStatus, FetchError, type FetchRequest, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, InvalidKeyMaterialError, InvalidTokenError, KeyRevokedError, KeyRotatedError, type KeyStatus, type ListableBackend, NotCapableError, type Platform, PluginNotFoundError, type PreflightCheck, type PreflightCheckError, type PreflightCheckErrorKind, type PreflightCheckStatus, type PreflightResult, type PresenceCapableBackend, PresenceDeclinedError, type PresenceOperation, type PresenceRequirementOptions, PresenceTimeoutError, REDACTED, RotationInProgressError, type RunDoctorOptions, type ScopedPreflightCheck, type SecretAccessor, type SecretBackend, SecretNotFoundError, type SecretTokenMap, type SetupChoice, SetupError, type SetupOptions, type SetupOptionsBase, type SetupQuestion, type SetupResult, type SignRequest, type SignResult, type SigningAlgorithm, type SigningBackend, SigningKeyAlreadyExistsError, SigningKeyNotFoundError, SigningNotSupportedError, type SigningPublicKey, TokenExpiredError, TokenRevokedError, type TrustTier, UnknownBackendTypeError, UsageLimitExceededError, type VaultConfig, VaultError, VaultKeeper, type VaultKeeperOptions, type VaultResponse, type VerifyRequest, defaultBackendType, getBackendCapabilities, getDefaultConfigDir, getPlatformDefaultConfigDir, isListableBackend, isPresenceCapableBackend, isSigningBackend, loadConfig, platformNativeBackendType, redactSecrets, runDoctor };
2159
+ export { AccessorConsumedError, AuthorizationDeniedError, type BackendCapabilities, type BackendConfig, type BackendFactory, BackendLockedError, BackendRegistry, type BackendSetupFactory, BackendUnavailableError, CapabilityToken, ConfigParseError, ConfigValidationError, DecryptionError, DeviceNotPresentError, ExecError, type ExecRequest, type ExecResult, ExecutableTrustRequiredError, type ExecutableTrustStatus, FetchError, type FetchRequest, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, InvalidKeyMaterialError, InvalidTokenError, KeyRevokedError, KeyRotatedError, type KeyStatus, type ListableBackend, NotCapableError, type Platform, PluginNotFoundError, type PreflightCheck, type PreflightCheckError, type PreflightCheckErrorKind, type PreflightCheckStatus, type PreflightResult, type PresenceCapableBackend, PresenceDeclinedError, type PresenceOperation, type PresenceRequirementOptions, PresenceTimeoutError, REDACTED, RotationInProgressError, type RunDoctorOptions, type ScopedPreflightCheck, type SecretAccessor, type SecretBackend, SecretNotFoundError, type SecretTokenMap, type SetupChoice, SetupError, type SetupOptions, type SetupOptionsBase, type SetupQuestion, type SetupResult, type SignRequest, type SignResult, type SigningAlgorithm, type SigningBackend, SigningKeyAlreadyExistsError, SigningKeyNotFoundError, SigningNotSupportedError, type SigningPublicKey, TestDoubleMisuseError, TokenExpiredError, TokenRevokedError, type TrustTier, UnknownBackendTypeError, UsageLimitExceededError, type VaultConfig, VaultError, VaultKeeper, type VaultKeeperOptions, type VaultResponse, type VerifyRequest, defaultBackendType, getBackendCapabilities, getDefaultConfigDir, getPlatformDefaultConfigDir, isListableBackend, isPresenceCapableBackend, isSigningBackend, loadConfig, platformNativeBackendType, redactSecrets, runDoctor };
package/dist/index.js CHANGED
@@ -448,6 +448,21 @@ var RotationInProgressError = class extends VaultError {
448
448
  this.name = "RotationInProgressError";
449
449
  }
450
450
  };
451
+ var TestDoubleMisuseError = class extends VaultError {
452
+ /** The name of the test double class that refused to construct. */
453
+ doubleName;
454
+ /**
455
+ * The environment value (e.g. `process.env.NODE_ENV`) that triggered the
456
+ * refusal.
457
+ */
458
+ detectedEnvironment;
459
+ constructor(message, doubleName, detectedEnvironment) {
460
+ super(message);
461
+ this.name = "TestDoubleMisuseError";
462
+ this.doubleName = doubleName;
463
+ this.detectedEnvironment = detectedEnvironment;
464
+ }
465
+ };
451
466
 
452
467
  // src/backend/registry.ts
453
468
  var BackendRegistry = class {
@@ -1435,6 +1450,9 @@ var DpapiBackend = class {
1435
1450
  // src/backend/secret-tool-backend.ts
1436
1451
  var ATTRIBUTE_KEY = "vaultkeeper-id";
1437
1452
  var LABEL_PREFIX = "vaultkeeper: ";
1453
+ function stripSecretToolTrailingNewline(stdout) {
1454
+ return stdout.endsWith("\n") ? stdout.slice(0, -1) : stdout;
1455
+ }
1438
1456
  var SecretToolBackend = class {
1439
1457
  type = "secret-tool";
1440
1458
  displayName = "Linux Secret Service (secret-tool)";
@@ -1451,29 +1469,29 @@ var SecretToolBackend = class {
1451
1469
  }
1452
1470
  async store(id, secret) {
1453
1471
  const label = `${LABEL_PREFIX}${id}`;
1454
- await execCommand("secret-tool", ["store", "--label", label, ATTRIBUTE_KEY, id], {
1472
+ await execCommand("secret-tool", ["store", "--label", label, "--", ATTRIBUTE_KEY, id], {
1455
1473
  stdin: secret
1456
1474
  });
1457
1475
  }
1458
1476
  async retrieve(id) {
1459
- const result = await execCommandFull("secret-tool", ["lookup", ATTRIBUTE_KEY, id]);
1460
- if (result.exitCode !== 0 || result.stdout.trim() === "") {
1477
+ const result = await execCommandFull("secret-tool", ["lookup", "--", ATTRIBUTE_KEY, id]);
1478
+ if (result.exitCode !== 0) {
1461
1479
  throw new SecretNotFoundError(`Secret not found in Secret Service: ${id}`);
1462
1480
  }
1463
- return result.stdout.trim();
1481
+ return stripSecretToolTrailingNewline(result.stdout);
1464
1482
  }
1465
1483
  async delete(id) {
1466
- const result = await execCommandFull("secret-tool", ["clear", ATTRIBUTE_KEY, id]);
1484
+ const result = await execCommandFull("secret-tool", ["clear", "--", ATTRIBUTE_KEY, id]);
1467
1485
  if (result.exitCode !== 0) {
1468
1486
  throw new SecretNotFoundError(`Secret not found in Secret Service: ${id}`);
1469
1487
  }
1470
1488
  }
1471
1489
  async exists(id) {
1472
- const result = await execCommandFull("secret-tool", ["lookup", ATTRIBUTE_KEY, id]);
1473
- return result.exitCode === 0 && result.stdout.trim() !== "";
1490
+ const result = await execCommandFull("secret-tool", ["lookup", "--", ATTRIBUTE_KEY, id]);
1491
+ return result.exitCode === 0;
1474
1492
  }
1475
1493
  async list() {
1476
- const result = await execCommandFull("secret-tool", ["search", ATTRIBUTE_KEY, ""]);
1494
+ const result = await execCommandFull("secret-tool", ["search", "--", ATTRIBUTE_KEY, ""]);
1477
1495
  if (result.exitCode !== 0) {
1478
1496
  return [];
1479
1497
  }
@@ -4660,6 +4678,6 @@ var VaultKeeper = class _VaultKeeper {
4660
4678
  }
4661
4679
  };
4662
4680
 
4663
- export { AccessorConsumedError, AuthorizationDeniedError, BackendLockedError, BackendRegistry, BackendUnavailableError, CapabilityToken, ConfigParseError, ConfigValidationError, DecryptionError, DeviceNotPresentError, ExecError, ExecutableTrustRequiredError, FetchError, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, InvalidKeyMaterialError, InvalidTokenError, KeyRevokedError, KeyRotatedError, NotCapableError, PluginNotFoundError, PresenceDeclinedError, PresenceTimeoutError, REDACTED, RotationInProgressError, SecretNotFoundError, SetupError, SigningKeyAlreadyExistsError, SigningKeyNotFoundError, SigningNotSupportedError, TokenExpiredError, TokenRevokedError, UnknownBackendTypeError, UsageLimitExceededError, VaultError, VaultKeeper, defaultBackendType, getBackendCapabilities, getDefaultConfigDir, getPlatformDefaultConfigDir, isListableBackend, isPresenceCapableBackend, isSigningBackend, loadConfig, platformNativeBackendType, redactSecrets, runDoctor };
4681
+ export { AccessorConsumedError, AuthorizationDeniedError, BackendLockedError, BackendRegistry, BackendUnavailableError, CapabilityToken, ConfigParseError, ConfigValidationError, DecryptionError, DeviceNotPresentError, ExecError, ExecutableTrustRequiredError, FetchError, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, InvalidKeyMaterialError, InvalidTokenError, KeyRevokedError, KeyRotatedError, NotCapableError, PluginNotFoundError, PresenceDeclinedError, PresenceTimeoutError, REDACTED, RotationInProgressError, SecretNotFoundError, SetupError, SigningKeyAlreadyExistsError, SigningKeyNotFoundError, SigningNotSupportedError, TestDoubleMisuseError, TokenExpiredError, TokenRevokedError, UnknownBackendTypeError, UsageLimitExceededError, VaultError, VaultKeeper, defaultBackendType, getBackendCapabilities, getDefaultConfigDir, getPlatformDefaultConfigDir, isListableBackend, isPresenceCapableBackend, isSigningBackend, loadConfig, platformNativeBackendType, redactSecrets, runDoctor };
4664
4682
  //# sourceMappingURL=index.js.map
4665
4683
  //# sourceMappingURL=index.js.map