all repos — flounder @ 02f6ab33ee8df5a395fa7ee824e85a8e833b6841

A small site builder for the Gemini protocol

auth.go (view raw)

 1package main
 2
 3import "golang.org/x/crypto/bcrypt"
 4
 5func checkAuth(user string, password string) error {
 6	var actualPass []byte
 7	row := DB.QueryRow("SELECT password_hash FROM user where username = ?", user)
 8	err := row.Scan(&actualPass)
 9	if err != nil {
10		return err
11	}
12	err = bcrypt.CompareHashAndPassword(actualPass, []byte(password))
13	return err
14}