haveibeenpwned-checker
v1.1.0
Published
haveibeenpwned-checker validate email addresses, usernames, and passwords if they have previously been exposed in data breaches. based on https://haveibeenpwned.com
Downloads
29
Maintainers
Readme
haveibeenpwned-checker
(https://badges.greenkeeper.io/mikeshaker/haveibeenpwned-checker.svg)](https://greenkeeper.io/)
Pwned Passwords check passwords, email addresses, and usernames if they have previously been exposed in data breaches. Using APIs by Troy Hunt (haveibeenpwned.com).
Demo
Installation
npm i haveibeenpwned-checker
Usage
const HIBP = require("haveibeenpwned-checker");
## Passwords
// password : password string to check//
// callback: callback method
// timeout -(optional) by default it's 3000 ms integer containing the number of milliseconds to wait for a server to send response headers (and start the response body) before aborting the request.
HIBP.PasswordChecker('Abcd1234$',myCallback, TIME_OUT);
##Accounts
#Rate limiting: based on the rate limit by https://haveibeenpwned.com (one per every 1500 milliseconds each from any given IP address)
// Account : email addres/username
// callback: callback method
// timeout -(optional) by default it's 3000 ms integer containing the number of milliseconds to wait for a server to send response headers (and start the response body) before aborting the request.
HIBP.AccountChecker('[email protected]',myCallback, TIME_OUT);
//Return Object
// { error: string, failed: boolean, count: number }
// error: error message if encounter an error.
// success: boolean flag to indicate if call/api failed
// count: count of how many times it appears in breaches.
function passwordPwnedCallback (e){
console.log(e);
//{ error: '', success: true, count: 3645804 }
}
Mike Shaker