Add user authentication helpers

This commit is contained in:
Matt Baer
2015-07-29 17:40:41 -04:00
parent a4eeea7469
commit 2054237757
2 changed files with 42 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package auth
import "testing"
const pass = "password"
var hash []byte
func TestHash(t *testing.T) {
var err error
hash, err = HashPass([]byte(pass))
if err != nil {
t.Error("Password hash failed.")
}
}
func TestAuth(t *testing.T) {
if !Authenticated(hash, []byte(pass)) {
t.Error("Didn't authenticate.")
}
}