Skip to content

🔐Go client library for checking values against compromised HIBP Pwned Passwords

License

Notifications You must be signed in to change notification settings

mattevans/pwned-passwords

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ad32088 · Jul 21, 2022

History

33 Commits
Aug 29, 2021
Sep 4, 2021
Aug 29, 2021
Feb 27, 2018
Sep 4, 2021
Sep 4, 2021
Sep 4, 2021
Jul 21, 2022
Sep 4, 2021

Repository files navigation

pwned-passwords

GoDoc Build Status Go Report Card license

A light-weight Go client for checking compromised passwords against HIBP Pwned Passwords.

Installation

go get -u github.com/mattevans/pwned-passwords

Usage

package main

import (
    "fmt"
    "net/http"
    "os"
    "time"

    hibp "github.com/mattevans/pwned-passwords"
)

func main() {
    // Init a client.
    client := hibp.NewClient()

    // Optional: Use a custom http client
    client.SetHTTPClient(&http.Client{
        Timeout: 3 * time.Second,
    })
	
    // Check to see if your given string is compromised.
    pwned, err := client.Compromised("string to check")
    if err != nil {
        os.Exit(1)
    }

    if pwned {
        // Oh dear! 😱 -- You should avoid using that password
        fmt.Print("Found to be compromised")
    }
}

Contributing

If you've found a bug or would like to contribute, please create an issue here on GitHub, or better yet fork the project and submit a pull request!