TypeScript Vault Client

nanvc

A focused guide to working with the Vault API through nanvc, from your first request to typed v2 workflows and contributor docs.

import { VaultClientV2 } from 'nanvc';
// ...
const vault = new VaultClientV2();
// Authenticate using the RoleID and SecretID to retrieve a Vault 
// token. Assuming here that roleId and secretId are already defined,
// e.g. derived from environment variables or other strategies.
await vault.auth.loginWithAppRole({
  role_id: roleId,
  secret_id: secretId,
}).unwrap();
// Read a secret from Vault using the authenticated client token
const secret = await vault.read('secret/mysql/webapp').unwrap();

nanvc

nanvc is a small TypeScript client for the HashiCorp Vault HTTP API.

This documentation is organized around the two client styles currently exposed by the package:

  • VaultClient: the original command-spec based client
  • VaultClientV2: the newer typed client built on top of RawVaultClient

API v1 and API v2 in this documentation refer to the two nanvc client generations, not to Vault’s HTTP API version. Vault API versioning is configured separately through options like apiVersion: 'v1'.

What This Documentation Covers

Use this site if you want to:

  • install and configure nanvc
  • choose between the v1 and v2 APIs
  • understand how responses and errors are represented
  • run the test suite locally
  • contribute code or documentation

Current Scope

The library intentionally covers a focused subset of the Vault API, mainly:

  • secret CRUD operations
  • initialization and seal management
  • mounts/remounts
  • auth backends
  • policies
  • audits

It does not aim to expose the full Vault API surface yet.

secret.kv.v2 covers the common KV v2 read/write/list/delete workflow, but it is not a complete implementation of every KV v2 operation from the Vault OpenAPI specification. Use RawVaultClient for unsupported KV v2 endpoints.