all repos — flounder @ 387022cd436c13689c7b455a3040dc5eb89e2ac1

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}