Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x 1x 1x 1x | /** * @module captcha */ const got = require('got'); /** * Verify reCAPTCHA response via Google reCAPTCHA API. * Return true if successfully verified. * @param {String} captchaResponse * @return {Boolean} true if verified */ const verifyResponse = async (captchaResponse) => { const {body} = await got.post("https://www.google.com/recaptcha/api/siteverify", { responseType: "json", searchParams: { secret: process.env.GOOGLE_RECAPTCHA_SECRET, response: captchaResponse, }, }); return body.success; }; module.exports = { verifyResponse, }; |