How to use the @cumulus/ingest/crypto.DefaultProvider.decrypt function in @cumulus/ingest

To help you get started, we’ve selected a few @cumulus/ingest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nasa / cumulus / tasks / post-to-cmr / index.js View on Github external
async function publish(cmrFile, creds, bucket, stack) {
  let password;
  try {
    password = await DefaultProvider.decrypt(creds.password, undefined, bucket, stack);
  }
  catch (e) {
    log.error('Decrypting password failed, using unencrypted password');
    password = creds.password;
  }
  const cmr = new CMR(
    creds.provider,
    creds.clientId,
    creds.username,
    password
  );

  const xml = await getMetadata(cmrFile.filename);
  const res = await cmr.ingestGranule(xml);
  const conceptId = res.result['concept-id'];
github nasa / cumulus / packages / api / models / granules.js View on Github external
async removeGranuleFromCmr(granuleId, collectionId) {
    log.info(`granules.removeGranuleFromCmr ${granuleId}`);
    const password = await DefaultProvider.decrypt(process.env.cmr_password);
    const cmr = new CMR(
      process.env.cmr_provider,
      process.env.cmr_client_id,
      process.env.cmr_username,
      password
    );

    await cmr.deleteGranule(granuleId, collectionId);
    await this.update({ granuleId }, { published: false, cmrLink: null });
  }