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,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.joinHeaderValues = exports.toReadOnlyHeaders = void 0;
|
|
4
|
-
var toReadOnlyHeaders = function (headers) {
|
|
5
|
-
var readonlyHeaders = {};
|
|
6
|
-
headers.forEach(function (headerValue, headerName) {
|
|
7
|
-
var current = readonlyHeaders[headerName] || [];
|
|
8
|
-
readonlyHeaders[headerName] = current.concat([headerValue]);
|
|
9
|
-
});
|
|
10
|
-
return readonlyHeaders;
|
|
11
|
-
};
|
|
12
|
-
exports.toReadOnlyHeaders = toReadOnlyHeaders;
|
|
13
|
-
var joinHeaderValues = function (headers) {
|
|
14
|
-
return Object.fromEntries(Object.entries(headers).map(function (_a) {
|
|
15
|
-
var name = _a[0], values = _a[1];
|
|
16
|
-
return [name, values.join(', ')];
|
|
17
|
-
}));
|
|
18
|
-
};
|
|
19
|
-
exports.joinHeaderValues = joinHeaderValues;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { IContext } from '../context';
|
|
2
|
-
import { IConfiguration } from '../config';
|
|
3
|
-
import { RiskActivity } from './model/RiskActivity';
|
|
4
|
-
import { IScoreRetriever } from '../utils';
|
|
5
|
-
import { IRiskResponseHandler } from './risk_response_handler/IRiskResponseHandler';
|
|
6
|
-
import { RiskResponseV2 } from './model/RiskResponseV2';
|
|
7
|
-
import { RiskResponseV3 } from './model/RiskResponseV3';
|
|
8
|
-
import { IHttpClient } from '../http';
|
|
9
|
-
import { IIncomingResponse } from '../http';
|
|
10
|
-
export declare class PostRiskApiClient<RiskResponseType extends RiskResponseV2 | RiskResponseV3> implements IScoreRetriever {
|
|
11
|
-
private readonly config;
|
|
12
|
-
private readonly httpClient;
|
|
13
|
-
private readonly s2sErrorHandler;
|
|
14
|
-
private readonly riskResponseHandler;
|
|
15
|
-
constructor(config: IConfiguration, httpClient: IHttpClient, riskResponseHandler: IRiskResponseHandler<RiskResponseType>);
|
|
16
|
-
shouldRetrieveScore(context: IContext): boolean;
|
|
17
|
-
private unsetScoreFields;
|
|
18
|
-
retrieveScore(context: IContext): Promise<boolean>;
|
|
19
|
-
/**
|
|
20
|
-
* Creates the RiskActivity payload
|
|
21
|
-
* @param context
|
|
22
|
-
* @returns RiskActivity
|
|
23
|
-
* @protected
|
|
24
|
-
*/
|
|
25
|
-
protected createRiskActivity(context: IContext): RiskActivity;
|
|
26
|
-
/**
|
|
27
|
-
* Protected function in case expansions or alterations to the risk activity are needed for certain platforms.
|
|
28
|
-
* @param riskActivity
|
|
29
|
-
* @returns RiskActivity
|
|
30
|
-
* @protected
|
|
31
|
-
*/
|
|
32
|
-
protected finalizeRiskActivity(riskActivity: RiskActivity): RiskActivity;
|
|
33
|
-
private addOptionalRiskFields;
|
|
34
|
-
private addOptionalRiskFieldsToRoot;
|
|
35
|
-
private addOptionalRiskFieldsToAdditional;
|
|
36
|
-
private addCustomParamsToAdditional;
|
|
37
|
-
private addCookieRiskFieldsToAdditional;
|
|
38
|
-
private formatRiskHeadersField;
|
|
39
|
-
protected sendRiskActivity(context: IContext, riskActivity: RiskActivity): Promise<IIncomingResponse>;
|
|
40
|
-
private getRiskUrl;
|
|
41
|
-
private getRiskHeaders;
|
|
42
|
-
private handleS2STimeout;
|
|
43
|
-
}
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.PostRiskApiClient = void 0;
|
|
40
|
-
var risk_token_1 = require("../risk_token");
|
|
41
|
-
var http_1 = require("../http");
|
|
42
|
-
var utils_1 = require("../utils");
|
|
43
|
-
var S2SCallReason_1 = require("./S2SCallReason");
|
|
44
|
-
var S2SErrorHandler_1 = require("./S2SErrorHandler");
|
|
45
|
-
var constants_1 = require("./constants");
|
|
46
|
-
var http_2 = require("../http");
|
|
47
|
-
var http_3 = require("../http");
|
|
48
|
-
var PostRiskApiClient = /** @class */ (function () {
|
|
49
|
-
function PostRiskApiClient(config, httpClient, riskResponseHandler) {
|
|
50
|
-
this.config = config;
|
|
51
|
-
this.httpClient = httpClient;
|
|
52
|
-
this.riskResponseHandler = riskResponseHandler;
|
|
53
|
-
this.s2sErrorHandler = new S2SErrorHandler_1.S2SErrorHandler();
|
|
54
|
-
}
|
|
55
|
-
PostRiskApiClient.prototype.shouldRetrieveScore = function (context) {
|
|
56
|
-
if (context.riskApiData.s2sCallReason) {
|
|
57
|
-
if (context.riskApiData.s2sCallReason === S2SCallReason_1.S2SCallReason.NO_COOKIE && context.pxhd) {
|
|
58
|
-
context.riskApiData.s2sCallReason = S2SCallReason_1.S2SCallReason.NO_COOKIE_WITH_VID;
|
|
59
|
-
}
|
|
60
|
-
this.unsetScoreFields(context);
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
if (context.passReason) {
|
|
64
|
-
if (context.isSensitiveRequest && context.passReason === utils_1.PassReason.COOKIE) {
|
|
65
|
-
context.riskApiData.s2sCallReason = S2SCallReason_1.S2SCallReason.SENSITIVE_ROUTE;
|
|
66
|
-
this.unsetScoreFields(context);
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
if (context.blockReason) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
context.riskApiData.s2sCallReason = context.pxhd ? S2SCallReason_1.S2SCallReason.NO_COOKIE_WITH_VID : S2SCallReason_1.S2SCallReason.NO_COOKIE;
|
|
75
|
-
this.unsetScoreFields(context);
|
|
76
|
-
return true;
|
|
77
|
-
};
|
|
78
|
-
PostRiskApiClient.prototype.unsetScoreFields = function (context) {
|
|
79
|
-
context.passReason = undefined;
|
|
80
|
-
context.blockReason = undefined;
|
|
81
|
-
context.score = undefined;
|
|
82
|
-
};
|
|
83
|
-
PostRiskApiClient.prototype.retrieveScore = function (context) {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
-
var response, riskResponse, riskActivity, err_1;
|
|
86
|
-
return __generator(this, function (_a) {
|
|
87
|
-
switch (_a.label) {
|
|
88
|
-
case 0:
|
|
89
|
-
_a.trys.push([0, 6, , 8]);
|
|
90
|
-
riskActivity = this.createRiskActivity(context);
|
|
91
|
-
return [4 /*yield*/, this.sendRiskActivity(context, riskActivity)];
|
|
92
|
-
case 1:
|
|
93
|
-
response = _a.sent();
|
|
94
|
-
if (!((response === null || response === void 0 ? void 0 : response.status) !== 200)) return [3 /*break*/, 3];
|
|
95
|
-
return [4 /*yield*/, this.s2sErrorHandler.handleS2SError(context, response, null, null)];
|
|
96
|
-
case 2:
|
|
97
|
-
_a.sent();
|
|
98
|
-
return [2 /*return*/, false];
|
|
99
|
-
case 3: return [4 /*yield*/, response.json()];
|
|
100
|
-
case 4:
|
|
101
|
-
riskResponse = (_a.sent());
|
|
102
|
-
return [4 /*yield*/, this.riskResponseHandler.handleRiskResponse(context, response, riskResponse)];
|
|
103
|
-
case 5:
|
|
104
|
-
_a.sent();
|
|
105
|
-
return [2 /*return*/, true];
|
|
106
|
-
case 6:
|
|
107
|
-
err_1 = _a.sent();
|
|
108
|
-
if (err_1.name === utils_1.EnforcerErrorName.ENFORCER_TIMEOUT_ERROR) {
|
|
109
|
-
this.handleS2STimeout(context);
|
|
110
|
-
return [2 /*return*/, false];
|
|
111
|
-
}
|
|
112
|
-
this.config.logger.error("Caught error on Risk API: ".concat(err_1));
|
|
113
|
-
return [4 /*yield*/, this.s2sErrorHandler.handleS2SError(context, response, riskResponse, err_1)];
|
|
114
|
-
case 7:
|
|
115
|
-
_a.sent();
|
|
116
|
-
return [2 /*return*/, false];
|
|
117
|
-
case 8: return [2 /*return*/];
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Creates the RiskActivity payload
|
|
124
|
-
* @param context
|
|
125
|
-
* @returns RiskActivity
|
|
126
|
-
* @protected
|
|
127
|
-
*/
|
|
128
|
-
PostRiskApiClient.prototype.createRiskActivity = function (context) {
|
|
129
|
-
var riskActivity = {
|
|
130
|
-
request: {
|
|
131
|
-
ip: context.requestData.ip,
|
|
132
|
-
headers: this.formatRiskHeadersField(context.requestData.headers),
|
|
133
|
-
url: context.requestData.url.href,
|
|
134
|
-
},
|
|
135
|
-
additional: {
|
|
136
|
-
s2s_call_reason: context.riskApiData.s2sCallReason,
|
|
137
|
-
module_version: this.config.moduleVersion,
|
|
138
|
-
http_method: context.requestData.method,
|
|
139
|
-
http_version: context.requestData.httpVersion,
|
|
140
|
-
risk_mode: context.isMonitoredRequest ? utils_1.ModuleMode.MONITOR : utils_1.ModuleMode.ACTIVE_BLOCKING,
|
|
141
|
-
cookie_origin: context.tokenOrigin || risk_token_1.TokenOrigin.COOKIE,
|
|
142
|
-
request_cookie_names: context.requestData.requestCookieNames,
|
|
143
|
-
request_id: context.requestId,
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
this.addOptionalRiskFields(riskActivity, context);
|
|
147
|
-
return this.finalizeRiskActivity(riskActivity);
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Protected function in case expansions or alterations to the risk activity are needed for certain platforms.
|
|
151
|
-
* @param riskActivity
|
|
152
|
-
* @returns RiskActivity
|
|
153
|
-
* @protected
|
|
154
|
-
*/
|
|
155
|
-
PostRiskApiClient.prototype.finalizeRiskActivity = function (riskActivity) {
|
|
156
|
-
return riskActivity;
|
|
157
|
-
};
|
|
158
|
-
PostRiskApiClient.prototype.addOptionalRiskFields = function (riskActivity, context) {
|
|
159
|
-
this.addOptionalRiskFieldsToRoot(riskActivity, context);
|
|
160
|
-
this.addOptionalRiskFieldsToAdditional(riskActivity, context);
|
|
161
|
-
this.addCookieRiskFieldsToAdditional(riskActivity, context);
|
|
162
|
-
this.addCustomParamsToAdditional(riskActivity, context);
|
|
163
|
-
};
|
|
164
|
-
PostRiskApiClient.prototype.addOptionalRiskFieldsToRoot = function (riskActivity, context) {
|
|
165
|
-
if (context.vid) {
|
|
166
|
-
riskActivity.vid = context.vid;
|
|
167
|
-
}
|
|
168
|
-
if (context.uuid) {
|
|
169
|
-
riskActivity.uuid = context.uuid;
|
|
170
|
-
}
|
|
171
|
-
if (context.pxhd) {
|
|
172
|
-
riskActivity.pxhd = context.pxhd.value;
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
PostRiskApiClient.prototype.addOptionalRiskFieldsToAdditional = function (riskActivity, context) {
|
|
176
|
-
(0, utils_1.transferExistingProperties)(context, riskActivity.additional, {
|
|
177
|
-
vidSource: 'enforcer_vid_source',
|
|
178
|
-
graphqlData: 'graphql_operations',
|
|
179
|
-
});
|
|
180
|
-
(0, utils_1.transferExistingProperties)(context.serverData, riskActivity.additional, {
|
|
181
|
-
region: 'server_info_region',
|
|
182
|
-
datacenter: 'server_info_datacenter',
|
|
183
|
-
});
|
|
184
|
-
(0, utils_1.transferExistingProperties)(context.mobileData, riskActivity.additional, {
|
|
185
|
-
originalToken: 'original_token',
|
|
186
|
-
originalTokenError: 'original_token_error',
|
|
187
|
-
decodedOriginalToken: 'px_decoded_original_token',
|
|
188
|
-
});
|
|
189
|
-
(0, utils_1.transferExistingProperties)(context.tlsData, riskActivity.additional, {
|
|
190
|
-
tlsProtocol: 'tls_protocol',
|
|
191
|
-
tlsServer: 'tls_server',
|
|
192
|
-
tlsCipher: 'tls_cipher',
|
|
193
|
-
tlsCiphersSha: 'tls_ciphers_sha',
|
|
194
|
-
tlsExtensionSha: 'tls_extension_sha',
|
|
195
|
-
tlsPreferredCiphers: 'tls_preferred_ciphers',
|
|
196
|
-
tlsJa3Fingerprint: 'tls_ja3_fingerprint',
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
PostRiskApiClient.prototype.addCustomParamsToAdditional = function (riskActivity, context) {
|
|
200
|
-
if (context.customParameters) {
|
|
201
|
-
Object.assign(riskActivity.additional, context.customParameters);
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
PostRiskApiClient.prototype.addCookieRiskFieldsToAdditional = function (riskActivity, _a) {
|
|
205
|
-
var riskToken = _a.riskToken;
|
|
206
|
-
if (riskToken) {
|
|
207
|
-
if (riskToken.isValid()) {
|
|
208
|
-
riskActivity.additional.px_cookie = riskToken.getPayloadString();
|
|
209
|
-
riskActivity.additional.px_cookie_hmac = riskToken.hmac;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
riskActivity.additional.px_orig_cookie = riskToken.getCookieString();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
PostRiskApiClient.prototype.formatRiskHeadersField = function (headers) {
|
|
217
|
-
var headersWithoutSensitive = (0, utils_1.removeSensitiveHeaders)(headers, this.config.sensitiveHeaders);
|
|
218
|
-
return Object.entries(headersWithoutSensitive).flatMap(function (_a) {
|
|
219
|
-
var key = _a[0], values = _a[1];
|
|
220
|
-
return values.map(function (value) { return ({
|
|
221
|
-
name: key,
|
|
222
|
-
value: value,
|
|
223
|
-
}); });
|
|
224
|
-
});
|
|
225
|
-
};
|
|
226
|
-
PostRiskApiClient.prototype.sendRiskActivity = function (context, riskActivity) {
|
|
227
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
228
|
-
var url, headers, body, method, riskRequest, startTime, response, endTime;
|
|
229
|
-
return __generator(this, function (_a) {
|
|
230
|
-
switch (_a.label) {
|
|
231
|
-
case 0:
|
|
232
|
-
url = this.getRiskUrl();
|
|
233
|
-
headers = this.getRiskHeaders();
|
|
234
|
-
body = JSON.stringify(riskActivity);
|
|
235
|
-
method = http_2.HttpMethod.POST;
|
|
236
|
-
riskRequest = new http_3.OutgoingRequestImpl({ url: url, method: method, headers: headers, body: body });
|
|
237
|
-
this.config.logger.debug("sending risk api to ".concat(url));
|
|
238
|
-
startTime = Date.now();
|
|
239
|
-
return [4 /*yield*/, this.httpClient.send(riskRequest, { timeoutMs: this.config.s2sTimeout })];
|
|
240
|
-
case 1:
|
|
241
|
-
response = _a.sent();
|
|
242
|
-
endTime = Date.now();
|
|
243
|
-
context.riskApiData.madeApiCall = true;
|
|
244
|
-
context.riskApiData.riskRtt = endTime - startTime;
|
|
245
|
-
return [2 /*return*/, response];
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
};
|
|
250
|
-
PostRiskApiClient.prototype.getRiskUrl = function () {
|
|
251
|
-
return "".concat(this.config.backendScoreApiUrl).concat(constants_1.RISK_API_ENDPOINT);
|
|
252
|
-
};
|
|
253
|
-
PostRiskApiClient.prototype.getRiskHeaders = function () {
|
|
254
|
-
var _a;
|
|
255
|
-
return _a = {},
|
|
256
|
-
_a[http_1.CONTENT_TYPE_HEADER_NAME] = [http_1.ContentType.APPLICATION_JSON],
|
|
257
|
-
_a[http_1.AUTHORIZATION_HEADER_NAME] = [(0, utils_1.getAuthorizationHeader)(this.config.authToken)],
|
|
258
|
-
_a;
|
|
259
|
-
};
|
|
260
|
-
PostRiskApiClient.prototype.handleS2STimeout = function (context) {
|
|
261
|
-
context.passReason = utils_1.PassReason.S2S_TIMEOUT;
|
|
262
|
-
};
|
|
263
|
-
return PostRiskApiClient;
|
|
264
|
-
}());
|
|
265
|
-
exports.PostRiskApiClient = PostRiskApiClient;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.S2SCallReason = void 0;
|
|
4
|
-
var S2SCallReason;
|
|
5
|
-
(function (S2SCallReason) {
|
|
6
|
-
S2SCallReason["COOKIE_EXPIRED"] = "cookie_expired";
|
|
7
|
-
S2SCallReason["COOKIE_DECRYPTION_FAILED"] = "cookie_decryption_failed";
|
|
8
|
-
S2SCallReason["COOKIE_VALIDATION_FAILED"] = "cookie_validation_failed";
|
|
9
|
-
S2SCallReason["NO_COOKIE_WITH_VID"] = "no_cookie_w_vid";
|
|
10
|
-
S2SCallReason["NO_COOKIE"] = "no_cookie";
|
|
11
|
-
S2SCallReason["SENSITIVE_ROUTE"] = "sensitive_route";
|
|
12
|
-
S2SCallReason["MOBILE_ERROR_NO_COOKIE"] = "mobile_error_1";
|
|
13
|
-
S2SCallReason["MOBILE_ERROR_CONNECTION_ERROR"] = "mobile_error_2";
|
|
14
|
-
S2SCallReason["MOBILE_ERROR_CERTIFICATE_PINNING_ERROR"] = "mobile_error_3";
|
|
15
|
-
S2SCallReason["MOBILE_ERROR_BYPASS"] = "mobile_error_4";
|
|
16
|
-
})(S2SCallReason = exports.S2SCallReason || (exports.S2SCallReason = {}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IContext } from '../context';
|
|
2
|
-
import { RiskResponseV2 } from './model/RiskResponseV2';
|
|
3
|
-
import { RiskResponseV3 } from './model/RiskResponseV3';
|
|
4
|
-
import { IIncomingResponse } from '../http';
|
|
5
|
-
export declare class S2SErrorHandler {
|
|
6
|
-
handleS2SError(context: IContext, response?: IIncomingResponse, responseBody?: RiskResponseV2 | RiskResponseV3, error?: Error): Promise<void>;
|
|
7
|
-
private enrichS2SErrorWithResponse;
|
|
8
|
-
private enrichS2SErrorWithError;
|
|
9
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.S2SErrorHandler = void 0;
|
|
40
|
-
var utils_1 = require("../utils");
|
|
41
|
-
var S2SErrorReason_1 = require("./S2SErrorReason");
|
|
42
|
-
var RiskStatus_1 = require("./model/RiskStatus");
|
|
43
|
-
var S2SErrorHandler = /** @class */ (function () {
|
|
44
|
-
function S2SErrorHandler() {
|
|
45
|
-
}
|
|
46
|
-
S2SErrorHandler.prototype.handleS2SError = function (context, response, responseBody, error) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
-
return __generator(this, function (_a) {
|
|
49
|
-
switch (_a.label) {
|
|
50
|
-
case 0:
|
|
51
|
-
context.passReason = utils_1.PassReason.S2S_ERROR;
|
|
52
|
-
context.riskApiData.s2sErrorReason = S2SErrorReason_1.S2SErrorReason.UNKNOWN_ERROR;
|
|
53
|
-
if (!(response || responseBody)) return [3 /*break*/, 2];
|
|
54
|
-
return [4 /*yield*/, this.enrichS2SErrorWithResponse(context, response, responseBody)];
|
|
55
|
-
case 1:
|
|
56
|
-
_a.sent();
|
|
57
|
-
_a.label = 2;
|
|
58
|
-
case 2:
|
|
59
|
-
if (error) {
|
|
60
|
-
this.enrichS2SErrorWithError(context, error);
|
|
61
|
-
}
|
|
62
|
-
return [2 /*return*/];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
S2SErrorHandler.prototype.enrichS2SErrorWithResponse = function (context, response, responseBody) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var message, _a, _b, e_1;
|
|
70
|
-
return __generator(this, function (_c) {
|
|
71
|
-
switch (_c.label) {
|
|
72
|
-
case 0:
|
|
73
|
-
_c.trys.push([0, 4, , 5]);
|
|
74
|
-
_a = "response body: ".concat;
|
|
75
|
-
if (!responseBody) return [3 /*break*/, 1];
|
|
76
|
-
_b = JSON.stringify(responseBody);
|
|
77
|
-
return [3 /*break*/, 3];
|
|
78
|
-
case 1: return [4 /*yield*/, response.text()];
|
|
79
|
-
case 2:
|
|
80
|
-
_b = _c.sent();
|
|
81
|
-
_c.label = 3;
|
|
82
|
-
case 3:
|
|
83
|
-
message = _a.apply("response body: ", [_b]);
|
|
84
|
-
return [3 /*break*/, 5];
|
|
85
|
-
case 4:
|
|
86
|
-
e_1 = _c.sent();
|
|
87
|
-
message = "error: ".concat(e_1, ", response body: ").concat(responseBody ? JSON.stringify(responseBody) : 'empty');
|
|
88
|
-
return [3 /*break*/, 5];
|
|
89
|
-
case 5:
|
|
90
|
-
context.riskApiData.errorMessage = message;
|
|
91
|
-
context.riskApiData.s2sErrorHttpStatus = response.status;
|
|
92
|
-
if (response.status >= 400 && response.status < 500) {
|
|
93
|
-
context.riskApiData.s2sErrorReason = S2SErrorReason_1.S2SErrorReason.BAD_REQUEST;
|
|
94
|
-
}
|
|
95
|
-
else if (response.status >= 500 && response.status < 600) {
|
|
96
|
-
context.riskApiData.s2sErrorReason = S2SErrorReason_1.S2SErrorReason.SERVER_ERROR;
|
|
97
|
-
}
|
|
98
|
-
else if (response.status === 200) {
|
|
99
|
-
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.status) === RiskStatus_1.RiskStatus.FAILURE) {
|
|
100
|
-
context.riskApiData.s2sErrorReason = S2SErrorReason_1.S2SErrorReason.REQUEST_FAILED_ON_SERVER;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
context.riskApiData.s2sErrorReason = S2SErrorReason_1.S2SErrorReason.INVALID_RESPONSE;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.uuid) {
|
|
107
|
-
context.uuid = responseBody.uuid;
|
|
108
|
-
}
|
|
109
|
-
return [2 /*return*/];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
S2SErrorHandler.prototype.enrichS2SErrorWithError = function (context, error) {
|
|
115
|
-
var errorMessage = "".concat(error);
|
|
116
|
-
var existingMessage = context.riskApiData.errorMessage;
|
|
117
|
-
context.riskApiData.errorMessage = existingMessage ? "".concat(existingMessage, ", ").concat(errorMessage) : errorMessage;
|
|
118
|
-
};
|
|
119
|
-
return S2SErrorHandler;
|
|
120
|
-
}());
|
|
121
|
-
exports.S2SErrorHandler = S2SErrorHandler;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { IContext } from '../../context';
|
|
2
|
-
import { IIncomingResponse } from '../../http';
|
|
3
|
-
export interface IRiskResponseHandler<RiskResponseType> {
|
|
4
|
-
handleRiskResponse(context: IContext, response: IIncomingResponse, riskResponse: RiskResponseType): Promise<void>;
|
|
5
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IConfiguration } from '../../config';
|
|
2
|
-
import { IContext } from '../../context';
|
|
3
|
-
import { IRiskResponseHandler } from './IRiskResponseHandler';
|
|
4
|
-
import { RiskResponseV2 } from '../model/RiskResponseV2';
|
|
5
|
-
import { RiskResponseV3 } from '../model/RiskResponseV3';
|
|
6
|
-
import { IIncomingResponse } from '../../http';
|
|
7
|
-
export declare abstract class RiskResponseHandlerBase<RiskResponseType extends RiskResponseV2 | RiskResponseV3> implements IRiskResponseHandler<RiskResponseType> {
|
|
8
|
-
protected readonly config: IConfiguration;
|
|
9
|
-
protected abstract isRiskResponseValid(riskResponse: RiskResponseType): boolean;
|
|
10
|
-
protected abstract extractScoreFromRiskResponse(riskResponse: RiskResponseType): number;
|
|
11
|
-
protected abstract setRiskResponseContextFields(context: IContext, riskResponse: RiskResponseType): void;
|
|
12
|
-
protected constructor(config: IConfiguration);
|
|
13
|
-
handleRiskResponse(context: IContext, response: IIncomingResponse, riskResponse: RiskResponseType): Promise<void>;
|
|
14
|
-
protected handleValidRiskResponse(context: IContext, riskResponse: RiskResponseType): void;
|
|
15
|
-
protected shouldBlock(score: number): boolean;
|
|
16
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.RiskResponseHandlerBase = void 0;
|
|
40
|
-
var block_handler_1 = require("../../block_handler");
|
|
41
|
-
var utils_1 = require("../../utils");
|
|
42
|
-
var RiskResponseHandlerBase = /** @class */ (function () {
|
|
43
|
-
function RiskResponseHandlerBase(config) {
|
|
44
|
-
this.config = config;
|
|
45
|
-
}
|
|
46
|
-
RiskResponseHandlerBase.prototype.handleRiskResponse = function (context, response, riskResponse) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
-
return __generator(this, function (_a) {
|
|
49
|
-
if (!this.isRiskResponseValid(riskResponse)) {
|
|
50
|
-
throw new utils_1.EnforcerError('invalid risk response');
|
|
51
|
-
}
|
|
52
|
-
this.config.logger.debug("received risk response, rtt: ".concat(context.riskApiData.riskRtt));
|
|
53
|
-
this.handleValidRiskResponse(context, riskResponse);
|
|
54
|
-
return [2 /*return*/];
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
RiskResponseHandlerBase.prototype.handleValidRiskResponse = function (context, riskResponse) {
|
|
59
|
-
var score = this.extractScoreFromRiskResponse(riskResponse);
|
|
60
|
-
this.setRiskResponseContextFields(context, riskResponse);
|
|
61
|
-
if (this.shouldBlock(score)) {
|
|
62
|
-
context.blockReason = block_handler_1.BlockReason.S2S_HIGH_SCORE;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
context.passReason = utils_1.PassReason.S2S;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
RiskResponseHandlerBase.prototype.shouldBlock = function (score) {
|
|
69
|
-
return score >= this.config.blockingScore;
|
|
70
|
-
};
|
|
71
|
-
return RiskResponseHandlerBase;
|
|
72
|
-
}());
|
|
73
|
-
exports.RiskResponseHandlerBase = RiskResponseHandlerBase;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IConfiguration } from '../../config';
|
|
2
|
-
import { IContext } from '../../context';
|
|
3
|
-
import { RiskResponseHandlerBase } from './RiskResponseHandlerBase';
|
|
4
|
-
import { RiskResponseV2 } from '../model/RiskResponseV2';
|
|
5
|
-
export declare class RiskResponseV2Handler extends RiskResponseHandlerBase<RiskResponseV2> {
|
|
6
|
-
constructor(config: IConfiguration);
|
|
7
|
-
protected isRiskResponseValid(riskResponse: RiskResponseV2): boolean;
|
|
8
|
-
protected extractScoreFromRiskResponse(riskResponse: RiskResponseV2): number;
|
|
9
|
-
protected setRiskResponseContextFields(context: IContext, riskResponse: RiskResponseV2): void;
|
|
10
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.RiskResponseV2Handler = void 0;
|
|
19
|
-
var RiskStatus_1 = require("../model/RiskStatus");
|
|
20
|
-
var RiskResponseHandlerBase_1 = require("./RiskResponseHandlerBase");
|
|
21
|
-
var PXHDSource_1 = require("../../pxhd/model/PXHDSource");
|
|
22
|
-
var RiskResponseV2Handler = /** @class */ (function (_super) {
|
|
23
|
-
__extends(RiskResponseV2Handler, _super);
|
|
24
|
-
function RiskResponseV2Handler(config) {
|
|
25
|
-
return _super.call(this, config) || this;
|
|
26
|
-
}
|
|
27
|
-
RiskResponseV2Handler.prototype.isRiskResponseValid = function (riskResponse) {
|
|
28
|
-
return (riskResponse === null || riskResponse === void 0 ? void 0 : riskResponse.status) === RiskStatus_1.RiskStatus.SUCCESS && !!(riskResponse === null || riskResponse === void 0 ? void 0 : riskResponse.cookie_cfg_block_result);
|
|
29
|
-
};
|
|
30
|
-
RiskResponseV2Handler.prototype.extractScoreFromRiskResponse = function (riskResponse) {
|
|
31
|
-
return riskResponse.cookie_cfg_block_result === '1' ? 100 : 0;
|
|
32
|
-
};
|
|
33
|
-
RiskResponseV2Handler.prototype.setRiskResponseContextFields = function (context, riskResponse) {
|
|
34
|
-
context.score = this.extractScoreFromRiskResponse(riskResponse);
|
|
35
|
-
if (riskResponse.uuid) {
|
|
36
|
-
context.uuid = riskResponse.uuid;
|
|
37
|
-
}
|
|
38
|
-
if (riskResponse.pxhd) {
|
|
39
|
-
context.pxhd = {
|
|
40
|
-
value: riskResponse.pxhd,
|
|
41
|
-
domain: riskResponse.pxhdDomain,
|
|
42
|
-
source: PXHDSource_1.PXHDSource.RISK,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (riskResponse.action) {
|
|
46
|
-
context.blockAction = riskResponse.action;
|
|
47
|
-
}
|
|
48
|
-
if (riskResponse.data_enrichment) {
|
|
49
|
-
context.pxdeVerified = true;
|
|
50
|
-
context.pxde = riskResponse.data_enrichment;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
return RiskResponseV2Handler;
|
|
54
|
-
}(RiskResponseHandlerBase_1.RiskResponseHandlerBase));
|
|
55
|
-
exports.RiskResponseV2Handler = RiskResponseV2Handler;
|