diff --git a/auth/auth.go b/auth/auth.go index b3f34927a..69c5a39fe 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -36,19 +36,11 @@ func privateKey() (ssh.Signer, error) { } else if err != nil { slog.Info(fmt.Sprintf("Failed to load private key: %v", err)) return nil, err - return nil, err } return ssh.ParsePrivateKey(privateKeyFile) } -func GetPublicKey() (ssh.PublicKey, error) { - privateKey, err := keyPath() - // if privateKey, try public key directly - - return ssh.ParsePrivateKey(privateKeyFile) -} - func GetPublicKey() (ssh.PublicKey, error) { // try to read pubkey first home, err := os.UserHomeDir() diff --git a/server/routes_test.go b/server/routes_test.go index 1a559389c..e990fab6b 100644 --- a/server/routes_test.go +++ b/server/routes_test.go @@ -536,7 +536,7 @@ func TestIsLocalReal(t *testing.T) { clientPubLoc := t.TempDir() t.Setenv("HOME", clientPubLoc) - err := auth.InitializeKeypair() + _, err := auth.GetPublicKey() if err != nil { t.Fatal(err) } @@ -572,7 +572,7 @@ func TestIsLocalReal(t *testing.T) { t.Run("different server pubkey", func(t *testing.T) { serverPubLoc := t.TempDir() t.Setenv("HOME", serverPubLoc) - err := auth.InitializeKeypair() + _, err := auth.GetPublicKey () if err != nil { t.Fatal(err) }