all repos — flounder @ eb5675cebd32825947b6db7260727b7d180b9452

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}