New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hibp-js

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hibp-js

Check a password in haveibeenpwned using pure JavaScript

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

hibp-js

This library allows you to check if a password exists in the Have I Been Pwned database

How does it work?

The library will first hash the password using SHA-1 and then send the first 5 characters to HIBP's server which will return a list of hashes that starts with those characters.

We then check if the hash exists in the returned list and fire an event hibpCheck with the result

Usage

You should first load the library

<script src="lib/hibp.min.js"></script>

Then you can call the hibpCheck('PASSWORD HERE') function, it will fire an event hibpCheck with the result.

Don'ts:

  • Don't tell users your password is secure just because it wasn't found in hibp.
  • Don't use this over insecure HTTP (if you don't use HTTPS you simply don't care enough about your users' data)

Example

// When the result is ready check if the password was found or not
document.addEventListener('hibpCheck', function (e) {  
    if(e.detail){
        alert('Found');
    } else {
        alert('Not Found');
    }
});
hibpCheck('password');

Full example can be found here

Keywords

javascript-library

FAQs

Package last updated on 20 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts