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

@campus-explorer/aws-credentials

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@campus-explorer/aws-credentials

TODO

  • 7.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-22.22%
Maintainers
0
Weekly downloads
 
Created
Source

@campus-explorer/aws-credentials

JavaScript helper code to manage AWS credentials

Install

yarn add @campus-explorer/aws-credentials

Usage

import AWS from 'aws-sdk';
import {
    getProfileCredentials,
    useProfile,
    getProfileConfig,
} from '@campus-explorer/aws-credentials';

# Get an AWS.Credentials object for the profile
const credentials = await getProfileCredentials('my-profile');

# Alternatively, set AWS to use the profile
await useProfile('my-profile', AWS.config);

# See if a profile exists
try {
    getProfileConfig('my-profile');
} catch (error) {
    // doesn't exist
}

Description

This package is similar to AWS.SharedIniFileCredentials, in that it loads credentials using the shared credentials file. However, it adds a few features:

  • integration with the AWS CLI cache
  • longer durations

Session Durations

By default, we will cache profiles that end in '-admin' for 1 hour, and all other profiles for 8 hours.

Functions

getProfileCredentials()

Returns an AWS.Credentials object.

getProfileCredentials(
    profile,
    { // optional options
        cacheDir, // optional, defaults to ~/.aws/cli/cache
        duration, // optional, defaults to duration rules noted above,
        getMfaToken, // optional, defaults to using inquirer
    },
})

useProfile()

Loads the profile's credential into the environment and the global credentials settings for the AWS SDK. You need to pass your copy of the AWS object.

useProfile({
    profile,
    AWS,
    {
        /* ... same options as getProfileCredentials() */
    }
})

FAQs

Package last updated on 02 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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