Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultEndpoint is the official HaveIBeenPwned range API base URL. DefaultEndpoint = "https://api.pwnedpasswords.com/range/" // DefaultUserAgent is the default HTTP User-Agent header. DefaultUserAgent = "hibp-go/1.0" // DefaultTimeout is the default HTTP request timeout. DefaultTimeout = 5 * time.Second )
Variables ¶
View Source
var ( // ErrEmptyPassword is returned when an empty password string is provided. ErrEmptyPassword = errors.New("hibp: password cannot be empty") // ErrUnexpectedStatus is returned when HIBP returns a non-200 HTTP status. ErrUnexpectedStatus = errors.New("hibp: unexpected HTTP response status") )
View Source
var DefaultClient = New()
DefaultClient is the package-level default client.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client checks passwords against HaveIBeenPwned.
type Option ¶
type Option func(*Client)
Option configures the HIBP Client.
func WithEndpoint ¶
WithEndpoint sets a custom range API endpoint.
func WithHTTPClient ¶
WithHTTPClient sets a custom http.Client.
func WithUserAgent ¶
WithUserAgent sets a custom User-Agent header.
Click to show internal directories.
Click to hide internal directories.