haveibeenpwned-checker

1.1.0 • Public • Published

haveibeenpwned-checker

License: MIT npm version Build Status NPM Downloads (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

Live Demo 1 OR Live Demo 2

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('test@test.com',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

Package Sidebar

Install

npm i haveibeenpwned-checker

Weekly Downloads

6

Version

1.1.0

License

MIT

Unpacked Size

90.1 kB

Total Files

11

Last publish

Collaborators

  • mshaker