Warning: this project is no longer maintained. Please see pwned for a CLI or hibp for Web and Node.js.
Functions for querying the 'Have I been pwned?' API.
Fetches breach data for a single breach.
breachName
: the name of a breach in the system
See the breach model section of the API documentation for a description of the data returned.
$ lib wKovacs64.hibp.breach --breachName Adobe
Shorthand for the same request:
$ lib wKovacs64.hibp.breach Adobe
https://wkovacs64.lib.id/hibp/breach/?breachName=Adobe
const lib = require('lib');
const { breach } = lib.wKovacs64.hibp;
breach({ breachName: 'Adobe' })
.then(data => {
// handle data
})
.catch(err => {
// handle error
});
Fetches all breach data for an account.
account
: a username or email address (required)domain
: a domain by which to filter the results (optional, default: all domains)truncate
: truncate the results to only include the name of each breach (optional, default: false)
See the breach model section of the API documentation for a description of the data returned.
Return a JSON object with breach information for the specified account:
$ lib wKovacs64.hibp.breachedAccount --account foo
Truncate the same results to just the breach names:
$ lib wKovacs64.hibp.breachedAccount --account foo --truncate true
https://wkovacs64.lib.id/hibp/breachedAccount/?account=foo
Limit to a specific domain:
https://wkovacs64.lib.id/hibp/breachedAccount/?account=foo&domain=adobe.com
const lib = require('lib');
const { breachedAccount } = lib.wKovacs64.hibp;
breachedAccount({ account: 'foo' })
.then(data => {
// handle data
})
.catch(err => {
// handle error
});
Fetches all breach data in the system.
domain
: a domain by which to filter the results (optional, default: all domains)
See the breach model section of the API documentation for a description of the data returned.
$ lib wKovacs64.hibp.breaches
Filter by domain:
$ lib wKovacs64.hibp.breaches --domain adobe.com
https://wkovacs64.lib.id/hibp/breaches/
const lib = require('lib');
const { breaches } = lib.wKovacs64.hibp;
breaches()
.then(data => {
// handle data
})
.catch(err => {
// handle error
});
Fetches all data classes in the system.
- none
See the data classes section of the API documentation for a description of the data returned.
$ lib wKovacs64.hibp.dataClasses
https://wkovacs64.lib.id/hibp/dataClasses/
const lib = require('lib');
const { dataClasses } = lib.wKovacs64.hibp;
dataClasses()
.then(data => {
// handle data
})
.catch(err => {
// handle error
});
Fetches all pastes for an email address.
email
: the email address to query (required)
See the paste model section of the API documentation for a description of the data returned.
$ lib wKovacs64.hibp.pasteAccount --email foo@bar.com
Shorthand for the same request:
$ lib wKovacs64.hibp.pasteAccount foo@bar.com
https://wkovacs64.lib.id/hibp/pasteAccount/?email=foo@bar.com
const lib = require('lib');
const { pasteAccount } = lib.wKovacs64.hibp;
pasteAccount({ email: 'foo@bar.com' })
.then(data => {
// handle data
})
.catch(err => {
// handle error
});
Securely fetches the number of times the given password has been exposed in a breach. See the Pwned Passwords section of the API documentation for more information.
password
: a password as a plain text string (required)
pwnedPassword
returns a number.
Return a number corresponding to the number of times the password has been exposed in a breach:
$ lib wKovacs64.hibp.pwnedPassword --password Password1234
https://wkovacs64.lib.id/hibp/pwnedPassword/?password=Password1234
const lib = require('lib');
const { pwnedPassword } = lib.wKovacs64.hibp;
pwnedPassword({ password: 'Password1234' })
.then(pwnCount => {
// handle result
})
.catch(err => {
// handle error
});
Fetches all breaches and all pastes associated with a given account.
account
: a username or email address (required)domain
: a domain by which to filter breach results (optional, default: all domains)truncate
: truncate the results to only include the name of each breach (optional, default: false)
search
returns a JSON object with a breaches
key and a pastes
key. See the
breach model and paste model sections of the
API documentation (respectively) for descriptions of the values of those keys.
Each value may independently be null if no corresponding data was found.
Return a JSON object with breach and paste information for the specified account:
$ lib wKovacs64.hibp.search --account foo
Return a JSON object with breach and paste information for the specified email address:
$ lib wKovacs64.hibp.search --account foo@bar.com
https://wkovacs64.lib.id/hibp/search/?account=foo
Limit breach data to a specific domain:
https://wkovacs64.lib.id/hibp/search/?account=foo&domain=adobe.com
const lib = require('lib');
const { search } = lib.wKovacs64.hibp;
search({ account: 'foo' })
.then(data => {
// handle data
})
.catch(err => {
// handle error
});
There's a good chance this project adds no value. I primarily did it as an introduction to microservices on StdLib. The current access methods probably have superior, preexisting alternatives: