Fix challenge validation panic when follow-up hits ALLOW (#1278)
* 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
This commit is contained in:
parent
68fcc0c44f
commit
97ba84e26d
7 changed files with 126 additions and 23 deletions
|
|
@ -4,10 +4,12 @@ import "time"
|
|||
|
||||
// Challenge is the metadata about a single challenge issuance.
|
||||
type Challenge struct {
|
||||
ID string `json:"id"` // UUID identifying the challenge
|
||||
Method string `json:"method"` // Challenge method
|
||||
RandomData string `json:"randomData"` // The random data the client processes
|
||||
IssuedAt time.Time `json:"issuedAt"` // When the challenge was issued
|
||||
Metadata map[string]string `json:"metadata"` // Challenge metadata such as IP address and user agent
|
||||
Spent bool `json:"spent"` // Has the challenge already been solved?
|
||||
ID string `json:"id"` // UUID identifying the challenge
|
||||
Method string `json:"method"` // Challenge method
|
||||
RandomData string `json:"randomData"` // The random data the client processes
|
||||
IssuedAt time.Time `json:"issuedAt"` // When the challenge was issued
|
||||
Metadata map[string]string `json:"metadata"` // Challenge metadata such as IP address and user agent
|
||||
Spent bool `json:"spent"` // Has the challenge already been solved?
|
||||
Difficulty int `json:"difficulty,omitempty"` // Difficulty that was in effect when issued
|
||||
PolicyRuleHash string `json:"policyRuleHash,omitempty"` // Hash of the policy rule that issued this challenge
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/TecharoHQ/anubis"
|
||||
"github.com/TecharoHQ/anubis/internal"
|
||||
"github.com/TecharoHQ/anubis/lib/challenge"
|
||||
"github.com/google/uuid"
|
||||
|
|
@ -19,5 +20,6 @@ func New(t *testing.T) *challenge.Challenge {
|
|||
ID: id.String(),
|
||||
RandomData: randomData,
|
||||
IssuedAt: time.Now(),
|
||||
Difficulty: anubis.DefaultDifficulty,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue