Sha256: f79893ea6a5a1dab066c12401f92b95f0391c1e600cc7aef3586da89f5ea110d

Contents?: true

Size: 781 Bytes

Versions: 1

Compression:

Stored size: 781 Bytes

Contents

'use strict';

let awsCredentialProviders = null;
/** @ignore */
async function loadAWSCredentials(kmsProviders) {
  if (awsCredentialProviders == null) {
    try {
      // Ensure you always wrap an optional require in the try block NODE-3199
      awsCredentialProviders = require('@aws-sdk/credential-providers');
      // eslint-disable-next-line no-empty
    } catch {}
  }

  if (awsCredentialProviders != null) {
    const { fromNodeProviderChain } = awsCredentialProviders;
    const provider = fromNodeProviderChain();
    // The state machine is the only place calling this so it will
    // catch if there is a rejection here.
    const aws = await provider();
    return { ...kmsProviders, aws };
  }

  return kmsProviders;
}

module.exports = { loadAWSCredentials };

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
libmongocrypt-helper-1.8.0.0.1001 ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/aws.js