vaultkeeper 0.5.2 → 0.6.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
@@ -134,9 +134,43 @@ declare class IdentityMismatchError extends VaultError {
134
134
  readonly currentHash: string;
135
135
  constructor(message: string, previousHash: string, currentHash: string);
136
136
  }
137
+ /**
138
+ * Thrown when a delegated `exec()` call fails due to a process-level error
139
+ * (e.g. the command binary is not found or cannot be spawned).
140
+ *
141
+ * @public
142
+ */
143
+ declare class ExecError extends VaultError {
144
+ /**
145
+ * The command that failed to execute.
146
+ */
147
+ readonly command: string;
148
+ constructor(message: string, command: string);
149
+ }
150
+ /**
151
+ * Thrown when a JWE string cannot be parsed because it is structurally
152
+ * malformed (e.g. wrong number of segments, invalid Base64URL header,
153
+ * or unparseable JSON header).
154
+ *
155
+ * @public
156
+ */
157
+ declare class InvalidTokenError extends VaultError {
158
+ constructor(message: string);
159
+ }
160
+ /**
161
+ * Thrown when `SecretAccessor.read()` is called after the accessor has
162
+ * already been consumed.
163
+ *
164
+ * @public
165
+ */
166
+ declare class AccessorConsumedError extends VaultError {
167
+ constructor(message: string);
168
+ }
137
169
  /**
138
170
  * Thrown when a caller requests a signing/verification algorithm that is not
139
171
  * in the allowed set (e.g. `'md5'`).
172
+ *
173
+ * @public
140
174
  */
141
175
  declare class InvalidAlgorithmError extends VaultError {
142
176
  /**
@@ -609,6 +643,45 @@ declare class CapabilityToken {
609
643
  toString(): string;
610
644
  }
611
645
 
646
+ /**
647
+ * Platform detection utilities.
648
+ */
649
+ /**
650
+ * The OS platform identifier used for platform-specific behavior.
651
+ * @public
652
+ */
653
+ type Platform = 'darwin' | 'win32' | 'linux';
654
+
655
+ /**
656
+ * Doctor runner: orchestrates platform-appropriate checks and aggregates results.
657
+ */
658
+
659
+ /**
660
+ * Options for running the doctor.
661
+ * @public
662
+ */
663
+ interface RunDoctorOptions {
664
+ /** Override the platform detection (useful for testing). */
665
+ platform?: Platform;
666
+ /**
667
+ * When provided, doctor checks are scoped to the given backends.
668
+ * Platform-native dependency checks (e.g. `secret-tool`, `security`,
669
+ * `powershell`) are demoted from required to optional when the
670
+ * corresponding backend is not enabled. Plugin tool checks (`op`,
671
+ * `ykman`) are promoted from optional to required when their backend
672
+ * (`1password`, `yubikey`) is explicitly enabled.
673
+ *
674
+ * When omitted, all platform-default checks are treated as required
675
+ * (backward-compatible behavior).
676
+ */
677
+ backends?: BackendConfig[];
678
+ }
679
+ /**
680
+ * Run all platform-appropriate preflight checks and aggregate the results.
681
+ * @public
682
+ */
683
+ declare function runDoctor(options?: RunDoctorOptions): Promise<PreflightResult>;
684
+
612
685
  /**
613
686
  * VaultKeeper main class — wires together all vaultkeeper subsystems.
614
687
  */
@@ -647,10 +720,40 @@ declare class VaultKeeper {
647
720
  * Runs doctor checks (unless skipped), loads config, and sets up the key manager.
648
721
  */
649
722
  static init(options?: VaultKeeperOptions): Promise<VaultKeeper>;
650
- /** Run doctor checks without full initialization. */
651
- static doctor(): Promise<PreflightResult>;
652
723
  /**
653
- * Retrieve a secret from the backend and return a JWE token that encapsulates it.
724
+ * Run doctor checks without full initialization.
725
+ *
726
+ * When called without arguments, uses conservative platform defaults —
727
+ * all platform-native dependency checks are treated as required. Pass
728
+ * `{ backends }` to scope checks to only the backends you plan to use.
729
+ *
730
+ * @param options - Optional doctor options (e.g. `{ backends }` to scope checks).
731
+ */
732
+ static doctor(options?: RunDoctorOptions): Promise<PreflightResult>;
733
+ /**
734
+ * Store a secret in the configured backend.
735
+ *
736
+ * This is a convenience method that delegates to the active backend's
737
+ * `store()` method. If a secret with the same name already exists, it is
738
+ * overwritten.
739
+ *
740
+ * @param name - Identifier for the secret.
741
+ * @param value - The secret value to store.
742
+ * @public
743
+ */
744
+ store(name: string, value: string): Promise<void>;
745
+ /**
746
+ * Delete a secret from the configured backend.
747
+ *
748
+ * This is a convenience method that delegates to the active backend's
749
+ * `delete()` method.
750
+ *
751
+ * @param name - Identifier for the secret to delete.
752
+ * @public
753
+ */
754
+ delete(name: string): Promise<void>;
755
+ /**
756
+ * Read a stored secret from the backend and mint a JWE token that encapsulates it.
654
757
  *
655
758
  * @param secretName - Identifier for the secret
656
759
  * @param options - Setup options
@@ -662,11 +765,14 @@ declare class VaultKeeper {
662
765
  * an opaque CapabilityToken.
663
766
  *
664
767
  * @param jwe - Compact JWE string from setup()
665
- * @returns Opaque capability token for use with fetch/exec/getSecret
768
+ * @returns Object containing an opaque {@link CapabilityToken} for use with
769
+ * fetch/exec/getSecret, and a {@link VaultResponse} describing key status.
770
+ * When the JWE was decrypted with a non-current key,
771
+ * `vaultResponse.rotatedJwt` contains a re-encrypted JWE for the current key.
666
772
  */
667
773
  authorize(jwe: string): Promise<{
668
774
  token: CapabilityToken;
669
- response: VaultResponse;
775
+ vaultResponse: VaultResponse;
670
776
  }>;
671
777
  /**
672
778
  * Execute a delegated HTTP fetch, injecting the secret from the token.
@@ -793,31 +899,4 @@ declare class VaultKeeper {
793
899
  setDevelopmentMode(executablePath: string, enabled: boolean): Promise<void>;
794
900
  }
795
901
 
796
- /**
797
- * Platform detection utilities.
798
- */
799
- /**
800
- * The OS platform identifier used for platform-specific behavior.
801
- * @public
802
- */
803
- type Platform = 'darwin' | 'win32' | 'linux';
804
-
805
- /**
806
- * Doctor runner: orchestrates platform-appropriate checks and aggregates results.
807
- */
808
-
809
- /**
810
- * Options for running the doctor.
811
- * @public
812
- */
813
- interface RunDoctorOptions {
814
- /** Override the platform detection (useful for testing). */
815
- platform?: Platform;
816
- }
817
- /**
818
- * Run all platform-appropriate preflight checks and aggregate the results.
819
- * @public
820
- */
821
- declare function runDoctor(options?: RunDoctorOptions): Promise<PreflightResult>;
822
-
823
- export { AuthorizationDeniedError, type BackendConfig, type BackendFactory, BackendLockedError, BackendRegistry, type BackendSetupFactory, BackendUnavailableError, CapabilityToken, DeviceNotPresentError, type ExecRequest, type ExecResult, type FetchRequest, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, KeyRevokedError, KeyRotatedError, type KeyStatus, type ListableBackend, type Platform, PluginNotFoundError, type PreflightCheck, type PreflightCheckStatus, type PreflightResult, RotationInProgressError, type RunDoctorOptions, type SecretAccessor, type SecretBackend, SecretNotFoundError, type SetupChoice, SetupError, type SetupOptions, type SetupQuestion, type SetupResult, type SignRequest, type SignResult, TokenExpiredError, TokenRevokedError, type TrustTier, UsageLimitExceededError, type VaultConfig, VaultError, VaultKeeper, type VaultKeeperOptions, type VaultResponse, type VerifyRequest, isListableBackend, runDoctor };
902
+ export { AccessorConsumedError, AuthorizationDeniedError, type BackendConfig, type BackendFactory, BackendLockedError, BackendRegistry, type BackendSetupFactory, BackendUnavailableError, CapabilityToken, DeviceNotPresentError, ExecError, type ExecRequest, type ExecResult, type FetchRequest, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, InvalidTokenError, KeyRevokedError, KeyRotatedError, type KeyStatus, type ListableBackend, type Platform, PluginNotFoundError, type PreflightCheck, type PreflightCheckStatus, type PreflightResult, RotationInProgressError, type RunDoctorOptions, type SecretAccessor, type SecretBackend, SecretNotFoundError, type SetupChoice, SetupError, type SetupOptions, type SetupQuestion, type SetupResult, type SignRequest, type SignResult, TokenExpiredError, TokenRevokedError, type TrustTier, UsageLimitExceededError, type VaultConfig, VaultError, VaultKeeper, type VaultKeeperOptions, type VaultResponse, type VerifyRequest, isListableBackend, runDoctor };
package/dist/index.d.ts CHANGED
@@ -134,9 +134,43 @@ declare class IdentityMismatchError extends VaultError {
134
134
  readonly currentHash: string;
135
135
  constructor(message: string, previousHash: string, currentHash: string);
136
136
  }
137
+ /**
138
+ * Thrown when a delegated `exec()` call fails due to a process-level error
139
+ * (e.g. the command binary is not found or cannot be spawned).
140
+ *
141
+ * @public
142
+ */
143
+ declare class ExecError extends VaultError {
144
+ /**
145
+ * The command that failed to execute.
146
+ */
147
+ readonly command: string;
148
+ constructor(message: string, command: string);
149
+ }
150
+ /**
151
+ * Thrown when a JWE string cannot be parsed because it is structurally
152
+ * malformed (e.g. wrong number of segments, invalid Base64URL header,
153
+ * or unparseable JSON header).
154
+ *
155
+ * @public
156
+ */
157
+ declare class InvalidTokenError extends VaultError {
158
+ constructor(message: string);
159
+ }
160
+ /**
161
+ * Thrown when `SecretAccessor.read()` is called after the accessor has
162
+ * already been consumed.
163
+ *
164
+ * @public
165
+ */
166
+ declare class AccessorConsumedError extends VaultError {
167
+ constructor(message: string);
168
+ }
137
169
  /**
138
170
  * Thrown when a caller requests a signing/verification algorithm that is not
139
171
  * in the allowed set (e.g. `'md5'`).
172
+ *
173
+ * @public
140
174
  */
141
175
  declare class InvalidAlgorithmError extends VaultError {
142
176
  /**
@@ -609,6 +643,45 @@ declare class CapabilityToken {
609
643
  toString(): string;
610
644
  }
611
645
 
646
+ /**
647
+ * Platform detection utilities.
648
+ */
649
+ /**
650
+ * The OS platform identifier used for platform-specific behavior.
651
+ * @public
652
+ */
653
+ type Platform = 'darwin' | 'win32' | 'linux';
654
+
655
+ /**
656
+ * Doctor runner: orchestrates platform-appropriate checks and aggregates results.
657
+ */
658
+
659
+ /**
660
+ * Options for running the doctor.
661
+ * @public
662
+ */
663
+ interface RunDoctorOptions {
664
+ /** Override the platform detection (useful for testing). */
665
+ platform?: Platform;
666
+ /**
667
+ * When provided, doctor checks are scoped to the given backends.
668
+ * Platform-native dependency checks (e.g. `secret-tool`, `security`,
669
+ * `powershell`) are demoted from required to optional when the
670
+ * corresponding backend is not enabled. Plugin tool checks (`op`,
671
+ * `ykman`) are promoted from optional to required when their backend
672
+ * (`1password`, `yubikey`) is explicitly enabled.
673
+ *
674
+ * When omitted, all platform-default checks are treated as required
675
+ * (backward-compatible behavior).
676
+ */
677
+ backends?: BackendConfig[];
678
+ }
679
+ /**
680
+ * Run all platform-appropriate preflight checks and aggregate the results.
681
+ * @public
682
+ */
683
+ declare function runDoctor(options?: RunDoctorOptions): Promise<PreflightResult>;
684
+
612
685
  /**
613
686
  * VaultKeeper main class — wires together all vaultkeeper subsystems.
614
687
  */
@@ -647,10 +720,40 @@ declare class VaultKeeper {
647
720
  * Runs doctor checks (unless skipped), loads config, and sets up the key manager.
648
721
  */
649
722
  static init(options?: VaultKeeperOptions): Promise<VaultKeeper>;
650
- /** Run doctor checks without full initialization. */
651
- static doctor(): Promise<PreflightResult>;
652
723
  /**
653
- * Retrieve a secret from the backend and return a JWE token that encapsulates it.
724
+ * Run doctor checks without full initialization.
725
+ *
726
+ * When called without arguments, uses conservative platform defaults —
727
+ * all platform-native dependency checks are treated as required. Pass
728
+ * `{ backends }` to scope checks to only the backends you plan to use.
729
+ *
730
+ * @param options - Optional doctor options (e.g. `{ backends }` to scope checks).
731
+ */
732
+ static doctor(options?: RunDoctorOptions): Promise<PreflightResult>;
733
+ /**
734
+ * Store a secret in the configured backend.
735
+ *
736
+ * This is a convenience method that delegates to the active backend's
737
+ * `store()` method. If a secret with the same name already exists, it is
738
+ * overwritten.
739
+ *
740
+ * @param name - Identifier for the secret.
741
+ * @param value - The secret value to store.
742
+ * @public
743
+ */
744
+ store(name: string, value: string): Promise<void>;
745
+ /**
746
+ * Delete a secret from the configured backend.
747
+ *
748
+ * This is a convenience method that delegates to the active backend's
749
+ * `delete()` method.
750
+ *
751
+ * @param name - Identifier for the secret to delete.
752
+ * @public
753
+ */
754
+ delete(name: string): Promise<void>;
755
+ /**
756
+ * Read a stored secret from the backend and mint a JWE token that encapsulates it.
654
757
  *
655
758
  * @param secretName - Identifier for the secret
656
759
  * @param options - Setup options
@@ -662,11 +765,14 @@ declare class VaultKeeper {
662
765
  * an opaque CapabilityToken.
663
766
  *
664
767
  * @param jwe - Compact JWE string from setup()
665
- * @returns Opaque capability token for use with fetch/exec/getSecret
768
+ * @returns Object containing an opaque {@link CapabilityToken} for use with
769
+ * fetch/exec/getSecret, and a {@link VaultResponse} describing key status.
770
+ * When the JWE was decrypted with a non-current key,
771
+ * `vaultResponse.rotatedJwt` contains a re-encrypted JWE for the current key.
666
772
  */
667
773
  authorize(jwe: string): Promise<{
668
774
  token: CapabilityToken;
669
- response: VaultResponse;
775
+ vaultResponse: VaultResponse;
670
776
  }>;
671
777
  /**
672
778
  * Execute a delegated HTTP fetch, injecting the secret from the token.
@@ -793,31 +899,4 @@ declare class VaultKeeper {
793
899
  setDevelopmentMode(executablePath: string, enabled: boolean): Promise<void>;
794
900
  }
795
901
 
796
- /**
797
- * Platform detection utilities.
798
- */
799
- /**
800
- * The OS platform identifier used for platform-specific behavior.
801
- * @public
802
- */
803
- type Platform = 'darwin' | 'win32' | 'linux';
804
-
805
- /**
806
- * Doctor runner: orchestrates platform-appropriate checks and aggregates results.
807
- */
808
-
809
- /**
810
- * Options for running the doctor.
811
- * @public
812
- */
813
- interface RunDoctorOptions {
814
- /** Override the platform detection (useful for testing). */
815
- platform?: Platform;
816
- }
817
- /**
818
- * Run all platform-appropriate preflight checks and aggregate the results.
819
- * @public
820
- */
821
- declare function runDoctor(options?: RunDoctorOptions): Promise<PreflightResult>;
822
-
823
- export { AuthorizationDeniedError, type BackendConfig, type BackendFactory, BackendLockedError, BackendRegistry, type BackendSetupFactory, BackendUnavailableError, CapabilityToken, DeviceNotPresentError, type ExecRequest, type ExecResult, type FetchRequest, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, KeyRevokedError, KeyRotatedError, type KeyStatus, type ListableBackend, type Platform, PluginNotFoundError, type PreflightCheck, type PreflightCheckStatus, type PreflightResult, RotationInProgressError, type RunDoctorOptions, type SecretAccessor, type SecretBackend, SecretNotFoundError, type SetupChoice, SetupError, type SetupOptions, type SetupQuestion, type SetupResult, type SignRequest, type SignResult, TokenExpiredError, TokenRevokedError, type TrustTier, UsageLimitExceededError, type VaultConfig, VaultError, VaultKeeper, type VaultKeeperOptions, type VaultResponse, type VerifyRequest, isListableBackend, runDoctor };
902
+ export { AccessorConsumedError, AuthorizationDeniedError, type BackendConfig, type BackendFactory, BackendLockedError, BackendRegistry, type BackendSetupFactory, BackendUnavailableError, CapabilityToken, DeviceNotPresentError, ExecError, type ExecRequest, type ExecResult, type FetchRequest, FilesystemError, IdentityMismatchError, InvalidAlgorithmError, InvalidTokenError, KeyRevokedError, KeyRotatedError, type KeyStatus, type ListableBackend, type Platform, PluginNotFoundError, type PreflightCheck, type PreflightCheckStatus, type PreflightResult, RotationInProgressError, type RunDoctorOptions, type SecretAccessor, type SecretBackend, SecretNotFoundError, type SetupChoice, SetupError, type SetupOptions, type SetupQuestion, type SetupResult, type SignRequest, type SignResult, TokenExpiredError, TokenRevokedError, type TrustTier, UsageLimitExceededError, type VaultConfig, VaultError, VaultKeeper, type VaultKeeperOptions, type VaultResponse, type VerifyRequest, isListableBackend, runDoctor };