summary refs log tree commit diff stats
path: root/auth/checkpass.go
blob: 64e3c9f53c24dd9a4c5abef9a522f9ff8aeed2f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package auth

import (
	"golang.org/x/crypto/bcrypt"
)

// checkPass takes a string and hash as input and returns an error. If
// the error is not nil then the consider the password wrong. We're
// returning error instead of a bool so that we can print failed
// logins to log and logging shouldn't happen here.
func checkPass(password, hash string) error {
	err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
	return err
}