diff --git a/pkg/nex/captcha.go b/pkg/nex/captcha.go new file mode 100644 index 0000000..80a7b24 --- /dev/null +++ b/pkg/nex/captcha.go @@ -0,0 +1,19 @@ +package nex + +import ( + "context" + + "git.solsynth.dev/hypernet/nexus/pkg/proto" +) + +func (v *Conn) ValidateCaptcha(token, ip string) bool { + client := proto.NewCaptchaServiceClient(v.nexusConn) + resp, err := client.CheckCaptcha(context.Background(), &proto.CheckCaptchaRequest{ + Token: token, + RemoteIp: ip, + }) + if err != nil { + return false + } + return resp.GetIsValid() +}