Registry / auth-security / vvauth

vvauth

JSON →
library2.0.2jsnpmunverified

Vault Auth helper for authenticating to HashiCorp Vault using JWT or SSH agent methods. Version 2.0.2 provides token retrieval and environment variable management via a YAML config file (.vauthrc) with macro expansion for profiles, environment variables, and remote secrets. Differentiators include SSH agent login, dynamic secret resolution, and multi-profile support. Release cadence is irregular; primarily maintained by a single developer.

npm install vvauth
INSTALL
IMPORT
SIG · VVAUTH
V
vvauth
auth-securityjavascriptv2.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import vvauth from 'vvauth'
const vvauth = require('vvauth')
vvauth is ESM-only; CommonJS require will fail.
loginJWT
import { loginJWT } from 'vvauth'
const { loginJWT } = require('vvauth')
Named export for JWT authentication. Requires ESM.
loginSSH
import { loginSSH } from 'vvauth'
import loginSSH from 'vvauth'
loginSSH is a named export, not default.

Demonstrates JWT and SSH agent authentication, returning VAULT_TOKEN. Reads config from .vauthrc file or environment.

import { loginJWT, loginSSH } from 'vvauth'; import { promises as fs } from 'fs'; async function main() { // JWT login: provide role and JWT token const vaultToken = await loginJWT('my-jwt-role', 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...'); console.log('VAULT_TOKEN:', vaultToken); // SSH login: uses SSH agent, role from env or config try { const sshToken = await loginSSH(); console.log('SSH login token:', sshToken); } catch (err) { console.error('SSH login failed:', err.message); } } main().catch(console.error);
Debug
Known issues
gotchaESM-only package. Requiring via require('vvauth') will throw ERR_REQUIRE_ESM.
fix
Convert to ES module (type: module in package.json) or use dynamic import: const vvauth = await import('vvauth').
affects: >=2.0.0
gotcha.vauthrc file must be YAML, not JSON. Parsing a JSON file may silently fail.
fix
Use YAML format for configuration file.
affects: <=2.0.2
gotchaMacro expansion in .vauthrc uses string replacement; escaping special characters in values can break expansion.
fix
Avoid using ${} or $$ in values; use raw strings or escape them properly.
affects: <=2.0.2
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using CommonJS require() to load vvauth, which is ESM-only.
fix
Change to import statement: import vvauth from 'vvauth'; and ensure your package is type: module.
Error: VAULT_TOKEN not found in response
JWT or SSH login request succeeded but Vault did not return a token, possibly due to misconfigured role or auth backend.
fix
Check Vault auth mount path and role configuration. Ensure the JWT token or SSH certificate are valid.
Error: Cannot find module 'node-vault'
Missing peer dependency node-vault, which is required by vvauth.
fix
Install node-vault: npm install node-vault
Error: ENOENT: no such file or directory, open '.vauthrc'
vvauth cannot find a configuration file. It looks for .vauthrc in current directory or home.
fix
Create a .vauthrc file with required vault_addr and auth method settings, or set the VAUTHRC environment variable to point to your config file.
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
node-vaultrequiredVault client library for HTTP API calls
Agent activity
29 hits · last 30 days
node
23
OpenAI (training)
1
Resources
vvauth — npm install vvauth · libregistry