nodecg-vault
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

nodecg-vault

Add vaults to NodeCG for storing bundle secrets

This module is built on top of conf, providing a way to store bundle secrets without having to worry about security concerns.

Install

$ npm install nodecg-vault

Usage

You can create a vault by simply constructing a new Vault instance.

const Vault = require('nodecg-vault');

export = nodecg => {
  const vault = new Vault(nodecg);

  // Writes a new secret
  vault.set('mySecret', 'Spark is the best!');

  // Reads the secret
  console.log(vault.get('mySecret'));

  // Deletes the secret
  vault.delete('mySecret');
};

You can also use the withVault helper function to wrap the extension entrypoint and automatically return the associated vault in addition to the NodeCG instance.

const {withVault} = require('nodecg-vault');

const options = {
  defaults: {
    mySecret: 'Spark is the best!'
  }
};

export = withVault(options, (nodecg, vault) => {
  console.log(vault.get('mySecret'));
});

Author

Alexandre Breteau - @0xSeldszar

License

MIT © Alexandre Breteau

/nodecg-vault/

    Package Sidebar

    Install

    npm i nodecg-vault

    Weekly Downloads

    1

    Version

    1.3.1

    License

    MIT

    Unpacked Size

    4.71 kB

    Total Files

    5

    Last publish

    Collaborators

    • seldszar