Skip to content

Releases: chvarkov/google-recaptcha

v3.1.9

22 Sep 11:17
e6755cd
Compare
Choose a tag to compare
  • declared used axios package as peerDependency.

v3.1.8

21 Sep 12:18
4da41d5
Compare
Choose a tag to compare
  • fixed async module options type in ts strict mode.
  • declared used rxjs package as peerDependency.

v3.1.7

07 Sep 20:59
4fc1165
Compare
Choose a tag to compare
  • Smallfix with logging recaptcha results.
  • Fixed resolving error codes for enterprise validator.

v3.1.6

06 Sep 21:34
796e005
Compare
Choose a tag to compare
  • Fixed handling enterprise response without token properties info.

v3.1.5

01 Sep 18:17
35ce7fa
Compare
Choose a tag to compare
  • Fixed recaptcha enterprise error handling.

v3.1.4

27 Aug 23:14
c262490
Compare
Choose a tag to compare
  • Fixed instance of response for recaptcha v2.
  • Fixed error handling for recaptcha enterprise.
  • Internal fixes.
  • Test coverage.

v3.1.3

25 Aug 20:20
d858418
Compare
Choose a tag to compare
  • Fixed response type for RecaptchaVerificationResult.getEnterpriseRiskAnalytics()

v3.1.2

21 Aug 10:27
49fc1b5
Compare
Choose a tag to compare
  • Fixed http exception statuses for error codes: site-mismatch, browser-error (HTTP status - 400).
  • Added error code: incorrect-captcha-sol.

v3.1.1

17 Aug 14:59
17560f2
Compare
Choose a tag to compare
  • Minor type fixes by eslint rules.
  • Fixes in: README.md, package.json.

v3.1.0

15 Aug 16:12
4ee5054
Compare
Choose a tag to compare

Added support reCAPTCHA Enterprise API.

Updated module options:

  • Updated secretKey as optional (shouldn't use for enterprise configuration).
  • Added enterprise option
Property Description
enterprise.projectId Required.
Type: string
Google Cloud project ID
enterprise.siteKey Required.
Type: string
reCAPTCHA key associated with the site/app.
enterprise.apiKey Required.
Type: string
API key associated with the current project.
Must have permission reCAPTCHA Enterprise API.
You can manage credentials here.

Updated GoogleRecaptchaValidator interface

class GoogleRecaptchaValidator {
    validate(options: VerifyResponseOptions): Promise<RecaptchaVerificationResult<VerifyResponseV3>>;
}

Addded recaptcha validator for enterprise

@Injectable()
export class SomeService {
    constructor(private readonly recaptchaEnterpriseValidator: GoogleRecaptchaEnterpriseValidator) {
    }

    async someAction(recaptchaToken: string): Promise<void> {
        const result = await this.recaptchaEnterpriseValidator.validate({
            response: recaptchaToken,
            score: 0.8,
            action: 'SomeAction',
        });
        
        if (!result.success) {
            throw new GoogleRecaptchaException(result.errors);
        }
        
        const riskAnalytics = result.getEnterpriseRiskAnalytics();
        
        console.log('score', riskAnalysis.score);
        console.log('score', riskAnalysis.reasons);

        // TODO: Your implemetation
    }
}