Initial commit

This commit is contained in:
George Suntres
2026-03-29 12:31:04 -04:00
commit ec429adb87
11 changed files with 899 additions and 0 deletions

41
encrypt_test.go Normal file
View File

@@ -0,0 +1,41 @@
package persist
import (
"testing"
)
func TestUser_EncryptPassword(t *testing.T) {
u := &User{
Password: "1234",
}
encrypted := u.EncryptPassword()
if u.Password != encrypted {
t.Fatal("Failed to encrypt password")
}
}
func TestUser_CheckPassword(t *testing.T) {
u := &User{
Password: "1234",
}
u.EncryptPassword()
if !u.CheckPassword("1234") {
t.Fatal("Failed to check password")
}
}
func TestUser_CheckPassword_FalsePositive(t *testing.T) {
u := &User{
Password: "1234",
}
u.EncryptPassword()
if u.CheckPassword("!234") {
t.Fatal("Should have not accepted password")
}
}