Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheService ¶
type CacheService service
CacheService handles in-memory caching of our hash/compromised pairs.
func (*CacheService) Expire ¶
func (s *CacheService) Expire(hash string)
Expire will expire the cache for a given hash.
func (*CacheService) ExpireAll ¶
func (s *CacheService) ExpireAll()
ExpireAll will expire all cache.
func (*CacheService) Get ¶
func (s *CacheService) Get(hash string) *PwnedStore
Get will return our stored in-memory hash/compromised pairs, if we have them.
func (*CacheService) IsExpired ¶
func (s *CacheService) IsExpired(hash string) bool
IsExpired checks if we have cached hash and that it isn't expired.
func (*CacheService) Store ¶
func (s *CacheService) Store(hash string, compromised bool)
Store will save our hash/compromised pairs to a PwnedStore.
type Client ¶
type Client struct { AppID string UserAgent string BackendURL *url.URL // Services used for communicating with the API. Pwned *PwnedService Cache *CacheService // contains filtered or unexported fields }
Client holds a connection to the HIBP API.
func NewClient ¶
func NewClient() *Client
NewClient creates a new Client with the appropriate connection details and services used for communicating with the API.
type PwnedService ¶
type PwnedService service
PwnedService handles retrieving pwned hashes from in-memory cache or by fetching fresh results.
func (*PwnedService) Compromised ¶
func (s *PwnedService) Compromised(value string) (bool, error)
Compromised will build and execute a request to HIBP to check to see if the passed value is compromised or not.