hibp

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: MPL-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Breach

type Breach struct {
	Date string `json:"BreachDate"`
	Name string `json:"Name"`
}

Breach represents a breach in the HIBP system

func (*Breach) BreachDate

func (br *Breach) BreachDate() (time.Time, error)

BreachDate returns the date of the breach

type Settings

type Settings struct {
	*cfg.Common
	// contains filtered or unexported fields
}

Settings defines the configuration properties for this module

func NewSettingsFromYAML

func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings

NewSettingsFromYAML creates a new settings instance from a YAML config block

func (*Settings) HasSince

func (sett *Settings) HasSince() bool

HasSince returns TRUE if there's a valid "since" value setting, FALSE if there is not

func (*Settings) SinceDate

func (sett *Settings) SinceDate() (time.Time, error)

SinceDate returns the "since" settings as a proper Time instance

type Status

type Status struct {
	Account  string
	Breaches []Breach
}

Status represents the status of an account in the HIBP system

func NewStatus

func NewStatus(acct string, breaches []Breach) *Status

NewStatus creates and returns an instance of Status

func (*Status) HasBeenCompromised

func (stat *Status) HasBeenCompromised() bool

HasBeenCompromised returns TRUE if the specified account has any breaches associated with it, FALSE if no breaches are associated with it

func (*Status) Len

func (stat *Status) Len() int

Len returns the number of breaches found for the specified account

type Widget

type Widget struct {
	view.TextWidget
	// contains filtered or unexported fields
}

Widget is the container for hibp data

func NewWidget

func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget

NewWidget creates a new instance of a widget

func (*Widget) Fetch

func (widget *Widget) Fetch(accounts []string) ([]*Status, error)

Fetch retrieves HIBP data from the HIBP API

func (*Widget) Refresh

func (widget *Widget) Refresh()

Refresh updates the data for this widget and displays it onscreen

Jump to

Keyboard shortcuts

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