Accepts a VaultConfig or plain options.
ReadonlyauthLogins, token self-service and token renewal.
ReadonlyconfigThe immutable configuration.
ReadonlyleasesLease renew/revoke/lookup and automatic lease renewal.
ReadonlysysSystem backend (health, seal status, policies, mounts, auth methods, AppRole admin).
ReadonlywrappingResponse wrapping.
Whether close was called.
The namespace sent as X-Vault-Namespace, or undefined for the root namespace.
Stops token renewers, managed leases and secret watchers, then releases connections. Idempotent.
Unauthenticated health: GET /v1/sys/health (answers 200 in every node state). healthy
is true only for an active, unsealed node; status is active, standby,
perfstandby, sealed or uninitialized (unreachable on any error). details holds
version, initialized, sealed, standby and clusterName (when set); on errors
error (and httpStatus). Never throws except for CANCELLED and CONFIG.
KV mount with auto-detected version (default mount config.kvMount). The same instance is
returned for the same mount.
Authenticated round trip (GET /v1/auth/token/lookup-self, allowed for every valid
token). Returns the latency in ms; a missing, invalid or revoked token raises
AuthenticationError.
Calls any Vault API path (/v1/<path>) with the client token, namespace, retries and
error mapping. Use it for endpoints this SDK has no method for.
SecretsProvider over a KV mount (default config.kvMount). client.close() stops
its watchers.
Server version from sys/health (e.g. 2.2.2).
Replaces the client token (undefined removes it). A withNamespace view starts with
its parent's token but owns it afterwards: the change affects only this client.
A client view that sends X-Vault-Namespace: <namespace> on every request (an empty string
selects the root namespace: no header). The view shares the connection pool and starts with
this client's current token; after that, logins and token changes of the view and of this
client are independent. Surrounding whitespace and slashes are removed; a namespace that
still contains whitespace throws ConfigError. Closing the view stops only its own renewers,
leases and watchers; closing this client also closes its views.
Vault Enterprise only. Vault OSS ignores the header and serves the root namespace, so a wrong namespace is not detected there.
const team = client.withNamespace("team-a");
await team.kv().read("app/db"); // X-Vault-Namespace: team-a
StaticfromBuilds a client from GROW_HASHICORP_VAULT_* and VAULT_* environment variables.
Client for HashiCorp Vault.