api

package
v1.15.13 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package api implements an HIBP API client.

Example
{ //nolint:testableexamples
	matches, err := Lookup("sha1sum of secret")
	if err != nil {
		panic(err)
	}
	fmt.Printf("Number of matches: %d", matches)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var URL = "https://api.pwnedpasswords.com"

URL is the HIBPv2 API URL.

Functions

func Download added in v1.15.3

func Download(ctx context.Context, path string, keep bool) error

Download will download the list of all hashes from the API to a single, gzipped txt file. This is inspired by the "official" .NET based download tool. It does exactly 16⁵ / 1024*1024 (1M) requests to fetch all the possible prefixes.

func Lookup

func Lookup(shaSum string) (uint64, error)

Lookup performs a lookup against the HIBP v2 API.

Types

This section is empty.

Jump to

Keyboard shortcuts

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