Releases: chvarkov/google-recaptcha
Releases · chvarkov/google-recaptcha
v3.1.9
v3.1.8
v3.1.7
v3.1.6
v3.1.5
v3.1.4
v3.1.3
v3.1.2
v3.1.1
v3.1.0
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
}
}