Lightweight and easily self-hostable Git forge. git.poy.ooo
git-forge selfhosting homebrew
Something went wrong. Try again.
1234567891011121314151617181920212223242526package ssh
import ( "farga/db"
"golang.org/x/crypto/ssh")
const userIDKey = "user_id"const userHandleKey = "user_handle"
func AuthenticatePublicKey(d *db.DB, conn ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) { fingerprint := ssh.FingerprintSHA256(key) user, err := d.GetUserByFingerprint(fingerprint) if err != nil { return nil, err }
return &ssh.Permissions{ Extensions: map[string]string{ userIDKey: user.ID.String(), userHandleKey: user.Handle, }, }, nil}