exposed

package module
v0.0.0-...-36640a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2024 License: MIT Imports: 15 Imported by: 0

README

Exposed

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 Pwned Passwords overview for more information.

Checking a Password

You can check if a password has been exposed in breaches by using the CheckPwnedPassword function.

Checking a Hash

If you already have a SHA-1 or NTLM hash of the password, you can use the CheckPwnedHash function directly.

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

View Source
const BaseURL = "https://api.pwnedpasswords.com/range"

BaseURL is the endpoint for the Pwned Passwords API.

Variables

View Source
var DefaultPwnedClient = PwnedClient{
	// contains filtered or unexported fields
}
View Source
var ValidHashes = []string{"sha1", "ntlm"}
View Source
var ValidLookups = []string{"password", "hash"}

Functions

func CheckPwned

func CheckPwned(text, lookup, mode string) (int, error)

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL