@@ -8,24 +8,27 @@ import (
88)
99
1010// arcaptchaApi arcaptcha verify API for captcha V2
11- const arcaptchaApi = "https://arcaptcha.ir /2/siteverify"
11+ const arcaptchaApi = "https://arcaptcha.co /2/siteverify"
1212
1313type Website struct {
1414 SiteKey string
1515 SecretKey string
1616}
1717
1818type verifyReq struct {
19- SiteKey string `json:"site_key"`
20- SecretKey string `json:"secret_key"`
21- ChallengeID string `json:"challenge_id"`
19+ SiteKey string `json:"sitekey"`
20+ SecretKey string `json:"secret"`
21+ Response string `json:"response"`
22+ RemoteIp string `json:"remoteip"`
2223}
2324
2425// VerifyResp represents verify API response
2526// error codes are available in https://docs.arcaptcha.ir/en/API/Verify
2627type VerifyResp struct {
27- Success bool `json:"success"`
28- ErrorCodes []string `json:"error-codes"`
28+ Success bool `json:"success"`
29+ ChallengeTS string `json:"challenge_ts,omitempty"`
30+ Hostname string `json:"hostname,omitempty"`
31+ ErrorCodes []string `json:"error-codes,omitempty"`
2932}
3033
3134// NewWebsite creates a new Website
@@ -40,11 +43,11 @@ func NewWebsite(siteKey, secretKey string) *Website {
4043//
4144// if an error occurs while sending or receiving the request, returns error.
4245// server side errors are available in VerifyResp.ErrorCodes.
43- func (w * Website ) Verify (token string ) (VerifyResp , error ) {
46+ func (w * Website ) Verify (response string ) (VerifyResp , error ) {
4447 data := & verifyReq {
45- SiteKey : w .SiteKey ,
46- SecretKey : w .SecretKey ,
47- ChallengeID : token ,
48+ SiteKey : w .SiteKey ,
49+ SecretKey : w .SecretKey ,
50+ Response : response ,
4851 }
4952 var resp VerifyResp
5053 err := sendRequest (http .MethodPost , arcaptchaApi , data , & resp )
0 commit comments