Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/brasilikum/is-password-known

Package for elm that checks a password agians the public API of haveibeenpwned.com
https://github.com/brasilikum/is-password-known

elm elm-lang haveibeenpawned haveibeenpwned password-safety password-strength

Last synced: 26 days ago
JSON representation

Package for elm that checks a password agians the public API of haveibeenpwned.com

Awesome Lists containing this project

README

        

# Is this password known?

This elm package checks a given password against the API of haveibeenpwned.com.

## Usage

```elm
requestPassword: String -> Cmd Msg
requestPassword pass =
pass
|> hashAndCut
|> Debug.log "This will be sent to HaveIBeenPawned.com"
|> requestPossibleMatches
|> Http.send PasswordResponse
```

```elm
update msg model =
case msg of
SetPassword pass ->
( { model | password = pass }, Cmd.none )

CheckPassword ->
( model, requestPassword model.password )

PasswordResponse (Ok resp) ->
( { model
| isPasswordKnown =
Just (isPasswordKnown model.password resp)
}
, Cmd.none
)
```