fix: correct ALTCHA CreateChallenge API call to use ChallengeOptions struct
This commit is contained in:
parent
db0e3dfb59
commit
a5f20439bf
|
|
@ -49,8 +49,14 @@ func (s *AltchaService) VerifyToken(token, remoteIP string) (*AltchaResponse, er
|
||||||
// GenerateChallenge creates a new ALTCHA challenge using the official library
|
// GenerateChallenge creates a new ALTCHA challenge using the official library
|
||||||
func (s *AltchaService) GenerateChallenge() (map[string]interface{}, error) {
|
func (s *AltchaService) GenerateChallenge() (map[string]interface{}, error) {
|
||||||
// Generate challenge using official ALTCHA library
|
// Generate challenge using official ALTCHA library
|
||||||
// Parameters: hmacKey, maxNumber (difficulty), saltLength, algorithm, expiresInSeconds
|
options := altcha.ChallengeOptions{
|
||||||
challenge, err := altcha.CreateChallenge(s.secretKey, 100000, 12, "SHA-256", 300)
|
Algorithm: altcha.AlgorithmSHA256,
|
||||||
|
MaxNumber: 100000,
|
||||||
|
SaltLength: 12,
|
||||||
|
HMACKey: s.secretKey,
|
||||||
|
}
|
||||||
|
|
||||||
|
challenge, err := altcha.CreateChallenge(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue