Network Printer Manager

    pwned-api

    0.0.6 • Public • Published

    pwned-api

    NPM version Build Status Dependency Status Coverage percentage

    Unofficial javascript client for HaveIBeenPwned API

    Installation

    You can use it as a nodejs module:

    npm install --save pwned-api
    

    Or also install it globally and use it as cli tool:

    npm install --global pwned-api
    

    Usage

    Load the pwned-api module into your script than init the class to use its methods. It accept a callback but also return a promise so you can use it also with async.

    const Pwned = require('pwned-api');
    const pwner = new Pwned();
     
    pwner.breaches({}, (err, results) => {
      console.log('Results:', results);
    });

    Using new await/async functionalities:

    import Pwned from 'pwned-api'
    const pwner = new Pwned();
     
    (async () => {
      const res = await pwner.breaches();
      // Do whatever you need to do
    })()

    The pwner constructor takes two arguments, so you can customize the requests beheviour:

    const pwner = new Pwned({
      timeout: 2500,
      headers: {
        'User-Agent': 'My App'
      }
    });

    Methods

    breaches

    List all the available breaches

    pwner.breaches({}, (err, results) => {
      console.log('Results:', results);
    });

    breachedAccount

    Return a list of all breaches a particular account has been involved in.

    pwner.breachedAccount('john.doe@example.com', {}, (err, results) => {
      console.log('Results:', results);
    });

    breach

    Return single breach retrieved by the breach "name".

    pwner.breach('AshleyMadison', (err, results) => {
      console.log('Results:', results);
    });

    dataClasses

    Return all the data classes in the system.

    pwner.dataClasses((err, results) => {
      console.log('Results:', results);
    });

    pasteAccount

    Return all pastes for an account, takes a single parameter which is the email address to be searched for.

    pwner.pasteAccount('john.doe@example.com', (err, results) => {
      console.log('Results:', results);
    });

    pwnedPassword

    Check if a password been exposed in data breaches and exists on HIBP database.

    pwner.pwnedPassword('admin1234', {}, (err) => {
      console.log('Error;', err );
    });

    For details in depth about the API please consult the official HaveIBeenPwned page.


    License

    MIT © b4dnewz

    Install

    npm i pwned-api

    DownloadsWeekly Downloads

    7

    Version

    0.0.6

    License

    MIT

    Unpacked Size

    78 kB

    Total Files

    9

    Last publish

    Collaborators

    • b4dnewz