adding some debug
This commit is contained in:
parent
7114af9d8c
commit
2eb3fb4828
|
@ -4,6 +4,7 @@ import (
|
||||||
"crypto/subtle"
|
"crypto/subtle"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/oklog/ulid/v2"
|
"github.com/oklog/ulid/v2"
|
||||||
|
@ -13,7 +14,7 @@ import (
|
||||||
const (
|
const (
|
||||||
scryptN = 32768
|
scryptN = 32768
|
||||||
scryptR = 8
|
scryptR = 8
|
||||||
scryptP = 1
|
scryptP = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
|
@ -32,6 +33,7 @@ type Login struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func derive(password string, salt []byte) ([]byte, error) {
|
func derive(password string, salt []byte) ([]byte, error) {
|
||||||
|
fmt.Println("deriving")
|
||||||
return scrypt.Key([]byte(password), salt, scryptN, scryptR, scryptN, 32)
|
return scrypt.Key([]byte(password), salt, scryptN, scryptR, scryptN, 32)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +75,7 @@ func (u *User) Register(login *Login) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("key derivation failed: %w", err)
|
return fmt.Errorf("key derivation failed: %w", err)
|
||||||
}
|
}
|
||||||
|
log.Println("underived")
|
||||||
|
|
||||||
u.Created = time.Now().Unix()
|
u.Created = time.Now().Unix()
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue