How to use the npm-profile.loginCouch function in npm-profile

To help you get started, we’ve selected a few npm-profile 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 semantic-release / cli / src / lib / npm.js View on Github external
async function validateToken(otp, npm) {
  if (!validator.isNumeric(otp)) {
    return false;
  }

  try {
    const {token} = await profile.loginCouch(npm.username, npm.password, {registry: npm.registry, otp});

    npm.token = token;

    return true;
  } catch (_) {
    // Invalid 2FA token
  }

  return 'Invalid authentication code';
}
github semantic-release / cli / src / lib / npm.js View on Github external
async function getNpmToken({npm}) {
  let token;

  try {
    const result = await profile.loginCouch(npm.username, npm.password, {registry: npm.registry});
    token = result.token;
  } catch (error) {
    if (error.code === 'EOTP') {
      await askForOTP(npm);
      token = npm.token;
    }
  }

  if (!token) throw new Error(`Could not login to npm.`);

  npm.token = token;
  log.info(`Successfully created npm token. ${npm.token}`);
}

npm-profile

Library for updating an npmjs.com profile

ISC
Latest version published 2 days ago

Package Health Score

89 / 100
Full package analysis

Similar packages