Documentation ¶
Overview ¶
The `exposed` package provides utilities to check if a password or its hash has been exposed in breaches using the Have I Been Pwned API.
See https://haveibeenpwned.com/API/v3#PwnedPasswords for more information.
Index ¶
Constants ¶
const BaseURL = "https://api.pwnedpasswords.com/range"
BaseURL is the endpoint for the Pwned Passwords API.
Variables ¶
var DefaultPwnedClient = PwnedClient{ // contains filtered or unexported fields }
var ValidHashes = []string{"sha1", "ntlm"}
var ValidLookups = []string{"password", "hash"}
Functions ¶
func CheckPwned ¶
CheckPwned checks if a password or hash has been exposed in breaches.
Types ¶
type PwnedClient ¶
type PwnedClient struct {
// contains filtered or unexported fields
}
PwnedClient is a client to checkif passwords or hashes have been exposed.
func NewPwnedClient ¶
func NewPwnedClient(client *http.Client, baseURL string) *PwnedClient
NewPwnedClient creates a new PwnedClient with given HTTP client and base URL.
func (*PwnedClient) CheckPwned ¶
func (c *PwnedClient) CheckPwned(text, lookup, mode string) (int, error)
CheckPwned checks if a password or hash has been exposed in breaches.
func (*PwnedClient) CheckPwnedHash ¶
func (c *PwnedClient) CheckPwnedHash(hash, mode string) (int, error)
CheckPwnedHash checks if the hash of type mode has been exposed in breaches.
func (*PwnedClient) CheckPwnedPassword ¶
func (c *PwnedClient) CheckPwnedPassword(password, mode string) (int, error)
CheckPwnedPassword checks if the password has been exposed in breaches. Mode is used to select which type of hash to use, i.e., ntlm or sha1.