2.0.0 • Published 2 years ago

@evokegroup/recaptcha v2.0.0

Weekly downloads
1
License
ISC
Repository
bitbucket
Last release
2 years ago

@evokegroup/recaptcha

Utility class for verifying reCAPTCHA challenges

Class: Recaptcha

Static Methods

Recaptcha.verify(secret, response) ⇒ Promise<Recaptcha.Response>

Verifies the reCAPTCHA challenge response using the secret key

ParameterTypeDescription
secretstringThe reCAPTCHA secret key
responsestringThe reCAPTCHA challenge response

Usage

const Recaptcha = require('@evokegroup/recaptcha');

Recaptcha.verify('mysecret', 'challengeResponse')
.then((response) => {
  if (response.success) {
    // Do something
  } else {
    // Invalid
  }
})
.catch((ex) => {
  console.log(ex);
});

Class: Recaptcha.Response

constructor(webRequestResponse)

Properties

PropertyTypeDescription
successbooleanIndicates if the challenge response was valid
resultobjectThe result object returned from the reCAPTCHA API call
responseobjectThe web request response object
exceptionErrorAny exception that occurred
2.0.0

2 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago