|
|
@ -20,6 +20,7 @@ package account
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"crypto/rand"
|
|
|
|
"crypto/rand"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/pagefaultgames/rogueserver/db"
|
|
|
|
"github.com/pagefaultgames/rogueserver/db"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -42,7 +43,7 @@ func Register(username, password string) error {
|
|
|
|
salt := make([]byte, ArgonSaltSize)
|
|
|
|
salt := make([]byte, ArgonSaltSize)
|
|
|
|
_, err = rand.Read(salt)
|
|
|
|
_, err = rand.Read(salt)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf(fmt.Sprintf("failed to generate salt: %s", err))
|
|
|
|
return fmt.Errorf("failed to generate salt: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
err = db.AddAccountRecord(uuid, username, deriveArgon2IDKey([]byte(password), salt), salt)
|
|
|
|
err = db.AddAccountRecord(uuid, username, deriveArgon2IDKey([]byte(password), salt), salt)
|
|
|
|