diff --git a/agent/systemauth/biometrics/touchid.go b/agent/systemauth/biometrics/touchid.go index 871310b..f20e2e4 100644 --- a/agent/systemauth/biometrics/touchid.go +++ b/agent/systemauth/biometrics/touchid.go @@ -9,7 +9,7 @@ import ( func CheckBiometrics(approvalType Approval) bool { ok, err := touchid.Authenticate(approvalType.String()) if err != nil { - log.Error(err) + log.Error(err.Error()) } if ok { diff --git a/client/setup/setup_linux.go b/client/setup/setup_linux.go new file mode 100644 index 0000000..96a550c --- /dev/null +++ b/client/setup/setup_linux.go @@ -0,0 +1,19 @@ +//go:build linux + +package setup + +import ( + "fmt" + + "github.com/quexten/goldwarden/agent/config" + "github.com/quexten/goldwarden/cmd" +) + +func VerifySetup(runtimeConfig config.RuntimeConfig) bool { + if !cmd.IsPolkitSetup() && !runtimeConfig.DisableAuth { + fmt.Println("Polkit is not setup. Run 'goldwarden setup polkit' to set it up.") + return false + } + + return true +} diff --git a/client/setup/setup_other.go b/client/setup/setup_other.go new file mode 100644 index 0000000..23179fe --- /dev/null +++ b/client/setup/setup_other.go @@ -0,0 +1,9 @@ +//go:build !linux + +package setup + +import "github.com/quexten/goldwarden/agent/config" + +func VerifySetup(runtimeConfig config.RuntimeConfig) bool { + return true +} diff --git a/main.go b/main.go index 4a034d2..fca5af0 100644 --- a/main.go +++ b/main.go @@ -1,13 +1,12 @@ package main import ( - "fmt" "os" "strings" - "time" "github.com/quexten/goldwarden/agent/config" "github.com/quexten/goldwarden/browserbiometrics" + "github.com/quexten/goldwarden/client/setup" "github.com/quexten/goldwarden/cmd" ) @@ -57,9 +56,8 @@ func main() { os.Setenv("GOLDWARDEN_SYSTEM_AUTH_DISABLED", "true") } - if !cmd.IsPolkitSetup() && !runtimeConfig.DisableAuth { - fmt.Println("Polkit is not setup. Run 'goldwarden setup polkit' to set it up.") - time.Sleep(3 * time.Second) + if !setup.VerifySetup(runtimeConfig) { + return } cmd.Execute(runtimeConfig)