all repos — flounder @ 28a9a4a408c7eaa482ea32e27e80c6e87eb67d62

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}