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
4
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.1 to 0.0.2

6

package.json
{
"name": "@asymmetrik/yadda-secret",
"description": "Client secret library",
"version": "0.0.1",
"version": "0.0.2",
"main": "index.js",
"author": "contributors",
"contributors": [
{ "name" : "Christopher Sidell" }
{
"name": "Christopher Sidell"
}
],

@@ -10,0 +12,0 @@ "license": "MIT",

@@ -37,2 +37,4 @@ ## Yadda-Secret

#### Arrays of KMS values are not supported
```

@@ -105,2 +107,20 @@ const { KMSVAR } = require('@asymmetrik/yadda-secret');

```
### Usage in Test configs
The preferred option is to keep your configs the same and define the test values in the environment, if your testing
doesn't easily allow for that configuration you're able to pass a second argument to KMSVAR.
The second argument will transform your secret to resolve the given value and not touch the secrets database.
```
const { KMSVAR } = require('@asymmetrik/yadda-secret');
module.exports = {
myCoolApp: 'Hail Hydra',
hydraPassphrase: KMSVAR('HYRDA_PASSPHRASE', 'secret_phrase'),
hydraSecret: KMSVAR('HYRDA_SECRET', 'secretive_secret'),
};
```

@@ -7,5 +7,7 @@ 'use strict';

* @param name
* @param resolveTo
*/
constructor(name){
constructor(name, resolveTo = undefined){
this.name = name;
this.resolveTo = resolveTo;
}

@@ -12,0 +14,0 @@ }

@@ -7,5 +7,6 @@ 'use strict';

* Generate KMS variable facade
* @param variableName
* @param {string} variableName
* @param {string|null|undefined} autoResolveValue USED FOR TESTING ENVIRONMENTS ONLY
* @return {KMSFLAG}
*/
module.exports = (variableName) => new KMSFLAG(variableName);
module.exports = (variableName, autoResolveValue = undefined) => new KMSFLAG(variableName, autoResolveValue);

@@ -61,12 +61,2 @@ 'use strict';

/**
* Go through configuration tree and solve KMS dependencies
* @param config
*/
solve(config){
return new Promsise((resolve, reject) => {
return void resolve(config);
});
}
handler() {

@@ -84,11 +74,15 @@ /**

// Handle KMS Variables separately
if (target[name].constructor === KMSFLAG)
if (typeof target[name] === 'object' && target[name].constructor === KMSFLAG) {
// If given a resolved variable, resolve to the value directly
if (target[name].resolveTo !== undefined)
return Promise.resolve(target[name].resolveTo);
// If variable is in environment use it instead for backwards comparability & testing
if(target[name].name in process.env)
else if (target[name].name in process.env)
return Promise.resolve(process.env[target[name].name]);
else
return this.retrieveFromKMS(target[name].name);
}
// If a subobject add special handler
if (typeof target[name] === 'object')
if (typeof target[name] === 'object' && !Array.isArray(target[name]))
return this.KMS_Handler(target[name]);

@@ -95,0 +89,0 @@

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