testing auth
This commit is contained in:
parent
6d4724a06d
commit
d1b7f8bb07
@ -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()
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user