New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nestlab/google-recaptcha

Package Overview
Dependencies
Maintainers
1
Versions
73
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 1.0.13 to 1.0.14

exceptions/google-recaptcha.exception.d.ts

4

guards/google-recaptcha.guard.d.ts

@@ -1,5 +0,4 @@

import { CanActivate, ExecutionContext, HttpException } from '@nestjs/common';
import { CanActivate, ExecutionContext } from '@nestjs/common';
import { GoogleRecaptchaValidator } from '../services/google-recaptcha.validator';
import { GoogleRecaptchaGuardOptions } from '../interfaces/google-recaptcha-guard-options';
import { ErrorCode } from '../enums/error-code';
export declare class GoogleRecaptchaGuard implements CanActivate {

@@ -10,3 +9,2 @@ private readonly validator;

canActivate(context: ExecutionContext): Promise<true | never>;
errorHandler(errorCodes: ErrorCode[]): string | HttpException;
}

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

const provider_declarations_1 = require("../provider.declarations");
const error_code_1 = require("../enums/error-code");
const google_recaptcha_exception_1 = require("../exceptions/google-recaptcha.exception");
let GoogleRecaptchaGuard = class GoogleRecaptchaGuard {

@@ -37,30 +37,4 @@ constructor(validator, options) {

}
const error = this.options.onError
? this.options.onError(result.errors)
: this.errorHandler(result.errors);
if (error instanceof Error) {
throw error;
}
throw new common_1.BadRequestException(error);
throw new google_recaptcha_exception_1.GoogleRecaptchaException(result.errors);
}
errorHandler(errorCodes) {
const first = errorCodes.shift();
switch (first) {
case error_code_1.ErrorCode.MissingInputSecret:
return 'The secret parameter is missing.';
case error_code_1.ErrorCode.InvalidInputSecret:
return 'The secret parameter is invalid or malformed.';
case error_code_1.ErrorCode.MissingInputResponse:
return 'The response parameter is missing.';
case error_code_1.ErrorCode.InvalidInputResponse:
return 'The response parameter is invalid or malformed.';
case error_code_1.ErrorCode.BadRequest:
return 'The request is invalid or malformed.';
case error_code_1.ErrorCode.TimeoutOrDuplicate:
return 'The response is no longer valid: either is too old or has been used previously.';
case error_code_1.ErrorCode.UnknownError:
default:
return new common_1.BadGatewayException('Unknown error when checking captcha.');
}
}
};

@@ -67,0 +41,0 @@ GoogleRecaptchaGuard = __decorate([

@@ -6,2 +6,1 @@ export { Recaptcha } from './decorators/recaptcha';

export { ErrorCode } from './enums/error-code';
export { ErrorHandler } from './types';

@@ -1,6 +0,4 @@

import { ErrorHandler } from '../types';
export interface GoogleRecaptchaGuardOptions {
response: (req: any) => string | Promise<string>;
skipIf?: () => boolean | Promise<boolean>;
onError?: ErrorHandler;
}

@@ -1,5 +0,3 @@

import { ErrorHandler } from '../types';
export interface GoogleRecaptchaValidatorOptions {
secretKey: string;
onError?: ErrorHandler;
}
{
"name": "@nestlab/google-recaptcha",
"version": "1.0.13",
"version": "1.0.14",
"description": "Google recaptcha module for NestJS.",

@@ -5,0 +5,0 @@ "keywords": [

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