Something went wrong. Try again.
Lightweight and easily self-hostable Git forge.
Something went wrong. Try again.
123456789101112131415161718192021222324package ssh
import ( "golang.org/x/crypto/ssh")
const userIDKey = "user_id"const userHandleKey = "user_handle"
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 { return nil, err }
return &ssh.Permissions{ Extensions: map[string]string{ userIDKey: user.ID.String(), userHandleKey: user.Handle, }, }, nil}