Add logging, including the json one
get infos from I've been pwned and the API on install.dm.gg/vpn-log.php and send mail if there is anything strange
This commit is contained in:
62
vendor/github.com/mattevans/pwned-passwords/README.md
generated
vendored
Normal file
62
vendor/github.com/mattevans/pwned-passwords/README.md
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# pwned-passwords
|
||||
|
||||
[](https://godoc.org/github.com/mattevans/pwned-passwords)
|
||||
[](https://travis-ci.org/mattevans/pwned-passwords)
|
||||
[](https://goreportcard.com/report/github.com/mattevans/pwned-passwords)
|
||||
[](https://github.com/mattevans/pwned-passwords/blob/master/LICENSE)
|
||||
|
||||
A simple [Go](http://golang.org) client library for checking compromised passwords against [HIBP Pwned Passwords](https://haveibeenpwned.com/Passwords).
|
||||
|
||||
Upon request, results will be cached (in-memory), keyed by hash. With a two hour expiry window, subsequent requests will use cached data or fetch fresh data accordingly.
|
||||
|
||||
Installation
|
||||
-----------------
|
||||
|
||||
`go get -u github.com/mattevans/pwned-passwords`
|
||||
|
||||
Usage
|
||||
-----------------
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
hibp "github.com/mattevans/pwned-passwords"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Init a client.
|
||||
client := hibp.NewClient()
|
||||
|
||||
// Check to see if your given string is compromised.
|
||||
pwned, err := client.Pwned.Compromised("string to check")
|
||||
if err != nil {
|
||||
fmt.Println("Pwned failed")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if pwned {
|
||||
// Oh dear!
|
||||
// You should avoid using that password
|
||||
} else {
|
||||
// Woo!
|
||||
// All clear!
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Expire in-memory cache**
|
||||
|
||||
```go
|
||||
client.Cache.Expire(HASHED_VALUE)
|
||||
```
|
||||
|
||||
```go
|
||||
client.Cache.ExpireAll()
|
||||
```
|
||||
|
||||
Contributing
|
||||
-----------------
|
||||
If you've found a bug or would like to contribute, please create an issue here on GitHub, or better yet fork the project and submit a pull request!
|
||||
Reference in New Issue
Block a user