12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849(**************************************************************************)(* *)(* Copyright 2018-2023 OCamlPro *)(* *)(* All rights reserved. This file is distributed under the terms of the *)(* GNU Lesser General Public License version 2.1, with the special *)(* exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)typerecaptcha={cap_success:bool;cap_score:floatoption;cap_action:stringoption;cap_challenge_ts:stringoption;cap_hostname:stringoption;cap_error_codes:stringlistoption}moduleEncoding=structopenJson_encodingletcaptcha=conv(fun{cap_success;cap_score;cap_action;cap_challenge_ts;cap_hostname;cap_error_codes}->(cap_success,cap_score,cap_action,cap_challenge_ts,cap_hostname,cap_error_codes))(fun(cap_success,cap_score,cap_action,cap_challenge_ts,cap_hostname,cap_error_codes)->{cap_success;cap_score;cap_action;cap_challenge_ts;cap_hostname;cap_error_codes})(obj6(req"success"bool)(opt"score"float)(opt"action"string)(opt"challenge_ts"string)(opt"hostname"string)(opt"error-codes"(liststring)))endletrecaptcha_url="https://www.google.com/recaptcha/api/siteverify"letverifysecret_keytoken=leturl=EzAPI.URL(recaptcha_url^"?secret="^secret_key^"&response="^token)inLwt.map(functionErrore->Errore|Okx->Ok(EzEncoding.destructEncoding.captchax))(EzReq_lwt.posturl)