Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nestlab/google-recaptcha

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestlab/google-recaptcha - npm Package Compare versions

Comparing version 3.1.3 to 3.1.4

helpers/get-error-info.d.ts

2

decorators/recaptcha-result.js

@@ -16,6 +16,4 @@ "use strict";

.getContext().req) === null || _a === void 0 ? void 0 : _a.connection) === null || _b === void 0 ? void 0 : _b._httpMessage) === null || _c === void 0 ? void 0 : _c.req) === null || _d === void 0 ? void 0 : _d.recaptchaValidationResult;
default:
return null;
}
});
//# sourceMappingURL=recaptcha-result.js.map

@@ -42,3 +42,3 @@ "use strict";

const response = (options === null || options === void 0 ? void 0 : options.response)
? await (options === null || options === void 0 ? void 0 : options.response(request))
? await options.response(request)
: await this.options.response(request);

@@ -45,0 +45,0 @@ const score = (options === null || options === void 0 ? void 0 : options.score) || this.options.score;

{
"name": "@nestlab/google-recaptcha",
"version": "3.1.3",
"version": "3.1.4",
"description": "Google recaptcha module for NestJS.",
"keywords": [
"nest",
"nestjs",
"module",
"guard",
"google",
"recaptcha",
"captcha",
"google-recaptcha",
"nestjs captcha",
"nestjs recaptcha",
"graphql"
"google recaptcha",
"nestjs recaptcha"
],
"private": false,
"main": "index.js",
"module": "index.js",
"types": "index.d.ts",
"readme": "README.md",
"scripts": {

@@ -29,3 +19,3 @@ "build": "rimraf dist && tsc && cp package.json dist && cp README.md dist && cp LICENSE dist && cp CONTRIBUTING.md dist",

"test:cov": "jest --coverage",
"test:coveralls": "jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
"test:coveralls": "jest --runInBand --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},

@@ -53,6 +43,7 @@ "repository": {

"devDependencies": {
"@nestjs/apollo": "^10.0.22",
"@nestjs/axios": "^0.1.0",
"@nestjs/common": "^9.0.11",
"@nestjs/core": "^9.0.11",
"@nestjs/graphql": "^10.0.21",
"@nestjs/graphql": "^10.0.22",
"@nestjs/platform-express": "^9.0.11",

@@ -63,6 +54,9 @@ "@nestjs/testing": "^9.0.11",

"@types/node": "^18.7.6",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"apollo-server-express": "^3.10.2",
"coveralls": "^3.1.1",
"eslint": "^8.22.0",
"graphql": "^16.6.0",
"jest": "^28.1.3",

@@ -69,0 +63,0 @@ "reflect-metadata": "^0.1.13",

@@ -6,3 +6,3 @@ # Google recaptcha module

[![Circle CI build](https://img.shields.io/circleci/build/github/chvarkov/google-recaptcha/master)](https://github.com/chvarkov/google-recaptcha/tree/master)
[![Coverage Status](https://coveralls.io/repos/github/chvarkov/google-recaptcha/badge.svg?branch=master)](https://coveralls.io/github/chvarkov/google-recaptcha?branch=develop)
[![Coverage Status](https://coveralls.io/repos/github/chvarkov/google-recaptcha/badge.svg?branch=master)](https://coveralls.io/github/chvarkov/google-recaptcha?branch=master)

@@ -9,0 +9,0 @@ The [NestJS](https://docs.nestjs.com/) module to protect your endpoints via [google recaptcha](https://www.google.com/recaptcha/about/).

@@ -26,2 +26,3 @@ "use strict";

const rxjs_1 = require("rxjs");
const get_error_info_1 = require("../../helpers/get-error-info");
let GoogleRecaptchaEnterpriseValidator = class GoogleRecaptchaEnterpriseValidator extends abstract_google_recaptcha_validator_1.AbstractGoogleRecaptchaValidator {

@@ -39,10 +40,10 @@ constructor(http, logger, options, enterpriseReasonTransformer) {

const errors = [];
let success = result.tokenProperties.valid;
if (result.tokenProperties.invalidReason) {
errors.push(this.enterpriseReasonTransformer.transform(result.tokenProperties.invalidReason));
}
let success = (result === null || result === void 0 ? void 0 : result.tokenProperties.valid) || false;
if (errorDetails) {
errors.push(error_code_1.ErrorCode.UnknownError);
}
if (!result) {
if (result) {
if (result.tokenProperties.invalidReason) {
errors.push(this.enterpriseReasonTransformer.transform(result.tokenProperties.invalidReason));
}
if (!this.isValidAction(result.tokenProperties.action, options)) {

@@ -94,5 +95,5 @@ success = false;

.catch((err) => {
var _a, _b;
var _a;
if (this.options.debug) {
this.logger.debug(((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) || err.code || { error: `${err === null || err === void 0 ? void 0 : err.name}: ${err === null || err === void 0 ? void 0 : err.message}`, stack: err === null || err === void 0 ? void 0 : err.stack }, `${google_recaptcha_context_1.GoogleRecaptchaContext.GoogleRecaptchaEnterprise}.error`);
this.logger.debug((0, get_error_info_1.getErrorInfo)(err), `${google_recaptcha_context_1.GoogleRecaptchaContext.GoogleRecaptchaEnterprise}.error`);
}

@@ -103,3 +104,3 @@ const networkErrorCode = err.isAxiosError && err.code;

}
const errData = (_b = err.response) === null || _b === void 0 ? void 0 : _b.data;
const errData = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data;
return [null, errData];

@@ -106,0 +107,0 @@ });

@@ -27,2 +27,3 @@ "use strict";

const rxjs_1 = require("rxjs");
const get_error_info_1 = require("../../helpers/get-error-info");
let GoogleRecaptchaValidator = class GoogleRecaptchaValidator extends abstract_google_recaptcha_validator_1.AbstractGoogleRecaptchaValidator {

@@ -42,5 +43,12 @@ constructor(http, logger, options) {

const result = await this.verifyResponse(options.response);
const nativeResponse = Object.assign({}, result);
if (!this.isUseV3(result)) {
return result;
const resV2 = result;
return new recaptcha_verification_result_1.RecaptchaVerificationResult({
nativeResponse: resV2,
score: undefined,
action: undefined,
errors: resV2.errors,
success: resV2.success,
hostname: resV2.hostname,
});
}

@@ -55,2 +63,3 @@ if (!this.isValidAction(result.action, options)) {

}
const nativeResponse = Object.assign({}, result);
return new recaptcha_verification_result_1.RecaptchaVerificationResult({

@@ -88,5 +97,4 @@ nativeResponse: nativeResponse,

.catch((err) => {
var _a;
if (this.options.debug) {
this.logger.debug(((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) || err.code || { error: `${err === null || err === void 0 ? void 0 : err.name}: ${err === null || err === void 0 ? void 0 : err.message}`, stack: err === null || err === void 0 ? void 0 : err.stack }, `${google_recaptcha_context_1.GoogleRecaptchaContext.GoogleRecaptcha}.error`);
this.logger.debug((0, get_error_info_1.getErrorInfo)(err), `${google_recaptcha_context_1.GoogleRecaptchaContext.GoogleRecaptcha}.error`);
}

@@ -93,0 +101,0 @@ const networkErrorCode = err.isAxiosError && err.code;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc