lib/credentials.js
function Credentials (options) {
  EventEmitter.call(this)

  options.keys.apiVersion = 'latest'
  options.keys.sslEnabled = true

  if (options.hasOwnProperty('upgrade')) {
    // Update with the MFA token passed in with the credentials
    this.upgrade(options)
    return
  }

  let awsConfig = Object.assign({}, options.keys)

  // Else not using a MFA token
  this._awsConfig = new AWS.Config(awsConfig)

  // Upgrade creditials not necessary. Tell the caller ready.
  internals.emitAsync.call(this, internals.EVENT_INITIALIZED, null, { state: 'ok' })
}
function Credentials (options) {
  EventEmitter.call(this)

  options.keys.apiVersion = 'latest'
  options.keys.sslEnabled = true

  if (options.hasOwnProperty('upgrade')) {
    // Update with the MFA token passed in with the credentials
    this.upgrade(options)
    return
  }

  let awsConfig = Object.assign({}, options.keys)

  // Else not using a MFA token
  this._awsConfig = new AWS.Config(awsConfig)

  // Upgrade creditials not necessary. Tell the caller ready.
  internals.emitAsync.call(this, internals.EVENT_INITIALIZED, null, { state: 'ok' })
}
function Credentials ( options ) { EventEmitter . call ( this ) options . keys . apiVersion = 'latest' options . keys . sslEnabled = true if ( options . hasOwnProperty ( 'upgrade' ) ) { // Update with the MFA token passed in with the credentials this . upgrade ( options ) return } let awsConfig = Object . assign ( { } , options . keys ) // Else not using a MFA token this . _awsConfig = new AWS . Config ( awsConfig ) // Upgrade creditials not necessary. Tell the caller ready. internals . emitAsync . call ( this , internals . EVENT_INITIALIZED , null , { state : 'ok' } ) }
Credentials - Create MFA short term credentials
@constructor
@arg {object} options - The AWS service IAM credentials
@arg {object} options.keys - Credentials for the service API authentication. See [aws docs]{@link http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Credentials.html}
@arg {string} options.keys.accessKeyId - AWS access key ID
@arg {string} options.keys.secretAccessKey - AWS secret access key
@arg {string} options.keys.region - The EC2 region to send service requests
@arg {object} options.upgrade - Temporary Session Token credentials. See [aws docs]{@link http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#getSessionToken-property}
@arg {string} options.upgrade.serialNumber - Identifies the user's hardware or virtual MFA device
@arg {number} options.upgrade.tokenCode - Time-based one-time password (TOTP) that the MFA devices produces
@arg {number} [options.upgrade.durationSeconds=900] - The duration, in seconds, that the credentials should remain valid
@arg {boolean} [options.isLogging=false] - Use internal logging
@throws {error}
@emits {initialized}
Credentials - Create MFA short term credentials