summaryrefslogtreecommitdiff
path: root/internal/client
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2024-11-16 21:23:17 +0200
committerKyren223 <Kyren223@proton.me>2024-11-16 21:23:17 +0200
commitd7cbae7d28ac2eae71e789b9eb5d3309b3509f6e (patch)
treefaf9ae268a2adc7f23c3978ac29a01b241d76f9b /internal/client
parent1ad1ef42dc7ca995dc6311a6b260660034c79f55 (diff)
feat: add functionality to remember private key on sign-in
Diffstat (limited to 'internal/client')
-rw-r--r--internal/client/ui/auth/auth.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/client/ui/auth/auth.go b/internal/client/ui/auth/auth.go
index 253d2f3..b04b7eb 100644
--- a/internal/client/ui/auth/auth.go
+++ b/internal/client/ui/auth/auth.go
@@ -16,6 +16,7 @@ import (
"github.com/charmbracelet/lipgloss"
"golang.org/x/crypto/ssh"
+ "github.com/kyren223/eko/internal/client/config"
"github.com/kyren223/eko/internal/client/ui"
authfield "github.com/kyren223/eko/internal/client/ui/auth/field"
"github.com/kyren223/eko/internal/client/ui/choicepopup"
@@ -366,6 +367,12 @@ func (m *Model) SetSignup(signup bool) tea.Cmd {
}
m.focusIndex = -1
m.CycleForward()
+
+ privateKey := config.Read().PrivateKeyPath
+ if !m.signup && privateKey != "" {
+ m.fields[privateKeyField].Input.SetValue(privateKey)
+ }
+
return m.updateFocus()
}
@@ -526,6 +533,11 @@ func (m *Model) signin() tea.Cmd {
return nil
}
+ if m.remember {
+ config.Use(func(config *config.Config) {
+ config.PrivateKeyPath = privateKeyFilepath
+ })
+ }
return authenticate(*privKey)
}