A node implementation of credstash
npm install node-credstash
npm install node-credstash -g
`As a project dependency:
`
npm install node-credstash --save
`Setup
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
$3
PutTo store a value called
super_secret with a value abc123, we'd do the following:
`
node-credstash put super_secret abc123
`Get
To get the value of
super_secret:
`
node-credstash get super_secret
`Options
You can pass two arguments to both commands:
*
--region Your desired AWS region (this should be the same as your credstash table). Defaults to us-east-1
* --table Your credstash table name. Defaults to credential-store$3
Initialise`javascript
const Credstash = require('node-credstash');
const credstash = new Credstash('us-east-1', 'credential-store');
`
The constructor takes two arguments:
* region Your desired AWS region (this should be the same as your credstash table)
* table Your credstash table namePut
`javascript
credstash.put('super_secret', 'abc123', (err) => {
});
`
The arguments are:
* key The key's name
* value This is the value to be encrypted
* callback A callback functionGet
You can either get one item:
`javascript
credstash.get('super_secret', (err, value) => {
});
`Or multiple:
`javascript
credstash.getAll(['super_secret', 'more_secret'], (err, values) => {
// values.super_secret = abc123
// ...
});
`The arguments are:
*
item(s) Either a string for get or an array of strings for getAll
* callback` Callback function