{"id":27534,"library":"vvauth","title":"vvauth","description":"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.","status":"active","version":"2.0.2","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/131/vvauth","tags":["javascript"],"install":[{"cmd":"npm install vvauth","lang":"bash","label":"npm"},{"cmd":"yarn add vvauth","lang":"bash","label":"yarn"},{"cmd":"pnpm add vvauth","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Vault client library for HTTP API calls","package":"node-vault","optional":false}],"imports":[{"note":"vvauth is ESM-only; CommonJS require will fail.","wrong":"const vvauth = require('vvauth')","symbol":"default","correct":"import vvauth from 'vvauth'"},{"note":"Named export for JWT authentication. Requires ESM.","wrong":"const { loginJWT } = require('vvauth')","symbol":"loginJWT","correct":"import { loginJWT } from 'vvauth'"},{"note":"loginSSH is a named export, not default.","wrong":"import loginSSH from 'vvauth'","symbol":"loginSSH","correct":"import { loginSSH } from 'vvauth'"}],"quickstart":{"code":"import { loginJWT, loginSSH } from 'vvauth';\nimport { promises as fs } from 'fs';\n\nasync function main() {\n  // JWT login: provide role and JWT token\n  const vaultToken = await loginJWT('my-jwt-role', 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...');\n  console.log('VAULT_TOKEN:', vaultToken);\n\n  // SSH login: uses SSH agent, role from env or config\n  try {\n    const sshToken = await loginSSH();\n    console.log('SSH login token:', sshToken);\n  } catch (err) {\n    console.error('SSH login failed:', err.message);\n  }\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Demonstrates JWT and SSH agent authentication, returning VAULT_TOKEN. Reads config from .vauthrc file or environment."},"warnings":[{"fix":"Convert to ES module (type: module in package.json) or use dynamic import: const vvauth = await import('vvauth').","message":"ESM-only package. Requiring via require('vvauth') will throw ERR_REQUIRE_ESM.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use YAML format for configuration file.","message":".vauthrc file must be YAML, not JSON. Parsing a JSON file may silently fail.","severity":"gotcha","affected_versions":"<=2.0.2"},{"fix":"Avoid using ${} or $$ in values; use raw strings or escape them properly.","message":"Macro expansion in .vauthrc uses string replacement; escaping special characters in values can break expansion.","severity":"gotcha","affected_versions":"<=2.0.2"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change to import statement: import vvauth from 'vvauth'; and ensure your package is type: module.","cause":"Using CommonJS require() to load vvauth, which is ESM-only.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Check Vault auth mount path and role configuration. Ensure the JWT token or SSH certificate are valid.","cause":"JWT or SSH login request succeeded but Vault did not return a token, possibly due to misconfigured role or auth backend.","error":"Error: VAULT_TOKEN not found in response"},{"fix":"Install node-vault: npm install node-vault","cause":"Missing peer dependency node-vault, which is required by vvauth.","error":"Error: Cannot find module 'node-vault'"},{"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.","cause":"vvauth cannot find a configuration file. It looks for .vauthrc in current directory or home.","error":"Error: ENOENT: no such file or directory, open '.vauthrc'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}