pwncheck
v0.0.1
Published
A straightforward API wrapper for the Have I Been Pwned? service, which aggregates information from publicly leaked security breaches.
Downloads
4
Readme
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
$ node examples/example.js
- Visit http://localhost:8080/
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.