Use go-hibp v1.0.0 for #30

This commit is contained in:
Winni Neessen 2021-09-22 20:23:43 +02:00
parent 2087a4b60c
commit 27d05f497b
5 changed files with 59 additions and 17 deletions

View file

@ -1,9 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4"> <module version="4">
<component name="Go" enabled="true" /> <component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module> </module>

View file

@ -5,10 +5,7 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="4f2cb9e2-b3a4-4e84-b99e-efc626c48d46" name="Changes" comment=""> <list default="true" id="4f2cb9e2-b3a4-4e84-b99e-efc626c48d46" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/apg-go.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/apg-go.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/apg.go.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/apg/apg.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/apg/apg.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/cmd/apg/apg.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/apg/apg.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" /> <change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
@ -19,7 +16,7 @@
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="GOROOT" url="file://$USER_HOME$/go/go1.17.1" /> <component name="GOROOT" url="file://$PROJECT_DIR$/../../go1.17.1" />
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
@ -27,12 +24,27 @@
<option name="indexEntireGoPath" value="false" /> <option name="indexEntireGoPath" value="false" />
</component> </component>
<component name="ProjectId" id="1yRb7lIdCn8c4b6dwTlP2QjBzYh" /> <component name="ProjectId" id="1yRb7lIdCn8c4b6dwTlP2QjBzYh" />
<component name="ProjectLevelVcsManager">
<OptionsSetting value="false" id="Update" />
</component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="configurable..is.expanded" value="false" />
<property name="configurable.GoLibrariesConfigurable.is.expanded" value="true" />
<property name="go.formatter.settings.were.checked" value="true" /> <property name="go.formatter.settings.were.checked" value="true" />
<property name="go.import.settings.migrated" value="true" /> <property name="go.import.settings.migrated" value="true" />
<property name="go.modules.go.list.on.any.changes.was.set" value="true" /> <property name="go.modules.go.list.on.any.changes.was.set" value="true" />
<property name="settings.editor.selected.configurable" value="go.sdk" />
</component> </component>
<component name="RunManager"> <component name="RunManager" selected="Go Test.Run Tests">
<configuration name="Run apg-go client" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="apg-go" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<package value="github.com/wneessen/apg-go/cmd/apg" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application"> <configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="apg-go" /> <module name="apg-go" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
@ -41,6 +53,28 @@
<filePath value="$PROJECT_DIR$" /> <filePath value="$PROJECT_DIR$" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="Run Benchmark" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="apg-go" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-v" />
<kind value="PACKAGE" />
<package value="github.com/wneessen/apg-go/cmd/apg" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<framework value="gobench" />
<method v="2" />
</configuration>
<configuration name="Run Tests" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="apg-go" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-v" />
<kind value="PACKAGE" />
<package value="github.com/wneessen/apg-go/cmd/apg" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<framework value="gotest" />
<method v="2" />
</configuration>
<configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test"> <configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="apg-go" /> <module name="apg-go" />
<working_directory value="$PROJECT_DIR$" /> <working_directory value="$PROJECT_DIR$" />
@ -50,12 +84,25 @@
<framework value="gotest" /> <framework value="gotest" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<list>
<item itemvalue="Go Build.Run apg-go client" />
<item itemvalue="Go Test.Run Tests" />
<item itemvalue="Go Test.Run Benchmark" />
</list>
</component> </component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="Vcs.Log.Tabs.Properties">
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VgoProject"> <component name="VgoProject">
<integration-enabled>true</integration-enabled> <integration-enabled>true</integration-enabled>
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/apg_go$TestGetRandNum_in_github_com_wneessen_apg_go__1_.out" NAME="TestGetRandNum in github.com/wneessen/apg.go (1) Coverage Results" MODIFIED="1616594443133" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="GoCoverage" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
<SUITE FILE_PATH="coverage/apg_go$BenchmarkGetRandNum_in_apg_go.out" NAME="BenchmarkGetRandNum in apg.go Coverage Results" MODIFIED="1616342745320" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="GoCoverage" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
<SUITE FILE_PATH="coverage/apg_go$Test_Application.out" NAME="Test Application Coverage Results" MODIFIED="1616765230426" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="GoCoverage" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
</component>
</project> </project>

View file

@ -7,7 +7,7 @@ import (
"github.com/wneessen/apg-go/config" "github.com/wneessen/apg-go/config"
"github.com/wneessen/apg-go/random" "github.com/wneessen/apg-go/random"
"github.com/wneessen/apg-go/spelling" "github.com/wneessen/apg-go/spelling"
hibp "github.com/wneessen/go-hibp" "github.com/wneessen/go-hibp"
"log" "log"
"os" "os"
"time" "time"
@ -86,7 +86,7 @@ func main() {
if cfgObj.CheckHibp { if cfgObj.CheckHibp {
hc := hibp.New(hibp.WithHttpTimeout(time.Second * 2)) hc := hibp.New(hibp.WithHttpTimeout(time.Second * 2))
pwnObj, _, err := hc.PwnedPassword.CheckPassword(pwString) pwnObj, _, err := hc.PwnedPassApi.CheckPassword(pwString)
if err != nil { if err != nil {
log.Printf("unable to check HIBP database: %v", err) log.Printf("unable to check HIBP database: %v", err)
} }

2
go.mod
View file

@ -2,4 +2,4 @@ module github.com/wneessen/apg-go
go 1.16 go 1.16
require github.com/wneessen/go-hibp v0.1.1 require github.com/wneessen/go-hibp v1.0.0

4
go.sum
View file

@ -1,2 +1,2 @@
github.com/wneessen/go-hibp v0.1.1 h1:tq/bLNqGIns3r2b1dAT7PcVdYRsF70qBTs7tQh6sfRo= github.com/wneessen/go-hibp v1.0.0 h1:XmjymVwdhH06TVzU/ahlYzwAhX3OgxoxvyJ3HPa8gks=
github.com/wneessen/go-hibp v0.1.1/go.mod h1:Ldg6DQg4fMCveVKgL+RL9Jy+9TsljjAP704Ix8X3jOw= github.com/wneessen/go-hibp v1.0.0/go.mod h1:Ldg6DQg4fMCveVKgL+RL9Jy+9TsljjAP704Ix8X3jOw=