diff --git a/agent/bitwarden/websocket.go b/agent/bitwarden/websocket.go index 68c603f..f735a9b 100644 --- a/agent/bitwarden/websocket.go +++ b/agent/bitwarden/websocket.go @@ -12,6 +12,7 @@ import ( "github.com/gorilla/websocket" "github.com/quexten/goldwarden/agent/bitwarden/models" "github.com/quexten/goldwarden/agent/config" + "github.com/quexten/goldwarden/agent/notify" "github.com/quexten/goldwarden/agent/systemauth/biometrics" "github.com/quexten/goldwarden/agent/systemauth/pinentry" "github.com/quexten/goldwarden/agent/vault" @@ -200,20 +201,23 @@ func connectToWebsocket(ctx context.Context, vault *vault.Vault, cfg *config.Con } websocketLog.Info("AuthRequest details " + authRequest.RequestIpAddress + " " + authRequest.RequestDeviceType) - var message = "Do you want to allow " + authRequest.RequestIpAddress + " (" + authRequest.RequestDeviceType + ") to login to your account?" - if approved, err := pinentry.GetApproval("Paswordless Login Request", message); err != nil || !approved { - websocketLog.Info("AuthRequest denied") - break - } - if !biometrics.CheckBiometrics(biometrics.AccessVault) { - websocketLog.Info("AuthRequest denied - biometrics required") - break - } + notify.Notify("Passwordless Login Request", authRequest.RequestIpAddress+" - "+authRequest.RequestDeviceType, "", 0, func() { + var message = "Do you want to allow " + authRequest.RequestIpAddress + " (" + authRequest.RequestDeviceType + ") to login to your account?" + if approved, err := pinentry.GetApproval("Paswordless Login Request", message); err != nil || !approved { + websocketLog.Info("AuthRequest denied") + return + } + if !biometrics.CheckBiometrics(biometrics.AccessVault) { + websocketLog.Info("AuthRequest denied - biometrics required") + return + } + + _, err = CreateAuthResponse(context.WithValue(ctx, AuthToken{}, token.AccessToken), authRequest, vault.Keyring, cfg) + if err != nil { + websocketLog.Error("Error creating auth response %s", err) + } + }) - _, err = CreateAuthResponse(context.WithValue(ctx, AuthToken{}, token.AccessToken), authRequest, vault.Keyring, cfg) - if err != nil { - websocketLog.Error("Error creating auth response %s", err) - } break case AuthRequestResponse: websocketLog.Info("AuthRequestResponse received")