this repo has no description smallweb.run
smallweb
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor SSH public key handling to read specific key files directly

pomdtr 2cd3179c 2b8f14d5

+7 -9
+7 -9
cmd/up.go
··· 139 139 if flags.sshAddr != "" { 140 140 server := ssh.Server{ 141 141 PublicKeyHandler: func(ctx ssh.Context, key ssh.PublicKey) bool { 142 - sshDir := filepath.Join(os.Getenv("HOME"), ".ssh") 143 - entries, err := os.ReadDir(sshDir) 144 - if err != nil && !errors.Is(err, os.ErrNotExist) { 145 - fmt.Fprintf(os.Stderr, "failed to read ssh directory: %v\n", err) 146 - return false 147 - } 148 142 149 - for _, entry := range entries { 150 - if filepath.Ext(entry.Name()) != ".pub" { 143 + for _, pubKeyName := range []string{ 144 + "id_ed25519.pub", 145 + "id_rsa.pub", 146 + } { 147 + pubKeyPath := filepath.Join(os.Getenv("HOME"), ".ssh", pubKeyName) 148 + if _, err := os.Stat(pubKeyPath); err != nil { 151 149 continue 152 150 } 153 151 154 - pubKeyBytes, err := os.ReadFile(filepath.Join(sshDir, entry.Name())) 152 + pubKeyBytes, err := os.ReadFile(pubKeyPath) 155 153 if err != nil { 156 154 continue 157 155 }