Hashicorp Vault adapter for Secretary

Usage no npm install needed!

<script type="module">
  import secretaryHashicorpVaultAdapter from 'https://cdn.skypack.dev/@secretary/hashicorp-vault-adapter';


Secretary - Hashicorp Vault Adapter

This is the Hashicorp Vault adapter for Secretary


$ npm install @secretary/core @secretary/vault


Creating the manager

import {Adapter, Secretary} from '@secretary/vault';
import * as nodeVault from 'node-vault';

const manager = new Secretary(new Adapter({client: nodeVault()}));

Fetching a secret

const someSecret = await manager.getSecret({path: 'databases/redis', key: 'dsn'});
console.log(someSecret); // redis://localhost:6379

Fetching a secret path

const someSecrets = await manager.getSecrets({path: 'databases/redis'});
console.log(someSecrets); // {dsn: 'redis://localhost:6379', auth: 'foo'}

Create / Update a secret

await manager.putSecret({path: 'databases/redis', key: 'dsn', value: 'redis://localhost:6379'});
await manager.putSecret({path: 'databases/redis', key: 'auth', value: 'foo'});

Create / Update multiple secrets

Note, this fires off a request for every secret that you send.

await manager.putSecrets([
    {path: 'databases/redis', key: 'dsn', value: 'redis://localhost:6379'},
    {path: 'databases/redis', key: 'auth', value: 'foo'},