New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@asymmetrik/yadda-secret

Package Overview
Dependencies
Maintainers
6
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asymmetrik/yadda-secret - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

.npmignore

2

package.json
{
"name": "@asymmetrik/yadda-secret",
"description": "Client secret library",
"version": "0.0.10",
"version": "0.0.11",
"main": "index.js",

@@ -6,0 +6,0 @@ "author": "contributors",

@@ -6,2 +6,3 @@ 'use strict';

const secretGen = require('./secretGen');
const AWS = require('aws-sdk');

@@ -18,15 +19,33 @@ class SecretStore {

const cacheBuster = options.cacheBuster;
delete options.cacheBuster;
// check the cache buster key every minute
if(options.cacheBuster){
const dynamoDB = new AWS.DynamoDB.DocumentClient({
region: options.awsOpts.region
});
const params = {
TableName: options.table,
Limit: 1,
ConsistentRead: true,
KeyConditionExpression: '#name = :name',
ExpressionAttributeNames: {
'#name': 'name'
},
ExpressionAttributeValues: {
':name': secretGen(options.cacheBuster)
}
};
setInterval(() => {
dynamoDB.query(params, (err, obj) => {
if(err)
return void console.error(err);
if(obj && obj.Items && obj.Items.length && obj.Items[0].contents)
this.cacheRefreshTime = Number(obj.Items[0].contents);
});
}, 60000).unref();
delete options.cacheBuster;
}
this.options = options;
this.store = new Credstash(options);
this.cache = {};
// check the cache buster key every minute
if(cacheBuster) {
const cacheBusterKey = secretGen(cacheBuster);
setInterval(() => {
this.store.getSecret({name: cacheBusterKey}).then(secret => this.cacheRefreshTime = Number(secret));
}, 60000);
}
}

@@ -45,3 +64,3 @@

if(key in this.cache) {
if(key in this.cache){
// doing a less than comparison for a time to a null/undefined value will be false

@@ -48,0 +67,0 @@ if(this.cache[key].timestamp < this.cacheRefreshTime)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc