diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 73f69e0..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
-# Editor-based HTTP Client requests
-/httpRequests/
diff --git a/.idea/apg.go.iml b/.idea/apg-go.iml
similarity index 100%
rename from .idea/apg.go.iml
rename to .idea/apg-go.iml
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 6385bbc..88c9fce 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 31a0845..891d695 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,279 +4,58 @@
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
true
-
-
-
-
-
\ No newline at end of file
diff --git a/cmd/apg/apg.go b/cmd/apg/apg.go
index f07e8dc..2a4e58c 100644
--- a/cmd/apg/apg.go
+++ b/cmd/apg/apg.go
@@ -10,6 +10,7 @@ import (
hibp "github.com/wneessen/go-hibp"
"log"
"os"
+ "time"
)
const VersionString string = "0.3.3"
@@ -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")
}
}
diff --git a/go.mod b/go.mod
index bc10f6b..b188e9b 100644
--- a/go.mod
+++ b/go.mod
@@ -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
diff --git a/go.sum b/go.sum
index ae95c0a..a26f30b 100644
--- a/go.sum
+++ b/go.sum
@@ -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=