Browse Source

testing auth

Josh Yan 9 months ago
parent
commit
d1b7f8bb07
2 changed files with 2 additions and 10 deletions
  1. 0 8
      auth/auth.go
  2. 2 2
      server/routes_test.go

+ 0 - 8
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()

+ 2 - 2
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)
 		}