1.2.2 • Published 9 years ago
node-credstash v1.2.2
node-credstash
Node.js port of credstash
Installation
As a command line tool:
npm install node-credstash -gAs a project dependency:
npm install node-credstash --saveSetup
Setup of the credtash table is on it's way, but for now we recommend using credstash, or building the table yourself.
Make sure you have some AWS credentials set up on your machine. There are a number of ways to do this, listed here.
Usage
Command line tool
Put
To store a value called super_secret with a value abc123, we'd do the following:
node-credstash put super_secret abc123Get
To get the value of super_secret:
node-credstash get super_secretOptions
You can pass two arguments to both commands:
--regionYour desired AWS region (this should be the same as your credstash table). Defaults tous-east-1--tableYour credstash table name. Defaults tocredential-store
Node.js Module
Initialise
const Credstash = require('node-credstash');
const credstash = new Credstash('us-east-1', 'credential-store');The constructor takes two arguments:
regionYour desired AWS region (this should be the same as your credstash table)tableYour credstash table name
Put
credstash.put('super_secret', 'abc123', (err) => {
});The arguments are:
keyThe key's namevalueThis is the value to be encryptedcallbackA callback function
Get
You can either get one item:
credstash.get('super_secret', (err, value) => {
});Or multiple:
credstash.getAll(['super_secret', 'more_secret'], (err, values) => {
// values.super_secret = abc123
// ...
});The arguments are:
item(s)Either a string forgetor an array of strings forgetAllcallbackCallback function