Personal Git forge.

Code git clone ssh://git.poy.ooo:6969/~poyo/farga ZIP
lib/ssh.go / 559B #82cb35a5
Raw
package libimport (	"strings"	"golang.org/x/crypto/ssh")type SSHPubKey struct {	Key         string	Algorithm   string	Fingerprint string}// Parses a public key and returns it in a nice struct.func ParseKey(keyText string) (key SSHPubKey, err error) {	pubKey, _, _, _, err := ssh.ParseAuthorizedKey([]byte(keyText))	if err != nil {		return SSHPubKey{}, err	}	return SSHPubKey{		Key:         strings.TrimSpace(string(ssh.MarshalAuthorizedKey(pubKey))),		Algorithm:   pubKey.Type(),		Fingerprint: ssh.FingerprintSHA256(pubKey),	}, nil}