breach

package
v0.0.0-...-c5d5a31 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package breach checks for data breaches for a given account

Index

Constants

View Source
const HaveIBeenPwnedProvider provider = "Have I Been Pwned"

HaveIBeenPwnedProvider indicates the source is haveibeenpwned.com

Variables

This section is empty.

Functions

This section is empty.

Types

type Breach

type Breach struct {
	Name        string
	Domain      string
	Date        time.Time
	Count       int
	Description string
	Items       []string
}

Breach is a single breach

type Fetcher

type Fetcher interface {
	Fetch(account string) (*Response, error)
}

Fetcher implements methods to check for security breaches for an account

type Pwned

type Pwned struct {
	HTTPClient *http.Client
	UserAgent  string
}

Pwned holds settings for the haveibeenpwned.com API

func (*Pwned) Fetch

func (p *Pwned) Fetch(account string) (*Response, error)

Fetch retrieves security breaches from haveibeenpwned.com

type PwnedResponse

type PwnedResponse []struct {
	Title        string    `json:"Title"`
	Name         string    `json:"Name"`
	Domain       string    `json:"Domain"`
	BreachDate   string    `json:"BreachDate"`
	AddedDate    time.Time `json:"AddedDate"`
	ModifiedDate time.Time `json:"ModifiedDate"`
	PwnCount     int       `json:"PwnCount"`
	Description  string    `json:"Description"`
	DataClasses  []string  `json:"DataClasses"`
	IsVerified   bool      `json:"IsVerified"`
	IsFabricated bool      `json:"IsFabricated"`
	IsSensitive  bool      `json:"IsSensitive"`
	IsActive     bool      `json:"IsActive"`
	IsRetired    bool      `json:"IsRetired"`
	IsSpamList   bool      `json:"IsSpamList"`
	LogoType     string    `json:"LogoType"`
}

PwnedResponse is the raw response from haveibeenpwned.com

type Response

type Response struct {
	Account  string
	Breaches []Breach
	Provider provider
}

Response is a currency response

func New

func New(account string, provider provider) *Response

New creates a new breach Response

func (*Response) Sort

func (r *Response) Sort()

Sort will organize the History in ascending order by date

Jump to

Keyboard shortcuts

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