perimeterx-js-core 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -15
- package/lib/action/Action.d.ts +6 -0
- package/lib/action/Action.js +7 -0
- package/lib/action/ActionData.d.ts +11 -0
- package/lib/action/ActionData.js +1 -0
- package/lib/action/ActionPriorityOrder.d.ts +2 -0
- package/lib/action/ActionPriorityOrder.js +7 -0
- package/lib/action/Decision.d.ts +6 -0
- package/lib/action/Decision.js +1 -0
- package/lib/action/index.d.ts +4 -0
- package/lib/action/index.js +4 -0
- package/lib/activities/ActivityType.js +2 -5
- package/lib/activities/HttpActivityClient.d.ts +7 -7
- package/lib/activities/HttpActivityClient.js +46 -95
- package/lib/activities/HttpBatchedActivityClient.d.ts +2 -2
- package/lib/activities/HttpBatchedActivityClient.js +46 -115
- package/lib/activities/IActivityClient.d.ts +3 -3
- package/lib/activities/IActivityClient.js +1 -2
- package/lib/activities/constants.js +1 -4
- package/lib/activities/index.d.ts +7 -6
- package/lib/activities/index.js +7 -9
- package/lib/activities/model/Activity.js +1 -2
- package/lib/activities/model/ActivityDetails.d.ts +9 -7
- package/lib/activities/model/ActivityDetails.js +1 -2
- package/lib/activities/model/index.d.ts +2 -0
- package/lib/activities/model/index.js +2 -0
- package/lib/activities/utils.d.ts +11 -8
- package/lib/activities/utils.js +65 -43
- package/lib/additional_activity_handler/AdditionalActivityHandler.d.ts +2 -2
- package/lib/additional_activity_handler/AdditionalActivityHandler.js +1 -2
- package/lib/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +2 -2
- package/lib/additional_activity_handler/AdditionalActivityHandlerUtils.js +11 -53
- package/lib/additional_activity_handler/index.d.ts +2 -2
- package/lib/additional_activity_handler/index.js +2 -5
- package/lib/{block_handler → blocker}/BlockAction.d.ts +0 -1
- package/lib/blocker/BlockAction.js +6 -0
- package/lib/blocker/BlockActionToProductMap.d.ts +3 -0
- package/lib/blocker/BlockActionToProductMap.js +7 -0
- package/lib/blocker/BlockActionToWordMap.d.ts +2 -0
- package/lib/blocker/BlockActionToWordMap.js +6 -0
- package/lib/blocker/IBlocker.d.ts +5 -0
- package/lib/blocker/IBlocker.js +1 -0
- package/lib/blocker/IConditionalBlocker.d.ts +9 -0
- package/lib/blocker/IConditionalBlocker.js +1 -0
- package/lib/blocker/index.d.ts +5 -0
- package/lib/blocker/index.js +5 -0
- package/lib/config/ConfigurationParams.d.ts +20 -12
- package/lib/config/ConfigurationParams.js +1 -2
- package/lib/config/DefaultConfigurations.d.ts +1 -1
- package/lib/config/DefaultConfigurations.js +15 -13
- package/lib/config/IConfiguration.d.ts +103 -10
- package/lib/config/IConfiguration.js +1 -2
- package/lib/config/StaticConfigurationBase.d.ts +29 -6
- package/lib/config/StaticConfigurationBase.js +244 -394
- package/lib/config/index.js +2 -7
- package/lib/context/DefaultContext.d.ts +46 -0
- package/lib/context/DefaultContext.js +82 -0
- package/lib/context/index.d.ts +2 -4
- package/lib/context/index.js +2 -20
- package/lib/context/interfaces/IContext.d.ts +111 -0
- package/lib/context/interfaces/IContext.js +1 -0
- package/lib/context/interfaces/MobileData.d.ts +23 -0
- package/lib/context/interfaces/MobileData.js +1 -0
- package/lib/context/interfaces/ReadonlyContext.d.ts +3 -0
- package/lib/context/interfaces/ReadonlyContext.js +1 -0
- package/lib/context/interfaces/RequestData.d.ts +41 -0
- package/lib/context/interfaces/RequestData.js +1 -0
- package/lib/context/interfaces/RiskApiData.d.ts +27 -0
- package/lib/context/interfaces/RiskApiData.js +1 -0
- package/lib/context/interfaces/ServerData.d.ts +18 -0
- package/lib/context/interfaces/ServerData.js +1 -0
- package/lib/context/interfaces/TlsData.d.ts +30 -0
- package/lib/context/interfaces/TlsData.js +1 -0
- package/lib/context/interfaces/TokenData.d.ts +16 -0
- package/lib/context/interfaces/TokenData.js +1 -0
- package/lib/context/interfaces/index.d.ts +8 -0
- package/lib/context/interfaces/index.js +8 -0
- package/lib/cors/CustomBlockResponseHeadersHandler.d.ts +2 -2
- package/lib/cors/CustomBlockResponseHeadersHandler.js +1 -2
- package/lib/cors/CustomPreflightHandler.d.ts +2 -2
- package/lib/cors/CustomPreflightHandler.js +1 -2
- package/lib/cors/DefaultCors.d.ts +9 -9
- package/lib/cors/DefaultCors.js +39 -87
- package/lib/cors/ICors.d.ts +7 -7
- package/lib/cors/ICors.js +1 -2
- package/lib/cors/constants.js +2 -5
- package/lib/cors/index.js +2 -20
- package/lib/custom_parameters/CustomParameters.js +1 -2
- package/lib/custom_parameters/CustomParametersFunction.d.ts +1 -2
- package/lib/custom_parameters/CustomParametersFunction.js +1 -2
- package/lib/custom_parameters/CustomParametersUtils.d.ts +2 -2
- package/lib/custom_parameters/CustomParametersUtils.js +18 -60
- package/lib/custom_parameters/index.js +1 -5
- package/lib/enforcer/EnforcerBase.d.ts +43 -85
- package/lib/enforcer/EnforcerBase.js +120 -411
- package/lib/enforcer/IEnforcer.js +1 -2
- package/lib/enforcer/index.d.ts +2 -1
- package/lib/enforcer/index.js +2 -5
- package/lib/enforcer/options/EnforcerBaseOptions.d.ts +25 -0
- package/lib/enforcer/options/EnforcerBaseOptions.js +1 -0
- package/lib/enforcer/options/EnforcerOptionsType.d.ts +4 -0
- package/lib/enforcer/options/EnforcerOptionsType.js +1 -0
- package/lib/enforcer/options/EnforcerV2Options.d.ts +5 -0
- package/lib/enforcer/options/EnforcerV2Options.js +1 -0
- package/lib/enforcer/options/EnforcerV3Options.d.ts +7 -0
- package/lib/enforcer/options/EnforcerV3Options.js +1 -0
- package/lib/enforcer/options/index.d.ts +4 -0
- package/lib/enforcer/options/index.js +4 -0
- package/lib/filter/FilterReason.d.ts +2 -1
- package/lib/filter/FilterReason.js +3 -5
- package/lib/filter/IFilter.d.ts +4 -4
- package/lib/filter/IFilter.js +1 -2
- package/lib/filter/index.d.ts +2 -3
- package/lib/filter/index.js +2 -7
- package/lib/first_party/FirstPartyData.d.ts +5 -0
- package/lib/first_party/FirstPartyData.js +1 -0
- package/lib/first_party/IFirstParty.d.ts +5 -5
- package/lib/first_party/IFirstParty.js +1 -2
- package/lib/first_party/index.d.ts +2 -4
- package/lib/first_party/index.js +2 -21
- package/lib/graphql/DefaultGraphQLParser.d.ts +6 -5
- package/lib/graphql/DefaultGraphQLParser.js +77 -133
- package/lib/graphql/IGraphQLParser.d.ts +5 -4
- package/lib/graphql/IGraphQLParser.js +1 -2
- package/lib/graphql/index.d.ts +3 -5
- package/lib/graphql/index.js +3 -7
- package/lib/graphql/model/GraphQLData.js +1 -2
- package/lib/graphql/model/GraphQLOperation.js +1 -2
- package/lib/graphql/model/GraphQLOperationType.js +2 -5
- package/lib/graphql/model/index.d.ts +3 -0
- package/lib/graphql/model/index.js +3 -0
- package/lib/http/impl/FormDataImpl.d.ts +12 -0
- package/lib/http/impl/FormDataImpl.js +36 -0
- package/lib/http/impl/MinimalResponseImpl.d.ts +3 -3
- package/lib/http/impl/MinimalResponseImpl.js +3 -8
- package/lib/http/impl/OutgoingRequestImpl.d.ts +3 -3
- package/lib/http/impl/OutgoingRequestImpl.js +5 -10
- package/lib/http/impl/index.d.ts +1 -0
- package/lib/http/impl/index.js +4 -19
- package/lib/http/impl/phin/PhinHttpClient.js +30 -70
- package/lib/http/impl/phin/PhinIncomingResponse.d.ts +4 -5
- package/lib/http/impl/phin/PhinIncomingResponse.js +22 -70
- package/lib/http/impl/phin/index.js +2 -18
- package/lib/http/index.js +3 -19
- package/lib/http/interfaces/IBody.d.ts +10 -12
- package/lib/http/interfaces/IBody.js +1 -2
- package/lib/http/interfaces/IFormData.d.ts +9 -0
- package/lib/http/interfaces/IFormData.js +1 -0
- package/lib/http/interfaces/IHeaders.js +1 -2
- package/lib/http/interfaces/IHttpClient.js +1 -2
- package/lib/http/interfaces/IIncomingRequest.d.ts +10 -6
- package/lib/http/interfaces/IIncomingRequest.js +1 -2
- package/lib/http/interfaces/IIncomingResponse.d.ts +2 -2
- package/lib/http/interfaces/IIncomingResponse.js +1 -2
- package/lib/http/interfaces/IMinimalResponse.d.ts +2 -2
- package/lib/http/interfaces/IMinimalResponse.js +1 -2
- package/lib/http/interfaces/IOutgoingRequest.d.ts +2 -2
- package/lib/http/interfaces/IOutgoingRequest.js +1 -2
- package/lib/http/interfaces/IOutgoingResponse.d.ts +5 -1
- package/lib/http/interfaces/IOutgoingResponse.js +1 -2
- package/lib/http/interfaces/IURL.d.ts +6 -0
- package/lib/http/interfaces/IURL.js +1 -0
- package/lib/http/interfaces/ReadonlyHeaders.d.ts +6 -0
- package/lib/http/interfaces/ReadonlyHeaders.js +14 -0
- package/lib/http/interfaces/index.d.ts +3 -1
- package/lib/http/interfaces/index.js +11 -25
- package/lib/http/utils/ContentType.js +2 -5
- package/lib/http/utils/HttpMethod.js +2 -5
- package/lib/http/utils/MinimalResponseUtils.d.ts +6 -6
- package/lib/http/utils/MinimalResponseUtils.js +31 -48
- package/lib/http/utils/MultipartFormDataUtils.d.ts +6 -0
- package/lib/http/utils/MultipartFormDataUtils.js +45 -0
- package/lib/http/utils/constants.js +9 -12
- package/lib/http/utils/index.d.ts +3 -1
- package/lib/http/utils/index.js +5 -21
- package/lib/index.d.ts +4 -1
- package/lib/index.js +22 -35
- package/lib/logger/DefaultLogger.js +7 -28
- package/lib/logger/ILogger.js +1 -2
- package/lib/logger/LoggerBase.d.ts +2 -0
- package/lib/logger/LoggerBase.js +24 -22
- package/lib/logger/LoggerSeverity.js +2 -5
- package/lib/logger/index.js +3 -9
- package/lib/phase/IPhase.d.ts +5 -0
- package/lib/phase/IPhase.js +1 -0
- package/lib/phase/PhaseResult.d.ts +5 -0
- package/lib/phase/PhaseResult.js +1 -0
- package/lib/phase/flow/EnforceFlow.d.ts +6 -0
- package/lib/phase/flow/EnforceFlow.js +15 -0
- package/lib/phase/flow/FilterFlow.d.ts +6 -0
- package/lib/phase/flow/FilterFlow.js +12 -0
- package/lib/phase/flow/PostEnforceFlow.d.ts +6 -0
- package/lib/phase/flow/PostEnforceFlow.js +10 -0
- package/lib/phase/flow/index.d.ts +3 -0
- package/lib/phase/flow/index.js +3 -0
- package/lib/phase/impl/AdditionalActivityHandlerPhase.d.ts +9 -0
- package/lib/phase/impl/AdditionalActivityHandlerPhase.js +22 -0
- package/lib/phase/impl/CompositePhase.d.ts +8 -0
- package/lib/phase/impl/CompositePhase.js +26 -0
- package/lib/phase/impl/CreateBlockResponsePhase.d.ts +17 -0
- package/lib/phase/impl/CreateBlockResponsePhase.js +60 -0
- package/lib/phase/impl/DecideActionPhase.d.ts +19 -0
- package/lib/phase/impl/DecideActionPhase.js +56 -0
- package/lib/phase/impl/EnrichContextFromRequestPhase.d.ts +18 -0
- package/lib/phase/impl/EnrichContextFromRequestPhase.js +59 -0
- package/lib/phase/impl/EnrichContextFromResponsePhase.d.ts +10 -0
- package/lib/phase/impl/EnrichContextFromResponsePhase.js +29 -0
- package/lib/phase/impl/FilterPhase.d.ts +9 -0
- package/lib/phase/impl/FilterPhase.js +19 -0
- package/lib/phase/impl/FirstPartyPhase.d.ts +12 -0
- package/lib/phase/impl/FirstPartyPhase.js +42 -0
- package/lib/phase/impl/ModifyIncomingRequestPhase.d.ts +9 -0
- package/lib/phase/impl/ModifyIncomingRequestPhase.js +20 -0
- package/lib/phase/impl/ModifyOutgoingResponsePhase.d.ts +9 -0
- package/lib/phase/impl/ModifyOutgoingResponsePhase.js +25 -0
- package/lib/phase/impl/ParseTokenPhase.d.ts +10 -0
- package/lib/phase/impl/ParseTokenPhase.js +37 -0
- package/lib/phase/impl/PreflightPhase.d.ts +12 -0
- package/lib/phase/impl/PreflightPhase.js +28 -0
- package/lib/phase/impl/RiskApiPhase.d.ts +17 -0
- package/lib/phase/impl/RiskApiPhase.js +76 -0
- package/lib/phase/impl/SendAsyncActivitiesOnRequestPhase.d.ts +10 -0
- package/lib/phase/impl/SendAsyncActivitiesOnRequestPhase.js +28 -0
- package/lib/phase/impl/SendAsyncActivitiesOnResponsePhase.d.ts +9 -0
- package/lib/phase/impl/SendAsyncActivitiesOnResponsePhase.js +20 -0
- package/lib/phase/impl/TelemetryPhase.d.ts +10 -0
- package/lib/phase/impl/TelemetryPhase.js +29 -0
- package/lib/phase/impl/index.d.ts +16 -0
- package/lib/phase/impl/index.js +16 -0
- package/lib/phase/index.d.ts +4 -0
- package/lib/phase/index.js +4 -0
- package/lib/products/account_defender/AccountDefender.d.ts +23 -0
- package/lib/products/account_defender/AccountDefender.js +98 -0
- package/lib/products/account_defender/AccountDefenderData.d.ts +6 -0
- package/lib/products/account_defender/AccountDefenderData.js +1 -0
- package/lib/products/account_defender/IAccountDefender.d.ts +4 -0
- package/lib/products/account_defender/IAccountDefender.js +1 -0
- package/lib/products/account_defender/JwtData.d.ts +4 -0
- package/lib/products/account_defender/JwtData.js +1 -0
- package/lib/products/account_defender/constants.d.ts +1 -0
- package/lib/products/account_defender/constants.js +1 -0
- package/lib/products/account_defender/index.d.ts +5 -0
- package/lib/products/account_defender/index.js +5 -0
- package/lib/products/bot_defender/BotDefender.d.ts +47 -0
- package/lib/products/bot_defender/BotDefender.js +135 -0
- package/lib/products/bot_defender/BotDefenderActionData.d.ts +7 -0
- package/lib/products/bot_defender/BotDefenderActionData.js +6 -0
- package/lib/products/bot_defender/BotDefenderData.d.ts +13 -0
- package/lib/products/bot_defender/BotDefenderData.js +1 -0
- package/lib/products/bot_defender/BotDefenderUtils.d.ts +5 -0
- package/lib/products/bot_defender/BotDefenderUtils.js +19 -0
- package/lib/products/bot_defender/IBotDefender.d.ts +7 -0
- package/lib/products/bot_defender/IBotDefender.js +1 -0
- package/lib/products/bot_defender/block/DefaultBotDefenderBlocker.d.ts +14 -0
- package/lib/products/bot_defender/block/DefaultBotDefenderBlocker.js +39 -0
- package/lib/products/bot_defender/block/captcha/CaptchaBlocker.d.ts +13 -0
- package/lib/products/bot_defender/block/captcha/CaptchaBlocker.js +20 -0
- package/lib/products/bot_defender/block/captcha/HtmlCaptchaBlocker.d.ts +9 -0
- package/lib/products/bot_defender/block/captcha/HtmlCaptchaBlocker.js +20 -0
- package/lib/products/bot_defender/block/captcha/JsonCaptchaBlocker.d.ts +10 -0
- package/lib/products/bot_defender/block/captcha/JsonCaptchaBlocker.js +38 -0
- package/lib/products/bot_defender/block/captcha/MobileCaptchaBlocker.d.ts +12 -0
- package/lib/products/bot_defender/block/captcha/MobileCaptchaBlocker.js +34 -0
- package/lib/products/bot_defender/block/captcha/index.d.ts +4 -0
- package/lib/products/bot_defender/block/captcha/index.js +4 -0
- package/lib/products/bot_defender/block/index.d.ts +5 -0
- package/lib/products/bot_defender/block/index.js +5 -0
- package/lib/{block_handler → products/bot_defender/block}/model/BlockData.d.ts +1 -1
- package/lib/products/bot_defender/block/model/BlockData.js +1 -0
- package/lib/products/bot_defender/block/model/JsonBlockPayload.js +1 -0
- package/lib/products/bot_defender/block/model/MobileBlockPayload.js +1 -0
- package/lib/products/bot_defender/block/model/index.d.ts +3 -0
- package/lib/products/bot_defender/block/model/index.js +3 -0
- package/lib/products/bot_defender/block/templates/captcha_template.js +50 -0
- package/lib/products/bot_defender/block/templates/index.d.ts +2 -0
- package/lib/products/bot_defender/block/templates/index.js +2 -0
- package/lib/products/bot_defender/block/templates/rate_limit_template.js +10 -0
- package/lib/products/bot_defender/block/utils.d.ts +5 -0
- package/lib/products/bot_defender/block/utils.js +43 -0
- package/lib/products/bot_defender/filter/DefaultBotDefenderFilter.d.ts +16 -0
- package/lib/products/bot_defender/filter/DefaultBotDefenderFilter.js +51 -0
- package/lib/products/bot_defender/filter/index.d.ts +1 -0
- package/lib/products/bot_defender/filter/index.js +1 -0
- package/lib/products/bot_defender/first_party/DefaultBotDefenderFirstParty.d.ts +20 -0
- package/lib/products/bot_defender/first_party/DefaultBotDefenderFirstParty.js +129 -0
- package/lib/products/bot_defender/first_party/FirstPartySuffix.d.ts +5 -0
- package/lib/products/bot_defender/first_party/FirstPartySuffix.js +6 -0
- package/lib/{first_party → products/bot_defender/first_party}/constants.d.ts +5 -2
- package/lib/products/bot_defender/first_party/constants.js +36 -0
- package/lib/products/bot_defender/first_party/index.d.ts +4 -0
- package/lib/products/bot_defender/first_party/index.js +4 -0
- package/lib/products/bot_defender/first_party/utils.d.ts +11 -0
- package/lib/products/bot_defender/first_party/utils.js +46 -0
- package/lib/products/bot_defender/index.d.ts +9 -0
- package/lib/products/bot_defender/index.js +9 -0
- package/lib/{block_handler/BlockReason.d.ts → products/bot_defender/reasons/BotDefenderBlockReason.d.ts} +1 -1
- package/lib/products/bot_defender/reasons/BotDefenderBlockReason.js +5 -0
- package/lib/{utils/PassReason.d.ts → products/bot_defender/reasons/BotDefenderPassReason.d.ts} +1 -1
- package/lib/products/bot_defender/reasons/BotDefenderPassReason.js +7 -0
- package/lib/products/bot_defender/reasons/BotDefenderReasonType.d.ts +5 -0
- package/lib/products/bot_defender/reasons/BotDefenderReasonType.js +1 -0
- package/lib/{risk_api/S2SCallReason.d.ts → products/bot_defender/reasons/BotDefenderS2SCallReason.d.ts} +1 -1
- package/lib/products/bot_defender/reasons/BotDefenderS2SCallReason.js +13 -0
- package/lib/products/bot_defender/reasons/index.d.ts +4 -0
- package/lib/products/bot_defender/reasons/index.js +4 -0
- package/lib/products/credential_intelligence/CredentialIntelligence.d.ts +22 -0
- package/lib/products/credential_intelligence/CredentialIntelligence.js +96 -0
- package/lib/products/credential_intelligence/ICredentialIntelligence.d.ts +4 -0
- package/lib/products/credential_intelligence/ICredentialIntelligence.js +1 -0
- package/lib/products/credential_intelligence/constants.d.ts +4 -0
- package/lib/products/credential_intelligence/constants.js +4 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpoint.d.ts +21 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpoint.js +37 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.d.ts +74 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.js +1 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpointManager.d.ts +12 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpointManager.js +32 -0
- package/lib/products/credential_intelligence/endpoint/ICredentialEndpoint.d.ts +9 -0
- package/lib/products/credential_intelligence/endpoint/ICredentialEndpoint.js +1 -0
- package/lib/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.d.ts +15 -0
- package/lib/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.js +64 -0
- package/lib/products/credential_intelligence/endpoint/extractor/CredentialExtractorFactory.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/extractor/CredentialExtractorFactory.js +21 -0
- package/lib/products/credential_intelligence/endpoint/extractor/CustomCredentialExtractor.d.ts +9 -0
- package/lib/products/credential_intelligence/endpoint/extractor/CustomCredentialExtractor.js +24 -0
- package/lib/products/credential_intelligence/endpoint/extractor/HeaderCredentialExtractor.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/extractor/HeaderCredentialExtractor.js +22 -0
- package/lib/products/credential_intelligence/endpoint/extractor/ICredentialExtractor.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/extractor/ICredentialExtractor.js +1 -0
- package/lib/products/credential_intelligence/endpoint/extractor/QueryParamCredentialExtractor.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/extractor/QueryParamCredentialExtractor.js +23 -0
- package/lib/products/credential_intelligence/endpoint/extractor/SentThrough.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/extractor/SentThrough.js +7 -0
- package/lib/products/credential_intelligence/endpoint/extractor/index.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/extractor/index.js +5 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceHashProtocolFactory.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceHashProtocolFactory.js +17 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceVersion.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceVersion.js +6 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/ICredentialIntelligenceHashProtocol.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/ICredentialIntelligenceHashProtocol.js +1 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/MultistepHashProtocol.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/MultistepHashProtocol.js +30 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepAndMultistepHashProtocol.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepAndMultistepHashProtocol.js +25 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepHashProtocol.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepHashProtocol.js +49 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SsoStep.d.ts +4 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SsoStep.js +5 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/index.d.ts +7 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/index.js +7 -0
- package/lib/products/credential_intelligence/endpoint/index.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/index.js +8 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.d.ts +7 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +20 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulCallback.d.ts +1 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulCallback.js +1 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulParser.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulParser.js +26 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/HeaderLoginSuccessfulParser.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/HeaderLoginSuccessfulParser.js +23 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/ILoginSuccessfulParser.d.ts +4 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/ILoginSuccessfulParser.js +1 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +26 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulReportingMethod.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulReportingMethod.js +7 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/StatusLoginSuccessfulParser.d.ts +7 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/StatusLoginSuccessfulParser.js +19 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/index.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/index.js +8 -0
- package/lib/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.js +14 -0
- package/lib/products/credential_intelligence/endpoint/matcher/ExactPathEndpointMatcher.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/matcher/ExactPathEndpointMatcher.js +9 -0
- package/lib/products/credential_intelligence/endpoint/matcher/ICredentialIntelligenceEndpointMatcher.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/matcher/ICredentialIntelligenceEndpointMatcher.js +1 -0
- package/lib/products/credential_intelligence/endpoint/matcher/PathType.d.ts +4 -0
- package/lib/products/credential_intelligence/endpoint/matcher/PathType.js +5 -0
- package/lib/products/credential_intelligence/endpoint/matcher/RegexPathEndpointMatcher.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/matcher/RegexPathEndpointMatcher.js +9 -0
- package/lib/products/credential_intelligence/endpoint/matcher/index.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/matcher/index.js +5 -0
- package/lib/products/credential_intelligence/index.d.ts +5 -0
- package/lib/products/credential_intelligence/index.js +5 -0
- package/lib/products/credential_intelligence/model/CredentialData.d.ts +8 -0
- package/lib/products/credential_intelligence/model/CredentialData.js +1 -0
- package/lib/products/credential_intelligence/model/CredentialIntelligenceData.d.ts +7 -0
- package/lib/products/credential_intelligence/model/CredentialIntelligenceData.js +1 -0
- package/lib/products/credential_intelligence/model/Credentials.d.ts +4 -0
- package/lib/products/credential_intelligence/model/Credentials.js +1 -0
- package/lib/products/credential_intelligence/model/CustomExtractionCallback.d.ts +2 -0
- package/lib/products/credential_intelligence/model/CustomExtractionCallback.js +1 -0
- package/lib/products/credential_intelligence/model/index.d.ts +4 -0
- package/lib/products/credential_intelligence/model/index.js +4 -0
- package/lib/products/index.d.ts +5 -0
- package/lib/products/index.js +5 -0
- package/lib/products/interfaces/IProduct.d.ts +10 -0
- package/lib/products/interfaces/IProduct.js +1 -0
- package/lib/products/interfaces/ProductData.d.ts +5 -0
- package/lib/products/interfaces/ProductData.js +1 -0
- package/lib/products/interfaces/ProductDataType.d.ts +5 -0
- package/lib/products/interfaces/ProductDataType.js +1 -0
- package/lib/products/interfaces/ProductType.d.ts +5 -0
- package/lib/products/interfaces/ProductType.js +1 -0
- package/lib/products/interfaces/Products.d.ts +5 -0
- package/lib/products/interfaces/Products.js +1 -0
- package/lib/products/interfaces/index.d.ts +5 -0
- package/lib/products/interfaces/index.js +5 -0
- package/lib/products/utils/ProductName.d.ts +7 -0
- package/lib/products/utils/ProductName.js +8 -0
- package/lib/products/utils/ProductPriorityOrder.d.ts +2 -0
- package/lib/products/utils/ProductPriorityOrder.js +8 -0
- package/lib/products/utils/index.d.ts +3 -0
- package/lib/products/utils/index.js +3 -0
- package/lib/products/utils/utils.d.ts +5 -0
- package/lib/products/utils/utils.js +12 -0
- package/lib/pxde/DefaultDataEnrichment.d.ts +7 -6
- package/lib/pxde/DefaultDataEnrichment.js +57 -116
- package/lib/pxde/IDataEnrichment.d.ts +5 -4
- package/lib/pxde/IDataEnrichment.js +1 -2
- package/lib/pxde/constants.js +4 -7
- package/lib/pxde/index.d.ts +3 -3
- package/lib/pxde/index.js +4 -20
- package/lib/pxde/model/PXDE.js +1 -2
- package/lib/pxde/model/PxdeData.d.ts +5 -0
- package/lib/pxde/model/PxdeData.js +1 -0
- package/lib/pxde/model/index.d.ts +2 -0
- package/lib/pxde/model/index.js +2 -0
- package/lib/pxhd/PXHDUtils.d.ts +3 -4
- package/lib/pxhd/PXHDUtils.js +15 -26
- package/lib/pxhd/index.js +2 -20
- package/lib/pxhd/model/PXHD.js +1 -2
- package/lib/pxhd/model/PXHDSource.js +2 -5
- package/lib/pxhd/model/index.js +2 -18
- package/lib/risk_api/client/IRiskApiClient.d.ts +4 -0
- package/lib/risk_api/client/IRiskApiClient.js +1 -0
- package/lib/risk_api/client/PostRiskApiClientBase.d.ts +44 -0
- package/lib/risk_api/client/PostRiskApiClientBase.js +235 -0
- package/lib/risk_api/client/PostRiskApiClientV2.d.ts +8 -0
- package/lib/risk_api/client/PostRiskApiClientV2.js +10 -0
- package/lib/risk_api/client/PostRiskApiClientV3.d.ts +8 -0
- package/lib/risk_api/client/PostRiskApiClientV3.js +10 -0
- package/lib/risk_api/client/index.d.ts +4 -0
- package/lib/risk_api/client/index.js +4 -0
- package/lib/risk_api/constants.js +1 -4
- package/lib/risk_api/index.d.ts +3 -12
- package/lib/risk_api/index.js +4 -34
- package/lib/risk_api/model/RiskActivity.d.ts +6 -2
- package/lib/risk_api/model/RiskActivity.js +1 -2
- package/lib/risk_api/model/RiskApiCallResult.d.ts +6 -0
- package/lib/risk_api/model/RiskApiCallResult.js +7 -0
- package/lib/risk_api/model/RiskStatus.js +2 -5
- package/lib/risk_api/{S2SErrorReason.js → model/S2SErrorReason.js} +2 -5
- package/lib/risk_api/model/index.d.ts +4 -0
- package/lib/risk_api/model/index.js +4 -0
- package/lib/risk_api/risk_response/IRiskResponse.d.ts +15 -0
- package/lib/risk_api/risk_response/IRiskResponse.js +1 -0
- package/lib/risk_api/risk_response/RiskResponseBase.d.ts +22 -0
- package/lib/risk_api/risk_response/RiskResponseBase.js +54 -0
- package/lib/risk_api/risk_response/RiskResponsePayloadType.d.ts +4 -0
- package/lib/risk_api/risk_response/RiskResponsePayloadType.js +1 -0
- package/lib/risk_api/risk_response/index.d.ts +4 -0
- package/lib/risk_api/risk_response/index.js +4 -0
- package/lib/risk_api/risk_response/v2/DefaultRiskResponseV2.d.ts +8 -0
- package/lib/risk_api/risk_response/v2/DefaultRiskResponseV2.js +18 -0
- package/lib/risk_api/{model/RiskResponseV2.d.ts → risk_response/v2/RiskResponseV2Payload.d.ts} +4 -4
- package/lib/risk_api/risk_response/v2/RiskResponseV2Payload.js +1 -0
- package/lib/risk_api/risk_response/v2/index.d.ts +2 -0
- package/lib/risk_api/risk_response/v2/index.js +2 -0
- package/lib/risk_api/risk_response/v3/DefaultRiskResponseV3.d.ts +8 -0
- package/lib/risk_api/risk_response/v3/DefaultRiskResponseV3.js +14 -0
- package/lib/risk_api/{model/RiskResponseV3.d.ts → risk_response/v3/RiskResponseV3Payload.d.ts} +4 -4
- package/lib/risk_api/risk_response/v3/RiskResponseV3Payload.js +1 -0
- package/lib/risk_api/risk_response/v3/index.d.ts +2 -0
- package/lib/risk_api/risk_response/v3/index.js +2 -0
- package/lib/risk_token/MobileError.js +2 -5
- package/lib/risk_token/TokenOrigin.js +2 -5
- package/lib/risk_token/{TokenVerificationResult.d.ts → TokenParseResult.d.ts} +2 -2
- package/lib/risk_token/TokenParseResult.js +7 -0
- package/lib/risk_token/TokenVersion.js +2 -5
- package/lib/risk_token/constants.js +9 -12
- package/lib/risk_token/index.d.ts +2 -3
- package/lib/risk_token/index.js +8 -32
- package/lib/risk_token/parser/DefaultTokenV2Parser.d.ts +13 -0
- package/lib/risk_token/parser/DefaultTokenV2Parser.js +14 -0
- package/lib/risk_token/parser/DefaultTokenV3Parser.d.ts +13 -0
- package/lib/risk_token/parser/DefaultTokenV3Parser.js +14 -0
- package/lib/risk_token/parser/ITokenParser.d.ts +4 -0
- package/lib/risk_token/parser/ITokenParser.js +1 -0
- package/lib/risk_token/parser/TokenParserBase.d.ts +19 -0
- package/lib/risk_token/parser/TokenParserBase.js +94 -0
- package/lib/risk_token/parser/TokenParserOptions.d.ts +4 -0
- package/lib/risk_token/parser/TokenParserOptions.js +1 -0
- package/lib/risk_token/parser/index.d.ts +5 -0
- package/lib/risk_token/parser/index.js +5 -0
- package/lib/risk_token/token/{IBotDefenderToken.d.ts → IToken.d.ts} +10 -9
- package/lib/risk_token/token/IToken.js +1 -0
- package/lib/risk_token/token/TokenBase.d.ts +32 -0
- package/lib/risk_token/token/TokenBase.js +50 -0
- package/lib/risk_token/token/TokenPayloadType.d.ts +4 -0
- package/lib/risk_token/token/TokenPayloadType.js +1 -0
- package/lib/risk_token/token/index.d.ts +6 -6
- package/lib/risk_token/token/index.js +4 -11
- package/lib/risk_token/token/v2/DefaultTokenV2.d.ts +27 -0
- package/lib/risk_token/token/v2/DefaultTokenV2.js +112 -0
- package/lib/risk_token/token/v2/{BotDefenderTokenV2Payload.d.ts → TokenV2Payload.d.ts} +1 -1
- package/lib/risk_token/token/v2/TokenV2Payload.js +1 -0
- package/lib/risk_token/token/v3/DefaultTokenV3.d.ts +30 -0
- package/lib/risk_token/token/v3/DefaultTokenV3.js +137 -0
- package/lib/risk_token/token/v3/TokenSignField.js +2 -5
- package/lib/risk_token/token/v3/TokenV3Payload.d.ts +9 -0
- package/lib/risk_token/token/v3/TokenV3Payload.js +1 -0
- package/lib/risk_token/utils.js +7 -11
- package/lib/telemetry/DefaultTelemetry.d.ts +8 -8
- package/lib/telemetry/DefaultTelemetry.js +86 -152
- package/lib/telemetry/ITelemetry.d.ts +4 -4
- package/lib/telemetry/ITelemetry.js +1 -2
- package/lib/telemetry/constants.js +7 -10
- package/lib/telemetry/index.js +2 -20
- package/lib/telemetry/model/TelemetryActivity.d.ts +1 -1
- package/lib/telemetry/model/TelemetryActivity.js +1 -2
- package/lib/utils/Algorithm.js +2 -5
- package/lib/utils/ModuleMode.js +2 -5
- package/lib/utils/VidSource.js +2 -5
- package/lib/utils/base64/AtobBase64Utils.js +6 -13
- package/lib/utils/base64/BufferBase64Utils.js +9 -16
- package/lib/utils/base64/IBase64Utils.js +1 -2
- package/lib/utils/base64/JSBase64Base64Utils.js +8 -15
- package/lib/utils/base64/index.js +4 -20
- package/lib/utils/cipher/CryptoCipherUtils.d.ts +1 -3
- package/lib/utils/cipher/CryptoCipherUtils.js +16 -53
- package/lib/utils/cipher/ICipherUtils.d.ts +2 -1
- package/lib/utils/cipher/ICipherUtils.js +1 -2
- package/lib/utils/cipher/SubtleCryptoCipherUtils.js +31 -78
- package/lib/utils/cipher/index.js +2 -18
- package/lib/utils/constants.d.ts +2 -1
- package/lib/utils/constants.js +11 -13
- package/lib/utils/cookie_parser/ICookieParser.js +1 -2
- package/lib/utils/cookie_parser/{DefaultCookieParser.d.ts → StringSplitCookieParser.d.ts} +2 -1
- package/lib/utils/cookie_parser/StringSplitCookieParser.js +28 -0
- package/lib/utils/cookie_parser/index.d.ts +2 -2
- package/lib/utils/cookie_parser/index.js +2 -5
- package/lib/utils/error/EnforcerError.js +6 -28
- package/lib/utils/error/EnforcerErrorName.js +2 -5
- package/lib/utils/error/EnforcerTimeoutError.js +7 -29
- package/lib/utils/error/index.js +3 -9
- package/lib/utils/hash/CryptoHashUtils.d.ts +11 -0
- package/lib/utils/hash/CryptoHashUtils.js +20 -0
- package/lib/utils/hash/IHashUtils.d.ts +2 -1
- package/lib/utils/hash/IHashUtils.js +1 -2
- package/lib/utils/hash/SubtleCryptoHashUtils.d.ts +8 -0
- package/lib/utils/hash/SubtleCryptoHashUtils.js +31 -0
- package/lib/utils/hash/index.d.ts +2 -2
- package/lib/utils/hash/index.js +3 -19
- package/lib/utils/{hash → hmac}/CryptoHmacUtils.d.ts +2 -2
- package/lib/utils/hmac/CryptoHmacUtils.js +19 -0
- package/lib/utils/{hash → hmac}/CryptoJSHmacUtils.d.ts +2 -2
- package/lib/utils/hmac/CryptoJSHmacUtils.js +12 -0
- package/lib/utils/hmac/IHmacUtils.d.ts +4 -0
- package/lib/utils/hmac/IHmacUtils.js +1 -0
- package/lib/utils/hmac/index.d.ts +3 -0
- package/lib/utils/hmac/index.js +3 -0
- package/lib/utils/index.d.ts +5 -6
- package/lib/utils/index.js +13 -34
- package/lib/utils/ip_range_checker/DefaultIpRangeChecker.js +5 -12
- package/lib/utils/ip_range_checker/IIpRangeChecker.js +1 -2
- package/lib/utils/ip_range_checker/index.js +1 -5
- package/lib/utils/request_id_generator/IRequestIdGenerator.d.ts +3 -0
- package/lib/utils/request_id_generator/IRequestIdGenerator.js +1 -0
- package/lib/utils/request_id_generator/UuidRequestIdGenerator.d.ts +4 -0
- package/lib/utils/request_id_generator/UuidRequestIdGenerator.js +6 -0
- package/lib/utils/request_id_generator/index.d.ts +2 -0
- package/lib/utils/request_id_generator/index.js +1 -0
- package/lib/utils/utils.d.ts +5 -2
- package/lib/utils/utils.js +52 -97
- package/package.json +5 -2
- package/lib/block_handler/BlockAction.js +0 -21
- package/lib/block_handler/BlockReason.js +0 -8
- package/lib/block_handler/DefaultBlockResponseGenerator.d.ts +0 -14
- package/lib/block_handler/DefaultBlockResponseGenerator.js +0 -55
- package/lib/block_handler/IBlockResponseGenerator.d.ts +0 -14
- package/lib/block_handler/IBlockResponseGenerator.js +0 -2
- package/lib/block_handler/captcha/CaptchaBlockResponseGenerator.d.ts +0 -14
- package/lib/block_handler/captcha/CaptchaBlockResponseGenerator.js +0 -30
- package/lib/block_handler/captcha/HtmlCaptchaResponseGenerator.d.ts +0 -10
- package/lib/block_handler/captcha/HtmlCaptchaResponseGenerator.js +0 -29
- package/lib/block_handler/captcha/JsonCaptchaResponseGenerator.d.ts +0 -10
- package/lib/block_handler/captcha/JsonCaptchaResponseGenerator.js +0 -47
- package/lib/block_handler/captcha/MobileCaptchaResponseGenerator.d.ts +0 -12
- package/lib/block_handler/captcha/MobileCaptchaResponseGenerator.js +0 -41
- package/lib/block_handler/index.d.ts +0 -13
- package/lib/block_handler/index.js +0 -21
- package/lib/block_handler/model/BlockData.js +0 -2
- package/lib/block_handler/model/JsonBlockPayload.js +0 -2
- package/lib/block_handler/model/MobileBlockPayload.js +0 -2
- package/lib/block_handler/templates/captcha_template.js +0 -4
- package/lib/block_handler/templates/rate_limit_template.js +0 -4
- package/lib/block_handler/utils.d.ts +0 -5
- package/lib/block_handler/utils.js +0 -48
- package/lib/context/ContextBase.d.ts +0 -57
- package/lib/context/ContextBase.js +0 -147
- package/lib/context/DefaultTokenV2Context.d.ts +0 -13
- package/lib/context/DefaultTokenV2Context.js +0 -35
- package/lib/context/DefaultTokenV3Context.d.ts +0 -13
- package/lib/context/DefaultTokenV3Context.js +0 -35
- package/lib/context/IContext.d.ts +0 -264
- package/lib/context/IContext.js +0 -2
- package/lib/filter/DefaultFilter.d.ts +0 -16
- package/lib/filter/DefaultFilter.js +0 -59
- package/lib/first_party/DefaultFirstParty.d.ts +0 -22
- package/lib/first_party/DefaultFirstParty.js +0 -227
- package/lib/first_party/constants.js +0 -37
- package/lib/first_party/utils.d.ts +0 -9
- package/lib/first_party/utils.js +0 -29
- package/lib/http/interfaces/ReadOnlyHeaders.d.ts +0 -4
- package/lib/http/interfaces/ReadOnlyHeaders.js +0 -19
- package/lib/risk_api/PostRiskApiClient.d.ts +0 -43
- package/lib/risk_api/PostRiskApiClient.js +0 -265
- package/lib/risk_api/S2SCallReason.js +0 -16
- package/lib/risk_api/S2SErrorHandler.d.ts +0 -9
- package/lib/risk_api/S2SErrorHandler.js +0 -121
- package/lib/risk_api/model/RiskResponseV2.js +0 -2
- package/lib/risk_api/model/RiskResponseV3.js +0 -2
- package/lib/risk_api/risk_response_handler/IRiskResponseHandler.d.ts +0 -5
- package/lib/risk_api/risk_response_handler/IRiskResponseHandler.js +0 -2
- package/lib/risk_api/risk_response_handler/RiskResponseHandlerBase.d.ts +0 -16
- package/lib/risk_api/risk_response_handler/RiskResponseHandlerBase.js +0 -73
- package/lib/risk_api/risk_response_handler/RiskResponseV2Handler.d.ts +0 -10
- package/lib/risk_api/risk_response_handler/RiskResponseV2Handler.js +0 -55
- package/lib/risk_api/risk_response_handler/RiskResponseV3Handler.d.ts +0 -10
- package/lib/risk_api/risk_response_handler/RiskResponseV3Handler.js +0 -57
- package/lib/risk_token/MobileErrorHandler.d.ts +0 -9
- package/lib/risk_token/MobileErrorHandler.js +0 -100
- package/lib/risk_token/RiskTokenScoreRetriever.d.ts +0 -14
- package/lib/risk_token/RiskTokenScoreRetriever.js +0 -148
- package/lib/risk_token/TokenVerificationResult.js +0 -10
- package/lib/risk_token/token/BotDefenderTokenBase.d.ts +0 -29
- package/lib/risk_token/token/BotDefenderTokenBase.js +0 -95
- package/lib/risk_token/token/IBotDefenderToken.js +0 -2
- package/lib/risk_token/token/v2/BotDefenderTokenV2Payload.js +0 -2
- package/lib/risk_token/token/v2/DefaultBotDefenderTokenV2.d.ts +0 -26
- package/lib/risk_token/token/v2/DefaultBotDefenderTokenV2.js +0 -206
- package/lib/risk_token/token/v3/BotDefenderTokenV3Payload.d.ts +0 -9
- package/lib/risk_token/token/v3/BotDefenderTokenV3Payload.js +0 -2
- package/lib/risk_token/token/v3/DefaultBotDefenderTokenV3.d.ts +0 -29
- package/lib/risk_token/token/v3/DefaultBotDefenderTokenV3.js +0 -231
- package/lib/utils/IScoreRetriever.d.ts +0 -14
- package/lib/utils/IScoreRetriever.js +0 -2
- package/lib/utils/PassReason.js +0 -10
- package/lib/utils/cookie_parser/DefaultCookieParser.js +0 -13
- package/lib/utils/hash/CryptoHmacUtils.js +0 -25
- package/lib/utils/hash/CryptoJSHmacUtils.js +0 -19
- package/lib/utils/uuid_generator/DefaultUuidGenerator.d.ts +0 -4
- package/lib/utils/uuid_generator/DefaultUuidGenerator.js +0 -13
- package/lib/utils/uuid_generator/IUuidGenerator.d.ts +0 -3
- package/lib/utils/uuid_generator/IUuidGenerator.js +0 -2
- package/lib/utils/uuid_generator/index.d.ts +0 -2
- package/lib/utils/uuid_generator/index.js +0 -5
- /package/lib/{block_handler → products/bot_defender/block}/model/JsonBlockPayload.d.ts +0 -0
- /package/lib/{block_handler → products/bot_defender/block}/model/MobileBlockPayload.d.ts +0 -0
- /package/lib/{block_handler → products/bot_defender/block}/templates/captcha_template.d.ts +0 -0
- /package/lib/{block_handler → products/bot_defender/block}/templates/rate_limit_template.d.ts +0 -0
- /package/lib/risk_api/{S2SErrorReason.d.ts → model/S2SErrorReason.d.ts} +0 -0
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var ipRangeCheck = require("ip-range-check");
|
|
5
|
-
var DefaultIpRangeChecker = /** @class */ (function () {
|
|
6
|
-
function DefaultIpRangeChecker() {
|
|
7
|
-
}
|
|
8
|
-
DefaultIpRangeChecker.prototype.isIpInRange = function (ip, range) {
|
|
1
|
+
import ipRangeCheck from 'ip-range-check';
|
|
2
|
+
export class DefaultIpRangeChecker {
|
|
3
|
+
isIpInRange(ip, range) {
|
|
9
4
|
return ipRangeCheck(ip, range);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
}());
|
|
13
|
-
exports.DefaultIpRangeChecker = DefaultIpRangeChecker;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DefaultIpRangeChecker = void 0;
|
|
4
|
-
var DefaultIpRangeChecker_1 = require("./DefaultIpRangeChecker");
|
|
5
|
-
Object.defineProperty(exports, "DefaultIpRangeChecker", { enumerable: true, get: function () { return DefaultIpRangeChecker_1.DefaultIpRangeChecker; } });
|
|
1
|
+
export { DefaultIpRangeChecker } from './DefaultIpRangeChecker';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UuidRequestIdGenerator } from './UuidRequestIdGenerator';
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { ReadonlyHeaders, IURL } from '../http';
|
|
1
2
|
export declare const isValidEnumValue: <T>(options: Record<string, T>, selection: T) => boolean;
|
|
2
3
|
export declare const isValidUuid: (uuid: string) => boolean;
|
|
4
|
+
export declare const isEmailAddress: (string: string) => boolean;
|
|
3
5
|
export declare const getScoreApiDomain: (appId: string) => string;
|
|
4
6
|
export declare const getCollectorDomain: (appId: string) => string;
|
|
5
7
|
export declare const getAuthorizationHeader: (authToken: string) => string;
|
|
6
8
|
export declare const getExtension: (route: string) => string;
|
|
7
|
-
export declare const getDecodedUrl: (rawUrl: string) =>
|
|
9
|
+
export declare const getDecodedUrl: (rawUrl: string) => IURL;
|
|
8
10
|
export declare const removeSensitiveFields: <T extends Record<string, any>>(object: T, sensitiveFields: (keyof T)[]) => T;
|
|
9
|
-
export declare const removeSensitiveHeaders: (headers:
|
|
11
|
+
export declare const removeSensitiveHeaders: (headers: ReadonlyHeaders, sensitiveHeaderNames: string[]) => Record<string, string[]>;
|
|
10
12
|
export declare const isRouteInPatterns: (route: string, patterns: Array<string | RegExp>) => boolean;
|
|
11
13
|
export declare const isRouteMatch: (route: string, pattern: string | RegExp) => boolean;
|
|
12
14
|
/**
|
|
@@ -14,3 +16,4 @@ export declare const isRouteMatch: (route: string, pattern: string | RegExp) =>
|
|
|
14
16
|
*/
|
|
15
17
|
export declare const transferExistingProperties: <FromObj extends Record<string, any>, ToObj extends Record<string, any>>(fromObj: FromObj, toObj: ToObj, propertyMappings: Partial<Record<keyof FromObj, keyof ToObj>>) => void;
|
|
16
18
|
export declare const rejectOnTimeout: <T>(promise: Promise<T>, ms: number) => Promise<T>;
|
|
19
|
+
export declare const getPropertyFromObject: <T>(object: any, ...keys: Array<string | number>) => T;
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -19,69 +7,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
8
|
});
|
|
21
9
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.rejectOnTimeout = exports.transferExistingProperties = exports.isRouteMatch = exports.isRouteInPatterns = exports.removeSensitiveHeaders = exports.removeSensitiveFields = exports.getDecodedUrl = exports.getExtension = exports.getAuthorizationHeader = exports.getCollectorDomain = exports.getScoreApiDomain = exports.isValidUuid = exports.isValidEnumValue = void 0;
|
|
51
|
-
var error_1 = require("./error");
|
|
52
|
-
var isValidEnumValue = function (options, selection) {
|
|
10
|
+
import { EnforcerTimeoutError } from './error';
|
|
11
|
+
import { toMutableHeaders } from '../http';
|
|
12
|
+
import { EMAIL_ADDRESS_REGEX } from './constants';
|
|
13
|
+
export const isValidEnumValue = (options, selection) => {
|
|
53
14
|
return Object.values(options).includes(selection);
|
|
54
15
|
};
|
|
55
|
-
|
|
56
|
-
var isValidUuid = function (uuid) {
|
|
16
|
+
export const isValidUuid = (uuid) => {
|
|
57
17
|
if (!uuid) {
|
|
58
18
|
return false;
|
|
59
19
|
}
|
|
60
|
-
|
|
20
|
+
const uuidValidator = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
61
21
|
return uuidValidator.test(uuid);
|
|
62
22
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var EXTENSION_INDICATOR = '.';
|
|
23
|
+
export const isEmailAddress = (string) => {
|
|
24
|
+
return EMAIL_ADDRESS_REGEX.test(string);
|
|
25
|
+
};
|
|
26
|
+
export const getScoreApiDomain = (appId) => `sapi-${appId.toLowerCase()}.perimeterx.net`;
|
|
27
|
+
export const getCollectorDomain = (appId) => `collector-${appId.toLowerCase()}.perimeterx.net`;
|
|
28
|
+
export const getAuthorizationHeader = (authToken) => `Bearer ${authToken}`;
|
|
29
|
+
export const getExtension = (route) => {
|
|
30
|
+
const EXTENSION_INDICATOR = '.';
|
|
72
31
|
if (route.indexOf(EXTENSION_INDICATOR) === -1) {
|
|
73
32
|
return '';
|
|
74
33
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
34
|
+
const cleanPath = route.split('?')[0].split('#')[0];
|
|
35
|
+
const endOfPath = cleanPath.substring(cleanPath.lastIndexOf('/') + 1);
|
|
36
|
+
const extensionIndex = endOfPath.lastIndexOf(EXTENSION_INDICATOR);
|
|
78
37
|
if (extensionIndex === -1 || extensionIndex + 1 === endOfPath.length) {
|
|
79
38
|
return '';
|
|
80
39
|
}
|
|
81
40
|
return endOfPath.substring(extensionIndex);
|
|
82
41
|
};
|
|
83
|
-
|
|
84
|
-
var getDecodedUrl = function (rawUrl) {
|
|
42
|
+
export const getDecodedUrl = (rawUrl) => {
|
|
85
43
|
rawUrl = rawUrl.replace(/%/g, '%25');
|
|
86
44
|
try {
|
|
87
45
|
return new URL(decodeURIComponent(rawUrl));
|
|
@@ -90,28 +48,24 @@ var getDecodedUrl = function (rawUrl) {
|
|
|
90
48
|
return new URL(rawUrl);
|
|
91
49
|
}
|
|
92
50
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
sensitiveFields.forEach(function (fieldName) {
|
|
51
|
+
export const removeSensitiveFields = (object, sensitiveFields) => {
|
|
52
|
+
const newObj = Object.assign({}, object);
|
|
53
|
+
sensitiveFields.forEach((fieldName) => {
|
|
97
54
|
delete newObj[fieldName];
|
|
98
55
|
});
|
|
99
56
|
return newObj;
|
|
100
57
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
sensitiveHeaderNames.forEach(function (name) {
|
|
58
|
+
export const removeSensitiveHeaders = (headers, sensitiveHeaderNames) => {
|
|
59
|
+
const ret = toMutableHeaders(headers);
|
|
60
|
+
sensitiveHeaderNames.forEach((name) => {
|
|
105
61
|
delete ret[name];
|
|
106
62
|
});
|
|
107
63
|
return ret;
|
|
108
64
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return patterns.some(function (pattern) { return (0, exports.isRouteMatch)(route, pattern); });
|
|
65
|
+
export const isRouteInPatterns = (route, patterns) => {
|
|
66
|
+
return patterns.some((pattern) => isRouteMatch(route, pattern));
|
|
112
67
|
};
|
|
113
|
-
|
|
114
|
-
var isRouteMatch = function (route, pattern) {
|
|
68
|
+
export const isRouteMatch = (route, pattern) => {
|
|
115
69
|
if (!route || !pattern) {
|
|
116
70
|
return false;
|
|
117
71
|
}
|
|
@@ -123,40 +77,41 @@ var isRouteMatch = function (route, pattern) {
|
|
|
123
77
|
}
|
|
124
78
|
return false;
|
|
125
79
|
};
|
|
126
|
-
exports.isRouteMatch = isRouteMatch;
|
|
127
80
|
/**
|
|
128
81
|
* @deprecated this method is not typesafe. Copy the fields manually instead.
|
|
129
82
|
*/
|
|
130
|
-
|
|
83
|
+
export const transferExistingProperties = (fromObj, toObj, propertyMappings) => {
|
|
131
84
|
if (!toObj || !fromObj) {
|
|
132
85
|
return;
|
|
133
86
|
}
|
|
134
|
-
Object.entries(propertyMappings).forEach(
|
|
135
|
-
var fromObjKey = _a[0], toObjKey = _a[1];
|
|
87
|
+
Object.entries(propertyMappings).forEach(([fromObjKey, toObjKey]) => {
|
|
136
88
|
if ((typeof fromObj[fromObjKey] !== 'string' && fromObj[fromObjKey] != null) ||
|
|
137
89
|
(typeof fromObj[fromObjKey] === 'string' && fromObj[fromObjKey] !== '')) {
|
|
138
90
|
toObj[toObjKey] = fromObj[fromObjKey];
|
|
139
91
|
}
|
|
140
92
|
});
|
|
141
93
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
id = setTimeout(function () {
|
|
150
|
-
clearTimeout(id);
|
|
151
|
-
reject(new error_1.EnforcerTimeoutError(ms));
|
|
152
|
-
}, ms);
|
|
153
|
-
});
|
|
154
|
-
return [4 /*yield*/, Promise.race([promise, timeout])];
|
|
155
|
-
case 1:
|
|
156
|
-
resolvedPromise = _a.sent();
|
|
157
|
-
clearTimeout(id);
|
|
158
|
-
return [2 /*return*/, resolvedPromise];
|
|
159
|
-
}
|
|
94
|
+
export const rejectOnTimeout = (promise, ms) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
+
let id;
|
|
96
|
+
const timeout = new Promise((resolve, reject) => {
|
|
97
|
+
id = setTimeout(() => {
|
|
98
|
+
clearTimeout(id);
|
|
99
|
+
reject(new EnforcerTimeoutError(ms));
|
|
100
|
+
}, ms);
|
|
160
101
|
});
|
|
161
|
-
|
|
162
|
-
|
|
102
|
+
const resolvedPromise = yield Promise.race([promise, timeout]);
|
|
103
|
+
clearTimeout(id);
|
|
104
|
+
return resolvedPromise;
|
|
105
|
+
});
|
|
106
|
+
export const getPropertyFromObject = (object, ...keys) => {
|
|
107
|
+
let value = object;
|
|
108
|
+
for (const key of keys) {
|
|
109
|
+
if (value && typeof value === 'object') {
|
|
110
|
+
value = value[key];
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return value;
|
|
117
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "perimeterx-js-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"module": "lib/index.js",
|
|
6
8
|
"types": "lib/index.d.ts",
|
|
7
9
|
"files": [
|
|
8
10
|
"lib/**/*"
|
|
9
11
|
],
|
|
12
|
+
"sideEffects": false,
|
|
10
13
|
"scripts": {
|
|
11
14
|
"build": "tsc",
|
|
12
15
|
"clean": "rm -rf lib",
|
|
@@ -18,7 +21,6 @@
|
|
|
18
21
|
"prepare": "husky install"
|
|
19
22
|
},
|
|
20
23
|
"dependencies": {
|
|
21
|
-
"cookie": "^0.5.0",
|
|
22
24
|
"crypto-js": "^4.1.1",
|
|
23
25
|
"ip-range-check": "^0.2.0",
|
|
24
26
|
"js-base64": "^3.7.2",
|
|
@@ -47,6 +49,7 @@
|
|
|
47
49
|
"nyc": "^15.1.0",
|
|
48
50
|
"prettier": "^2.7.1",
|
|
49
51
|
"sinon": "^14.0.1",
|
|
52
|
+
"ts-essentials": "^9.3.2",
|
|
50
53
|
"ts-loader": "^9.4.1",
|
|
51
54
|
"ts-node": "^10.9.1",
|
|
52
55
|
"typescript": "^4.4.4"
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.blockActionToWord = exports.BlockAction = void 0;
|
|
4
|
-
var BlockAction;
|
|
5
|
-
(function (BlockAction) {
|
|
6
|
-
BlockAction["CAPTCHA"] = "c";
|
|
7
|
-
BlockAction["RATE_LIMIT"] = "r";
|
|
8
|
-
BlockAction["CHALLENGE"] = "j";
|
|
9
|
-
})(BlockAction = exports.BlockAction || (exports.BlockAction = {}));
|
|
10
|
-
var blockActionToWord = function (blockAction) {
|
|
11
|
-
switch (blockAction) {
|
|
12
|
-
case BlockAction.RATE_LIMIT:
|
|
13
|
-
return 'ratelimit';
|
|
14
|
-
case BlockAction.CHALLENGE:
|
|
15
|
-
return 'challenge';
|
|
16
|
-
case BlockAction.CAPTCHA:
|
|
17
|
-
default:
|
|
18
|
-
return 'captcha';
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
exports.blockActionToWord = blockActionToWord;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BlockReason = void 0;
|
|
4
|
-
var BlockReason;
|
|
5
|
-
(function (BlockReason) {
|
|
6
|
-
BlockReason["S2S_HIGH_SCORE"] = "s2s_high_score";
|
|
7
|
-
BlockReason["COOKIE_HIGH_SCORE"] = "cookie_high_score";
|
|
8
|
-
})(BlockReason = exports.BlockReason || (exports.BlockReason = {}));
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IContext } from '../context';
|
|
2
|
-
import { IConfiguration } from '../config';
|
|
3
|
-
import { IMinimalResponse } from '../http';
|
|
4
|
-
import { IBase64Utils } from '../utils';
|
|
5
|
-
import { IBlockResponseGenerator } from './IBlockResponseGenerator';
|
|
6
|
-
export declare class DefaultBlockResponseGenerator implements IBlockResponseGenerator {
|
|
7
|
-
private readonly config;
|
|
8
|
-
private readonly captchaResponseGenerator;
|
|
9
|
-
constructor(config: IConfiguration, base64Utils: IBase64Utils);
|
|
10
|
-
shouldGenerate(context: IContext): boolean;
|
|
11
|
-
generateBlockResponse(context: IContext): IMinimalResponse;
|
|
12
|
-
private generateRateLimitResponse;
|
|
13
|
-
private generateCaptchaResponse;
|
|
14
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DefaultBlockResponseGenerator = void 0;
|
|
4
|
-
var pxhd_1 = require("../pxhd");
|
|
5
|
-
var http_1 = require("../http");
|
|
6
|
-
var BlockAction_1 = require("./BlockAction");
|
|
7
|
-
var CaptchaBlockResponseGenerator_1 = require("./captcha/CaptchaBlockResponseGenerator");
|
|
8
|
-
var rate_limit_template_1 = require("./templates/rate_limit_template");
|
|
9
|
-
var PXHDSource_1 = require("../pxhd/model/PXHDSource");
|
|
10
|
-
var DefaultBlockResponseGenerator = /** @class */ (function () {
|
|
11
|
-
function DefaultBlockResponseGenerator(config, base64Utils) {
|
|
12
|
-
this.config = config;
|
|
13
|
-
this.captchaResponseGenerator = new CaptchaBlockResponseGenerator_1.CaptchaBlockResponseGenerator(config, base64Utils);
|
|
14
|
-
}
|
|
15
|
-
DefaultBlockResponseGenerator.prototype.shouldGenerate = function (context) {
|
|
16
|
-
return !context.isMonitoredRequest && !!context.blockReason;
|
|
17
|
-
};
|
|
18
|
-
DefaultBlockResponseGenerator.prototype.generateBlockResponse = function (context) {
|
|
19
|
-
var _a;
|
|
20
|
-
var res;
|
|
21
|
-
switch (context.blockAction) {
|
|
22
|
-
case BlockAction_1.BlockAction.RATE_LIMIT:
|
|
23
|
-
res = this.generateRateLimitResponse();
|
|
24
|
-
break;
|
|
25
|
-
case BlockAction_1.BlockAction.CHALLENGE:
|
|
26
|
-
case BlockAction_1.BlockAction.CAPTCHA:
|
|
27
|
-
default:
|
|
28
|
-
res = this.generateCaptchaResponse(context);
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
if (((_a = context.pxhd) === null || _a === void 0 ? void 0 : _a.source) == PXHDSource_1.PXHDSource.RISK) {
|
|
32
|
-
return pxhd_1.PXHDUtils.addPxhdToMinimalResponse(context, res);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return res;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
DefaultBlockResponseGenerator.prototype.generateRateLimitResponse = function () {
|
|
39
|
-
var _a;
|
|
40
|
-
var status = 429;
|
|
41
|
-
var headers = (_a = {},
|
|
42
|
-
_a[http_1.CONTENT_TYPE_HEADER_NAME] = [http_1.ContentType.TEXT_HTML],
|
|
43
|
-
_a);
|
|
44
|
-
return new http_1.MinimalResponseImpl({
|
|
45
|
-
body: rate_limit_template_1.RATE_LIMIT_TEMPLATE,
|
|
46
|
-
status: status,
|
|
47
|
-
headers: headers,
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
DefaultBlockResponseGenerator.prototype.generateCaptchaResponse = function (context) {
|
|
51
|
-
return this.captchaResponseGenerator.generateBlockResponse(context);
|
|
52
|
-
};
|
|
53
|
-
return DefaultBlockResponseGenerator;
|
|
54
|
-
}());
|
|
55
|
-
exports.DefaultBlockResponseGenerator = DefaultBlockResponseGenerator;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IContext } from '../context';
|
|
2
|
-
import { IMinimalResponse } from '../http';
|
|
3
|
-
export interface IBlockResponseGenerator {
|
|
4
|
-
/**
|
|
5
|
-
* @param context - The request context.
|
|
6
|
-
* @returns boolean - Whether or not a block response should be generated.
|
|
7
|
-
*/
|
|
8
|
-
shouldGenerate(context: IContext): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* @param context - The request context.
|
|
11
|
-
* @returns IHttpResponse - The block response that should be returned to the end-user.
|
|
12
|
-
*/
|
|
13
|
-
generateBlockResponse(context: IContext): IMinimalResponse;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IConfiguration } from '../../config';
|
|
2
|
-
import { IContext } from '../../context';
|
|
3
|
-
import { IBase64Utils } from '../../utils';
|
|
4
|
-
import { IBlockResponseGenerator } from '../IBlockResponseGenerator';
|
|
5
|
-
import { IMinimalResponse } from '../../http';
|
|
6
|
-
export declare class CaptchaBlockResponseGenerator implements IBlockResponseGenerator {
|
|
7
|
-
private readonly config;
|
|
8
|
-
private readonly jsonCaptchaGenerator;
|
|
9
|
-
private readonly mobileCaptchaGenerator;
|
|
10
|
-
private readonly htmlCaptchaGenerator;
|
|
11
|
-
constructor(config: IConfiguration, base64Utils: IBase64Utils);
|
|
12
|
-
shouldGenerate({ blockAction }: IContext): boolean;
|
|
13
|
-
generateBlockResponse(context: IContext): IMinimalResponse;
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CaptchaBlockResponseGenerator = void 0;
|
|
4
|
-
var BlockAction_1 = require("../BlockAction");
|
|
5
|
-
var JsonCaptchaResponseGenerator_1 = require("./JsonCaptchaResponseGenerator");
|
|
6
|
-
var MobileCaptchaResponseGenerator_1 = require("./MobileCaptchaResponseGenerator");
|
|
7
|
-
var HtmlCaptchaResponseGenerator_1 = require("./HtmlCaptchaResponseGenerator");
|
|
8
|
-
var CaptchaBlockResponseGenerator = /** @class */ (function () {
|
|
9
|
-
function CaptchaBlockResponseGenerator(config, base64Utils) {
|
|
10
|
-
this.config = config;
|
|
11
|
-
this.jsonCaptchaGenerator = new JsonCaptchaResponseGenerator_1.JsonCaptchaResponseGenerator(config);
|
|
12
|
-
this.mobileCaptchaGenerator = new MobileCaptchaResponseGenerator_1.MobileCaptchaResponseGenerator(config, base64Utils);
|
|
13
|
-
this.htmlCaptchaGenerator = new HtmlCaptchaResponseGenerator_1.HtmlCaptchaResponseGenerator(config);
|
|
14
|
-
}
|
|
15
|
-
CaptchaBlockResponseGenerator.prototype.shouldGenerate = function (_a) {
|
|
16
|
-
var blockAction = _a.blockAction;
|
|
17
|
-
return blockAction === BlockAction_1.BlockAction.CAPTCHA || !Object.values(BlockAction_1.BlockAction).includes(blockAction);
|
|
18
|
-
};
|
|
19
|
-
CaptchaBlockResponseGenerator.prototype.generateBlockResponse = function (context) {
|
|
20
|
-
if (this.mobileCaptchaGenerator.shouldGenerate(context)) {
|
|
21
|
-
return this.mobileCaptchaGenerator.generateBlockResponse(context);
|
|
22
|
-
}
|
|
23
|
-
if (this.jsonCaptchaGenerator.shouldGenerate(context)) {
|
|
24
|
-
return this.jsonCaptchaGenerator.generateBlockResponse(context);
|
|
25
|
-
}
|
|
26
|
-
return this.htmlCaptchaGenerator.generateBlockResponse(context);
|
|
27
|
-
};
|
|
28
|
-
return CaptchaBlockResponseGenerator;
|
|
29
|
-
}());
|
|
30
|
-
exports.CaptchaBlockResponseGenerator = CaptchaBlockResponseGenerator;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IConfiguration } from '../../config';
|
|
2
|
-
import { IContext } from '../../context';
|
|
3
|
-
import { IMinimalResponse } from '../../http';
|
|
4
|
-
import { IBlockResponseGenerator } from '../IBlockResponseGenerator';
|
|
5
|
-
export declare class HtmlCaptchaResponseGenerator implements IBlockResponseGenerator {
|
|
6
|
-
private readonly config;
|
|
7
|
-
constructor(config: IConfiguration);
|
|
8
|
-
shouldGenerate(context: IContext): boolean;
|
|
9
|
-
generateBlockResponse(context: IContext): IMinimalResponse;
|
|
10
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HtmlCaptchaResponseGenerator = void 0;
|
|
4
|
-
var http_1 = require("../../http");
|
|
5
|
-
var utils_1 = require("../utils");
|
|
6
|
-
var captcha_template_1 = require("../templates/captcha_template");
|
|
7
|
-
var HtmlCaptchaResponseGenerator = /** @class */ (function () {
|
|
8
|
-
function HtmlCaptchaResponseGenerator(config) {
|
|
9
|
-
this.config = config;
|
|
10
|
-
}
|
|
11
|
-
HtmlCaptchaResponseGenerator.prototype.shouldGenerate = function (context) {
|
|
12
|
-
return true;
|
|
13
|
-
};
|
|
14
|
-
HtmlCaptchaResponseGenerator.prototype.generateBlockResponse = function (context) {
|
|
15
|
-
var _a;
|
|
16
|
-
var status = 403;
|
|
17
|
-
var headers = (_a = {},
|
|
18
|
-
_a[http_1.CONTENT_TYPE_HEADER_NAME] = [http_1.ContentType.TEXT_HTML],
|
|
19
|
-
_a);
|
|
20
|
-
var body = (0, utils_1.renderHtml)(captcha_template_1.CAPTCHA_TEMPLATE, (0, utils_1.createBlockData)(this.config, context));
|
|
21
|
-
return new http_1.MinimalResponseImpl({
|
|
22
|
-
body: body,
|
|
23
|
-
status: status,
|
|
24
|
-
headers: headers,
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
return HtmlCaptchaResponseGenerator;
|
|
28
|
-
}());
|
|
29
|
-
exports.HtmlCaptchaResponseGenerator = HtmlCaptchaResponseGenerator;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IConfiguration } from '../../config';
|
|
2
|
-
import { IContext } from '../../context';
|
|
3
|
-
import { IMinimalResponse } from '../../http';
|
|
4
|
-
import { IBlockResponseGenerator } from '../IBlockResponseGenerator';
|
|
5
|
-
export declare class JsonCaptchaResponseGenerator implements IBlockResponseGenerator {
|
|
6
|
-
private readonly config;
|
|
7
|
-
constructor(config: IConfiguration);
|
|
8
|
-
shouldGenerate(context: IContext): boolean;
|
|
9
|
-
generateBlockResponse(context: IContext): IMinimalResponse;
|
|
10
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonCaptchaResponseGenerator = void 0;
|
|
4
|
-
var BlockAction_1 = require("../BlockAction");
|
|
5
|
-
var http_1 = require("../../http");
|
|
6
|
-
var utils_1 = require("../utils");
|
|
7
|
-
var JsonCaptchaResponseGenerator = /** @class */ (function () {
|
|
8
|
-
function JsonCaptchaResponseGenerator(config) {
|
|
9
|
-
this.config = config;
|
|
10
|
-
}
|
|
11
|
-
JsonCaptchaResponseGenerator.prototype.shouldGenerate = function (context) {
|
|
12
|
-
if (!this.config.advancedBlockingResponseEnabled) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
var acceptHeaderValue = context.requestData.request.headers.get(http_1.ACCEPT_HEADER_NAME) ||
|
|
16
|
-
context.requestData.request.headers.get(http_1.CONTENT_TYPE_HEADER_NAME) ||
|
|
17
|
-
'';
|
|
18
|
-
var acceptHeaderContainsJson = acceptHeaderValue === null || acceptHeaderValue === void 0 ? void 0 : acceptHeaderValue.split(',').some(function (value) { return value.toLowerCase() === http_1.ContentType.APPLICATION_JSON; });
|
|
19
|
-
return !context.isMobile && context.blockAction !== BlockAction_1.BlockAction.RATE_LIMIT && acceptHeaderContainsJson;
|
|
20
|
-
};
|
|
21
|
-
JsonCaptchaResponseGenerator.prototype.generateBlockResponse = function (context) {
|
|
22
|
-
var _a;
|
|
23
|
-
var status = 403;
|
|
24
|
-
var headers = (_a = {},
|
|
25
|
-
_a[http_1.CONTENT_TYPE_HEADER_NAME] = [http_1.ContentType.APPLICATION_JSON],
|
|
26
|
-
_a);
|
|
27
|
-
var blockData = (0, utils_1.createBlockData)(this.config, context);
|
|
28
|
-
var jsonBlockPayload = {
|
|
29
|
-
appId: blockData.appId,
|
|
30
|
-
jsClientSrc: blockData.jsClientSrc,
|
|
31
|
-
customLogo: blockData.customLogo,
|
|
32
|
-
firstPartyEnabled: blockData.firstPartyEnabled,
|
|
33
|
-
vid: blockData.vid,
|
|
34
|
-
uuid: blockData.uuid,
|
|
35
|
-
hostUrl: blockData.hostUrl,
|
|
36
|
-
blockScript: blockData.blockScript,
|
|
37
|
-
altBlockScript: blockData.altBlockScript,
|
|
38
|
-
};
|
|
39
|
-
return new http_1.MinimalResponseImpl({
|
|
40
|
-
body: JSON.stringify(jsonBlockPayload),
|
|
41
|
-
status: status,
|
|
42
|
-
headers: headers,
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
return JsonCaptchaResponseGenerator;
|
|
46
|
-
}());
|
|
47
|
-
exports.JsonCaptchaResponseGenerator = JsonCaptchaResponseGenerator;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IConfiguration } from '../../config';
|
|
2
|
-
import { IContext } from '../../context';
|
|
3
|
-
import { IBase64Utils } from '../../utils';
|
|
4
|
-
import { IBlockResponseGenerator } from '../IBlockResponseGenerator';
|
|
5
|
-
import { IMinimalResponse } from '../../http';
|
|
6
|
-
export declare class MobileCaptchaResponseGenerator implements IBlockResponseGenerator {
|
|
7
|
-
private readonly config;
|
|
8
|
-
private readonly base64Utils;
|
|
9
|
-
constructor(config: IConfiguration, base64Utils: IBase64Utils);
|
|
10
|
-
shouldGenerate(context: IContext): boolean;
|
|
11
|
-
generateBlockResponse(context: IContext): IMinimalResponse;
|
|
12
|
-
}
|