initial commit

This commit is contained in:
Patrick Nagurny
2018-10-19 15:31:41 -04:00
commit e2dd29259f
203 changed files with 44839 additions and 0 deletions

26
core/util/bcrypt.go Normal file
View File

@@ -0,0 +1,26 @@
package util
import (
"golang.org/x/crypto/bcrypt"
)
type Bcrypt interface {
GenerateFromPassword([]byte, int) ([]byte, error)
CompareHashAndPassword([]byte, []byte) error
GetDefaultCost() int
}
type StandardBcrypt struct {
}
func (bc *StandardBcrypt) GenerateFromPassword(password []byte, cost int) ([]byte, error) {
return bcrypt.GenerateFromPassword(password, cost)
}
func (bc *StandardBcrypt) CompareHashAndPassword(hashedPassword, password []byte) error {
return bcrypt.CompareHashAndPassword(hashedPassword, password)
}
func (bc *StandardBcrypt) GetDefaultCost() int {
return bcrypt.DefaultCost
}