Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@litehex/node-vault

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@litehex/node-vault

Client for HashiCorp's Vault

  • 0.1.0-alpha.2
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-19.12%
Maintainers
1
Weekly downloads
 
Created
Source

node-vault

A Javascript client for the HTTP API of HashiCorp's vault with a focus on ease of use.

npm install @litehex/node-vault

Usage

Init and unseal vault
import { Client } from '@litehex/node-vault';

// Get a new instance of the client
const vc = new Client({
  apiVersion: 'v1', // default
  endpoint: 'http://127.0.0.1:8200', // default
  token: 'hv.xxxxxxxxxxxxxxxxxxxxx' // Optional unless you want to initialize the vault
});

// Init vault
vc.init({ secret_shares: 1, secret_threshold: 1 }).then((res) => {
  const { keys, root_token } = res;
  vc.token = root_token;
  // Unseal vault
  vc.unseal({ secret_shares: 1, key: keys[0] });
});
Write, read and delete secrets
vc.write({ path: 'secret/hello', data: { foo: 'bar' } }).then(() => {
  vc.read({ path: 'secret/hello' }).then(({ data }) => {
    console.log(data); // { value: 'world' }
  });
});

vc.delete({ path: 'secret/hello' });

Docs

  • HashCorp's Vault API docs

Examples

Using a proxy or having the ability to modify the outgoing request.
import { Client } from '@litehex/node-vault';
import { ProxyAgent } from 'undici';

const agent = new ProxyAgent('http://localhost:8080');

const vc = new Client({
  // ... other params
  request: {
    agent: agent,
    headers: {
      'X-Custom-Header': 'value'
    }
  }
});

License

This project is licensed under the GPLv3 License - see the LICENSE file for details

Keywords

FAQs

Package last updated on 24 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc