* fix(localization): correct formatting of Swedish loading message * fix(main): correct formatting and improve readability in main.go * fix(challenge): add difficulty and policy rule hash to challenge metadata * docs(challenge): fix panic when validating challenges in privacy-mode browsers
25 lines
497 B
Go
25 lines
497 B
Go
package challengetest
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/TecharoHQ/anubis"
|
|
"github.com/TecharoHQ/anubis/internal"
|
|
"github.com/TecharoHQ/anubis/lib/challenge"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
func New(t *testing.T) *challenge.Challenge {
|
|
t.Helper()
|
|
|
|
id := uuid.Must(uuid.NewV7())
|
|
randomData := internal.SHA256sum(time.Now().String())
|
|
|
|
return &challenge.Challenge{
|
|
ID: id.String(),
|
|
RandomData: randomData,
|
|
IssuedAt: time.Now(),
|
|
Difficulty: anubis.DefaultDifficulty,
|
|
}
|
|
}
|