Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/commenthol/is-password-pwned

Check password against pwnedpasswords.com using k-anonimity model
https://github.com/commenthol/is-password-pwned

k-anon password passwords pwned-passwords pwnedpasswords security

Last synced: about 1 month ago
JSON representation

Check password against pwnedpasswords.com using k-anonimity model

Awesome Lists containing this project

README

        

# is-password-pwned

> Check password against pwnedpasswords.com using k-anonimity model

[![NPM version](https://badge.fury.io/js/is-password-pwned.svg)](https://www.npmjs.com/package/is-password-pwned/)
[![Build Status](https://app.travis-ci.com/commenthol/is-password-pwned.svg?branch=master)](https://app.travis-ci.com/commenthol/is-password-pwned)

See [Searching pwned passwords by range][].
Caches all found hashes in LRU cache.

Runs in node and modern browsers.

## CLI

For using from the command line

```bash
$ npm i -g is-password-pwned
$ pwned
```

## API

### constructor

**Parameters**

- `size` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** size of lru cache (optional, default `10000`)

**Examples**

```javascript
import Pwnd from 'is-password-pwned'

const pwnd = new Pwnd()
const num = await pwnd.get('nutella')
//> num = 20833
```

### get

get password from lru cache or request it from pwnedpasswords.com
if `num === undefined` password hash could not be found in pwnedpasswords.com

**Parameters**

- `password` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** password to verify

Returns **await {Number}** num - number of found hashes

## Installation

Requires [nodejs](http://nodejs.org/).

```sh
$ npm install is-password-pwned
```

## Tests

```sh
$ npm test
```

## License

Unlicense https://unlicense.org

## References

- [Searching pwned passwords by range][]

[Searching pwned passwords by range]: https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange