-
Support NestJS 11. Upgraded peer dependencies versions:
@nestjs/common
: >=8.0.0 <12.0.0@nestjs/core
: >=8.0.0 <12.0.0
-
Fixed getting
networkErrorCode
fromAxiosError
-
Upgraded axios 1.7.4 => 1.7.7
- Updated
GoogleRecaptchaModuleAsyncOptions
interface
- Added
RecaptchaConfigRef
for dynamic configuration
- Added
remoteIp?: (req) => string
option into:- Module options
- Decorator options to override default
- Validator options
- Added
global?: boolean
module option
- Fixed import LiteralObject for NestJS 10
- Upgraded peer dependencies versions:
@nestjs/common
: >=8.0.0 <11.0.0@nestjs/core
: >=8.0.0 <11.0.0
- Reworked readme docs.
- Added changelog file.
- Reworked to use axios instead of @nestjs/axios.
- Removed peer dependencies:
@nestjs/axios
rxjs
- Upgraded peer dependencies versions:
@nestjs/axios
: >=1.0.0 <2.0.0axios
: >=1.0.0 <2.0.0
- Declared used axios package as peerDependency.
- Fixed async module options type in ts strict mode.
- Declared used
rxjs
package as peerDependency.
- Smallfix with logging recaptcha results.
- Fixed resolving error codes for enterprise validator.
- Fixed handling enterprise response without token properties info.
- Fixed recaptcha enterprise error handling.
- Fixed instance of response for recaptcha v2.
- Fixed error handling for recaptcha enterprise.
- Internal fixes.
- Test coverage.
- Fixed response type for
RecaptchaVerificationResult.getEnterpriseRiskAnalytics()
.
- Fixed http exception statuses for error codes:
site-mismatch
,browser-error
(HTTP status - 400). - Added error code:
incorrect-captcha-sol
.
- Minor type fixes by eslint rules.
- Fixes in: README.md, package.json.
- Added support reCAPTCHA Enterprise API.
- Updated module options:
- Updated
secretKey
as optional (shouldn't use for enterprise configuration). - Added
enterprise
option
- Updated
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
}
}
- Updated README.md.
- Added debug mode and logging
- Added module options
debug?: boolean
enables debug modelogger?: Logger
instance of Logger from @nestjs/common or extended from this
- Fixed published root dir
- Compat with NestJS 9
- Removed deprecated options:
applicationType?: ApplicationType
(now detect it automatically)agent?: https.Agent
(use option axiosConfig.httpsAgent)
- Fixed decorators reexports
- Removed source maps. Little fixes in readme file.
- Added request type auto detection from execution context
applicationType
configuration option marked as deprecated. Will removed in next major release.
- Fixed README.md.
- Added axiosConfig: AxiosRequestConfig option.
- Option agent?: https.Agent marked as deprecated.
- Added GoogleRecaptchaNetworkException.
- Added support NestJS 8.
- Dynamic loading HttpModule from
@nestjs/axios
or@nestjs/common
.
- Fixed dynamic module loading.
- Added
RecaptchaResult
decorator.
- Added
SetRecaptchaOptions
decorator.
- Added error handling for invalid-keys.
- Removed console.log
- Added validation by action and score for reCAPTCHA v3.
- Updated external interfaces. Affected places:
- service GoogleRecaptchaValidator
- decorator Recaptcha
- module options (added optional default parameters)
- Fixed readme.
- Updated readme. Added example to use validation in service.
- Added support GraphQL.
- Added LICENSE, CONTRIBUTING.md to build. Fixed readme.
- Updated google recaptcha module options.
- Removed option useRecaptchaNet: boolean
- Added option: network: GoogleRecaptchaNetwork | string
If your server has trouble connecting to 'https://google.com' then you can set networks:
GoogleRecaptchaNetwork.Google = 'https://www.google.com/recaptcha/api/siteverify'
GoogleRecaptchaNetwork.Recaptcha = 'https://recaptcha.net/recaptcha/api/siteverify' or set any api url
Removed unused dev dependencies. Updated readme.
- Extended peer dependencies versions:
- @nestjs/core: >=6.0.0 <8.0.0
- @nestjs/common: >=6.0.0 <8.0.0
- Fixed global option for
forRootAsync
method.
- Module declared as global.
- Fixed readme.md file.
- Updated
skipIf
option toboolean | ((request: any) => boolean | Promise<boolean>)
- Updated skipIf argument from
() => boolean
to(request) => boolean | Promise<boolean>
.
- Added option to use recaptcha.net and agent support.
- Async module initialization.
- Added override ability default recaptcha property.
- Updated
GoogleRecaptchaException
.
- Added
GoogleRecaptchaException
. Error handling via exception filter.
- Reexported types