Skip to content

Commit

Permalink
Implement new go-hibp package
Browse files Browse the repository at this point in the history
  • Loading branch information
wneessen committed Sep 21, 2021
1 parent 7871b43 commit 2087a4b
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 251 deletions.
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

253 changes: 16 additions & 237 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions cmd/apg/apg.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
hibp "github.com/wneessen/go-hibp"
"log"
"os"
"time"
)

const VersionString string = "0.3.3"
Expand Down Expand Up @@ -84,11 +85,12 @@ func main() {
}

if cfgObj.CheckHibp {
isPwned, err := hibp.Check(pwString)
hc := hibp.New(hibp.WithHttpTimeout(time.Second * 2))
pwnObj, _, err := hc.PwnedPassword.CheckPassword(pwString)
if err != nil {
log.Printf("unable to check HIBP database: %v", err)
}
if isPwned {
if pwnObj != nil && pwnObj.Count != 0 {
fmt.Print("^-- !!WARNING: The previously generated password was found in HIPB database. Do not use it!!\n")
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/wneessen/apg-go

go 1.16

require github.com/wneessen/go-hibp v0.0.1
require github.com/wneessen/go-hibp v0.1.1
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/wneessen/go-hibp v0.0.1 h1:oZaeSsy1ygufrwh8CI3PWc3XLubaP7erJhZlc1+n6O4=
github.com/wneessen/go-hibp v0.0.1/go.mod h1:Ldg6DQg4fMCveVKgL+RL9Jy+9TsljjAP704Ix8X3jOw=
github.com/wneessen/go-hibp v0.1.1 h1:tq/bLNqGIns3r2b1dAT7PcVdYRsF70qBTs7tQh6sfRo=
github.com/wneessen/go-hibp v0.1.1/go.mod h1:Ldg6DQg4fMCveVKgL+RL9Jy+9TsljjAP704Ix8X3jOw=

0 comments on commit 2087a4b

Please sign in to comment.