How to use the hibp.pasteAccount function in hibp

To help you get started, we’ve selected a few hibp 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 wKovacs64 / pwned / src / api / getPastes.js View on Github external
export default (email, raw) => {
  if (!raw && process.stdout.isTTY) {
    spinner.start();
  }
  return Promise.resolve(pasteAccount(email))
    .then((pasteData) => {
      if (!raw && process.stdout.isTTY) {
        spinner.stop(true);
      }
      if (pasteData && raw) {
        logger.log(JSON.stringify(pasteData));
      } else if (pasteData) {
        logger.log(prettyjson.render(pasteData));
      } else if (!pasteData && !raw) {
        logger.log('Good news — no pwnage found!');
      }
    })
    .catch((err) => {
      if (!raw && process.stdout.isTTY) {
        spinner.stop(true);
      }
github wKovacs64 / pwned / src / commands / pa.ts View on Github external
export const handler = async ({
  email,
  raw,
}: PaHandlerOptions): Promise => {
  if (!raw) {
    spinner.start();
  }

  try {
    const pasteData = await pasteAccount(email, {
      apiKey: config.get('apiKey'),
      userAgent,
    });
    if (pasteData && raw) {
      logger.log(JSON.stringify(pasteData));
    } else if (pasteData) {
      spinner.stop();
      logger.log(prettyjson.render(pasteData));
    } else if (!pasteData && !raw) {
      spinner.succeed('Good news — no pwnage found!');
    }
  } catch (err) {
    const errMsg = translateApiError(err.message);
    if (!raw) {
      spinner.fail(errMsg);
    } else {

hibp

An unofficial TypeScript SDK for the 'Have I been pwned?' service.

MIT
Latest version published 4 months ago

Package Health Score

72 / 100
Full package analysis