You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

18 lines
316 B

package main
import (
"errors"
"strings"
)
func validateSSHKey(sshKey string) (err error) {
if !strings.HasPrefix(sshKey, "ssh-") {
err = errors.New("sshKey must have ssh- prefix.")
return
}
if strings.Contains(sshKey, "\n") {
err = errors.New("sshKey must not contain newlines.")
return
}
return
}