Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

awscred

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awscred - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

36

index.js

@@ -26,2 +26,3 @@ var fs = require('fs'),

exports.loadProfileFromIniFile = loadProfileFromIniFile
exports.merge = merge

@@ -180,2 +181,37 @@ function loadCredentialsAndRegion(options, cb) {

function merge(obj, options, cb) {
if (!cb) { cb = options; options = {} }
var needRegion = !obj.region
var needCreds = !obj.credentials || !obj.credentials.accessKeyId || !obj.credentials.secretAccessKey
function loadCreds(cb) {
if (needRegion && needCreds) {
return loadCredentialsAndRegion(options, cb)
} else if (needRegion) {
return loadRegion(options, function(err, region) { cb(err, {region: region}) })
} else if (needCreds) {
return loadCredentials(options, function(err, credentials) { cb(err, {credentials: credentials}) })
}
cb(null, {})
}
loadCreds(function(err, creds) {
if (err) return cb(err)
if (creds.region) obj.region = creds.region
if (creds.credentials) {
if (!obj.credentials) {
obj.credentials = creds.credentials
} else {
Object.keys(creds.credentials).forEach(function(key) {
if (!obj.credentials[key]) obj.credentials[key] = creds.credentials[key]
})
}
}
cb()
})
}
function resolveProfile() {

@@ -182,0 +218,0 @@ return env.AWS_PROFILE || env.AMAZON_PROFILE || 'default'

5

package.json
{
"name": "awscred",
"version": "1.0.3",
"version": "1.1.0",
"description": "Resolves AWS credentials (and region) using env, file and IAM strategies",

@@ -15,3 +15,4 @@ "main": "index.js",

"author": "Michael Hart <michael.hart.au@gmail.com>",
"license": "MIT"
"license": "MIT",
"scripts": {}
}

@@ -86,1 +86,6 @@ awscred

Individual methods to load credentials and region from different sources
### awscred.merge(obj, [options], cb)
Populates the `region` and `credentials` properties of `obj` using the
appropriate `load` method – depending on whether they're already set or not.
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