Personal Git forge.

Code git clone ssh://git.poy.ooo:6969/~poyo/farga ZIP
ssh/auth.go / 729B #5207907a
Raw
package sshimport (	"github.com/google/uuid"	"golang.org/x/crypto/ssh")const userIDKey = "user_id"const userHandleKey = "user_handle"const isAnonymousKey = "is_anonymous"func AuthenticatePublicKey(store Store, conn ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) {	fingerprint := ssh.FingerprintSHA256(key)	user, err := store.UserByFingerprint(fingerprint)	if err != nil || user.ID == uuid.Nil {		return &ssh.Permissions{			Extensions: map[string]string{				isAnonymousKey: "true",			},		}, nil // no error = goes through	}	return &ssh.Permissions{		Extensions: map[string]string{			userIDKey:     user.ID.String(),			userHandleKey: user.Handle,		},	}, nil // no error = goes through}