Module for reading credstash secrets
npm install credstashNode.js module for reading credstash secrets without needing snakes
``js
const Credstash = require('credstash');
const credstash = new Credstash();
// .get method for one key (table query)
credstash.get('secret', (e, secret) => {
console.log('do not share the secret', secret);
});
// .list method for multiple keys (table scan)
credstash.list((e, secrets) => {
console.log('do not share the secrets', secrets);
});
`
`bash`
$ npm install credstash
By default node-credstash will return the latest (most recent version of a secret).
You can also retrieve the latest N versions of a secret as follows:
`js
const Credstash = require('credstash');
const credstash = new Credstash();
credstash.get('secret', {limit: 3}, (e, secrets) => {
console.log('this is the last version', secrets[0]);
console.log('this is the second-last', secrets[1]);
console.log('this is the third-last', secrets[2]);
});
``