0.0.1 • Published 9 years ago

pwncheck v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

PwnCheck

This package provides an easy-to-use wrapper for Troy Hunt's excellent Have I been pwned? API.

Installation

npm install pwncheck

Quickstart

PwnCheck is used by creating an endpoint for invoking the checkBreach method. This endpoint would favorably -- though not necessarily -- be queried via AJAX.

app.param('email', function(req, res, next, email) {
  if(!validator.isEmail(email)) {
    return res.status(400).send('Invalid e-mail address: "' + email + '"');
  }

  req.email = email;
  return next();
});

app.get('/pwncheck/:email', function(req, res) {
  pwncheck.checkBreach(req.email, false, function(err, result) {
    if(err) { console.log(err); return res.status(500).json(err); }
    return res.status(200).json(result);
  });
});

Please refer to examples/example.js for a fully functional demonstration.

Demo application

Changelog

0.0.1

  • Implemented PwnChecker.checkBreach()
  • Created demo application
  • Wrote basic unit tests
  • Added LICENSE and README files

Credits

Have I been pwned? is developed and maintained by Troy Hunt.

License

Distributed under the MIT License.