@secretary/core
TypeScript icon, indicating that this package has built-in type declarations

4.2.1 • Public • Published

Secretary - NodeJS Secrets Management

Build Status codecov


Secretary (etymology: Keeper of secrets) provides an abstract way to manage secrets.

Currently supports the following adapters:

Installation

// If you want to use AWS Secrets Manager
$ npm install @secretary/core @secretary/aws-secrets-manager-adapter

// If you want to use Hashicorp Vault
$ npm install @secretary/core @secretary/hashicorp-vault-adapter

Check the install docs of the adapter you want to use for specific instructions.

Usage

import {Manager} from '@secretary/core';
import {Adapter} from '@secretary/aws-secrets-manager-adapter';
import {SecretsManager} from 'aws-sdk';

const manager = new Manager({
    aws: new Adapter({client: new SecretsManager()})
});

Fetch Secrets

const someSecret = await manager.getSecret('some/database/secret', 'aws');
// or, aws as the first (and only) adapter in the manager, `default` is another key that works,
// which is what source getSecret defaults to
const someSecret = await manager.getSecret('some/database/secret');

console.log(someSecret.value.dsn); // redis://localhost:6379

Create Secrets

const secret = new Secret('some/database/secret', {dsn: 'redis://localhost:6379'});
await manager.putSecret(secret, 'aws');

console.log(someSecret.value.dsn); // redis://localhost:6379

Delete Secrets

const secret = await manager.getSecret('some/database/secret');

await manager.deleteSecret(secret, 'aws');

Check the usage docs of the adapter you want to use for specific instructions.

Readme

Keywords

none

Package Sidebar

Install

npm i @secretary/core

Weekly Downloads

167

Version

4.2.1

License

MIT

Unpacked Size

43.4 kB

Total Files

86

Last publish

Collaborators

  • aequasi