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
package/lib/pxhd/PXHDUtils.js
CHANGED
|
@@ -1,39 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var utils_1 = require("../utils");
|
|
5
|
-
var http_1 = require("../http");
|
|
6
|
-
var MinimalResponseUtils_1 = require("../http/utils/MinimalResponseUtils");
|
|
7
|
-
var PXHDUtils;
|
|
1
|
+
import { PXHD_COOKIE_NAME } from '../utils';
|
|
2
|
+
import { MinimalResponseUtils, SET_COOKIE_HEADER_NAME } from '../http';
|
|
3
|
+
export var PXHDUtils;
|
|
8
4
|
(function (PXHDUtils) {
|
|
9
5
|
PXHDUtils.PXHD_SAMESITE_VALUE = 'Lax';
|
|
10
6
|
PXHDUtils.PXHD_PATH_VALUE = '/';
|
|
11
|
-
PXHDUtils.
|
|
12
|
-
if (context === null || context === void 0 ? void 0 : context.pxhd) {
|
|
13
|
-
var setPxhdCookie = PXHDUtils.getPxhdCookieValue(context.pxhd);
|
|
14
|
-
return (0, MinimalResponseUtils_1.appendHeader)(httpResponse, http_1.SET_COOKIE_HEADER_NAME, setPxhdCookie);
|
|
15
|
-
}
|
|
16
|
-
return httpResponse;
|
|
17
|
-
};
|
|
18
|
-
PXHDUtils.addPxhdToOutgoingResponse = function (context, response) {
|
|
7
|
+
PXHDUtils.addPxhdToOutgoingResponse = (context, response) => {
|
|
19
8
|
if (!(context === null || context === void 0 ? void 0 : context.pxhd)) {
|
|
20
9
|
return;
|
|
21
10
|
}
|
|
22
|
-
|
|
23
|
-
response.headers.append(
|
|
11
|
+
const setPxhdCookie = PXHDUtils.getPxhdCookieValue(context.pxhd);
|
|
12
|
+
response.headers.append(SET_COOKIE_HEADER_NAME, setPxhdCookie);
|
|
24
13
|
};
|
|
25
|
-
PXHDUtils.addPxhdToMinimalResponse =
|
|
14
|
+
PXHDUtils.addPxhdToMinimalResponse = (context, response) => {
|
|
26
15
|
if (context === null || context === void 0 ? void 0 : context.pxhd) {
|
|
27
|
-
|
|
28
|
-
return
|
|
16
|
+
const setPxhdCookie = PXHDUtils.getPxhdCookieValue(context.pxhd);
|
|
17
|
+
return MinimalResponseUtils.appendHeader(response, SET_COOKIE_HEADER_NAME, setPxhdCookie);
|
|
29
18
|
}
|
|
30
19
|
return response;
|
|
31
20
|
};
|
|
32
|
-
PXHDUtils.getPxhdCookieValue =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
PXHDUtils.getPxhdCookieValue = (pxhd) => {
|
|
22
|
+
const value = `${PXHD_COOKIE_NAME}=${pxhd.value}`;
|
|
23
|
+
const domain = pxhd.domain && `domain=${pxhd.domain}`;
|
|
24
|
+
const path = `path=${PXHDUtils.PXHD_PATH_VALUE}`;
|
|
25
|
+
const sameSite = `SameSite=${PXHDUtils.PXHD_SAMESITE_VALUE}`;
|
|
37
26
|
return [value, domain, path, sameSite].filter(Boolean).join('; ');
|
|
38
27
|
};
|
|
39
|
-
})(PXHDUtils
|
|
28
|
+
})(PXHDUtils || (PXHDUtils = {}));
|
package/lib/pxhd/index.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PXHDUtils = void 0;
|
|
18
|
-
var PXHDUtils_1 = require("./PXHDUtils");
|
|
19
|
-
Object.defineProperty(exports, "PXHDUtils", { enumerable: true, get: function () { return PXHDUtils_1.PXHDUtils; } });
|
|
20
|
-
__exportStar(require("./model"), exports);
|
|
1
|
+
export { PXHDUtils } from './PXHDUtils';
|
|
2
|
+
export * from './model';
|
package/lib/pxhd/model/PXHD.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PXHDSource = void 0;
|
|
4
|
-
var PXHDSource;
|
|
1
|
+
export var PXHDSource;
|
|
5
2
|
(function (PXHDSource) {
|
|
6
3
|
PXHDSource["COOKIE"] = "cookie";
|
|
7
4
|
PXHDSource["RISK"] = "risk";
|
|
8
|
-
})(PXHDSource
|
|
5
|
+
})(PXHDSource || (PXHDSource = {}));
|
package/lib/pxhd/model/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./PXHD"), exports);
|
|
18
|
-
__exportStar(require("./PXHDSource"), exports);
|
|
1
|
+
export * from './PXHD';
|
|
2
|
+
export * from './PXHDSource';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ReadonlyContext, RiskApiData } from '../../context';
|
|
2
|
+
import { IConfiguration } from '../../config';
|
|
3
|
+
import { IHttpClient, IIncomingResponse } from '../../http';
|
|
4
|
+
import { RiskActivity } from '../model';
|
|
5
|
+
import { IRiskResponse } from '../risk_response';
|
|
6
|
+
import { IRiskApiClient } from './IRiskApiClient';
|
|
7
|
+
export declare abstract class PostRiskApiClientBase<Req, Res> implements IRiskApiClient<Req, Res> {
|
|
8
|
+
private readonly config;
|
|
9
|
+
private readonly httpClient;
|
|
10
|
+
protected constructor(config: IConfiguration<Req, Res>, httpClient: IHttpClient);
|
|
11
|
+
protected abstract createRiskResponse(response: IIncomingResponse): IRiskResponse;
|
|
12
|
+
/**
|
|
13
|
+
* Builds the Risk API activity, sends the request, and returns RiskApiData with the response.
|
|
14
|
+
* @param context
|
|
15
|
+
* @returns Promise<RiskApiData>
|
|
16
|
+
*/
|
|
17
|
+
executeRiskApi(context: ReadonlyContext<Req, Res>): Promise<RiskApiData>;
|
|
18
|
+
/**
|
|
19
|
+
* Creates the RiskActivity payload
|
|
20
|
+
* @param context
|
|
21
|
+
* @returns RiskActivity
|
|
22
|
+
* @protected
|
|
23
|
+
*/
|
|
24
|
+
protected createRiskActivity(context: ReadonlyContext<Req, Res>): RiskActivity;
|
|
25
|
+
/**
|
|
26
|
+
* Protected function in case expansions or alterations to the risk activity are needed for certain platforms.
|
|
27
|
+
* @param riskActivity
|
|
28
|
+
* @returns RiskActivity
|
|
29
|
+
* @protected
|
|
30
|
+
*/
|
|
31
|
+
protected finalizeRiskActivity(riskActivity: RiskActivity): RiskActivity;
|
|
32
|
+
private addOptionalRiskFields;
|
|
33
|
+
private addOptionalRiskFieldsToRoot;
|
|
34
|
+
private addOptionalRiskFieldsToAdditional;
|
|
35
|
+
private addProductDataToAdditional;
|
|
36
|
+
private addCustomParamsToAdditional;
|
|
37
|
+
private addTokenDataToAdditional;
|
|
38
|
+
private formatRiskHeadersField;
|
|
39
|
+
protected sendRiskActivity(riskActivity: RiskActivity, riskApiData: RiskApiData): Promise<IIncomingResponse>;
|
|
40
|
+
private getRiskUrl;
|
|
41
|
+
private getRiskHeaders;
|
|
42
|
+
private handleS2STimeout;
|
|
43
|
+
private handleS2SError;
|
|
44
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { ProductName } from '../../products';
|
|
11
|
+
import { AUTHORIZATION_HEADER_NAME, CONTENT_TYPE_HEADER_NAME, ContentType, HttpMethod, OutgoingRequestImpl, } from '../../http';
|
|
12
|
+
import { EnforcerErrorName, getAuthorizationHeader, ModuleMode, removeSensitiveHeaders, transferExistingProperties, } from '../../utils';
|
|
13
|
+
import { RISK_API_ENDPOINT } from '../constants';
|
|
14
|
+
import { RiskApiCallResult, RiskStatus, S2SErrorReason } from '../model';
|
|
15
|
+
import { TokenParseResult } from '../../risk_token';
|
|
16
|
+
export class PostRiskApiClientBase {
|
|
17
|
+
constructor(config, httpClient) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.httpClient = httpClient;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Builds the Risk API activity, sends the request, and returns RiskApiData with the response.
|
|
23
|
+
* @param context
|
|
24
|
+
* @returns Promise<RiskApiData>
|
|
25
|
+
*/
|
|
26
|
+
executeRiskApi(context) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
let response, riskResponse;
|
|
29
|
+
const riskApiData = { riskApiCallResult: RiskApiCallResult.NONE };
|
|
30
|
+
try {
|
|
31
|
+
const riskActivity = this.createRiskActivity(context);
|
|
32
|
+
response = yield this.sendRiskActivity(riskActivity, riskApiData);
|
|
33
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== 200) {
|
|
34
|
+
return yield this.handleS2SError(riskApiData, response);
|
|
35
|
+
}
|
|
36
|
+
riskResponse = this.createRiskResponse(response);
|
|
37
|
+
riskApiData.riskResponse = riskResponse;
|
|
38
|
+
if (!(yield riskResponse.validate())) {
|
|
39
|
+
return yield this.handleS2SError(riskApiData, response);
|
|
40
|
+
}
|
|
41
|
+
this.config.logger.debug(`received risk response, score: ${riskResponse.score}, rtt: ${riskApiData.riskRtt}`);
|
|
42
|
+
return riskApiData;
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
if (err.name === EnforcerErrorName.ENFORCER_TIMEOUT_ERROR) {
|
|
46
|
+
return this.handleS2STimeout(riskApiData);
|
|
47
|
+
}
|
|
48
|
+
this.config.logger.error(`caught error in risk api: ${err} - ${JSON.stringify(context.requestData.url)}`);
|
|
49
|
+
return yield this.handleS2SError(riskApiData, response, err);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates the RiskActivity payload
|
|
55
|
+
* @param context
|
|
56
|
+
* @returns RiskActivity
|
|
57
|
+
* @protected
|
|
58
|
+
*/
|
|
59
|
+
createRiskActivity(context) {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
const riskActivity = {
|
|
62
|
+
request: {
|
|
63
|
+
ip: context.requestData.ip,
|
|
64
|
+
headers: this.formatRiskHeadersField(context.requestData.headers),
|
|
65
|
+
url: context.requestData.url.href,
|
|
66
|
+
},
|
|
67
|
+
additional: {
|
|
68
|
+
s2s_call_reason: ((_a = context.reasons) === null || _a === void 0 ? void 0 : _a[ProductName.BOT_DEFENDER]) ||
|
|
69
|
+
((_b = context.reasons) === null || _b === void 0 ? void 0 : _b[ProductName.CREDENTIAL_INTELLIGENCE]),
|
|
70
|
+
module_version: this.config.moduleVersion,
|
|
71
|
+
http_method: context.requestData.method,
|
|
72
|
+
http_version: context.requestData.httpVersion,
|
|
73
|
+
risk_mode: ((_c = context.productData.bd) === null || _c === void 0 ? void 0 : _c.isMonitoredRequest) ? ModuleMode.MONITOR : ModuleMode.ACTIVE_BLOCKING,
|
|
74
|
+
cookie_origin: context.tokenOrigin,
|
|
75
|
+
request_cookie_names: context.requestData.requestCookieNames.concat(),
|
|
76
|
+
request_id: context.requestId,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
this.addOptionalRiskFields(riskActivity, context);
|
|
80
|
+
return this.finalizeRiskActivity(riskActivity);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Protected function in case expansions or alterations to the risk activity are needed for certain platforms.
|
|
84
|
+
* @param riskActivity
|
|
85
|
+
* @returns RiskActivity
|
|
86
|
+
* @protected
|
|
87
|
+
*/
|
|
88
|
+
finalizeRiskActivity(riskActivity) {
|
|
89
|
+
return riskActivity;
|
|
90
|
+
}
|
|
91
|
+
addOptionalRiskFields(riskActivity, context) {
|
|
92
|
+
this.addOptionalRiskFieldsToRoot(riskActivity, context);
|
|
93
|
+
this.addOptionalRiskFieldsToAdditional(riskActivity, context);
|
|
94
|
+
this.addProductDataToAdditional(riskActivity, context.productData);
|
|
95
|
+
this.addTokenDataToAdditional(riskActivity, context.tokenData);
|
|
96
|
+
this.addCustomParamsToAdditional(riskActivity, context);
|
|
97
|
+
}
|
|
98
|
+
addOptionalRiskFieldsToRoot(riskActivity, context) {
|
|
99
|
+
var _a;
|
|
100
|
+
transferExistingProperties(context, riskActivity, {
|
|
101
|
+
vid: 'vid',
|
|
102
|
+
uuid: 'uuid',
|
|
103
|
+
});
|
|
104
|
+
if ((_a = context.pxhd) === null || _a === void 0 ? void 0 : _a.value) {
|
|
105
|
+
riskActivity.pxhd = context.pxhd.value;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
addOptionalRiskFieldsToAdditional(riskActivity, context) {
|
|
109
|
+
transferExistingProperties(context, riskActivity.additional, {
|
|
110
|
+
vidSource: 'enforcer_vid_source',
|
|
111
|
+
graphqlData: 'graphql_operations',
|
|
112
|
+
});
|
|
113
|
+
transferExistingProperties(context.serverData, riskActivity.additional, {
|
|
114
|
+
region: 'server_info_region',
|
|
115
|
+
datacenter: 'server_info_datacenter',
|
|
116
|
+
});
|
|
117
|
+
transferExistingProperties(context.tlsData, riskActivity.additional, {
|
|
118
|
+
tlsProtocol: 'tls_protocol',
|
|
119
|
+
tlsServer: 'tls_server',
|
|
120
|
+
tlsCipher: 'tls_cipher',
|
|
121
|
+
tlsCiphersSha: 'tls_ciphers_sha',
|
|
122
|
+
tlsExtensionSha: 'tls_extension_sha',
|
|
123
|
+
tlsPreferredCiphers: 'tls_preferred_ciphers',
|
|
124
|
+
tlsJa3Fingerprint: 'tls_ja3_fingerprint',
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
addProductDataToAdditional(riskActivity, productData) {
|
|
128
|
+
transferExistingProperties(productData.ad, riskActivity.additional, {
|
|
129
|
+
appUserId: 'app_user_id',
|
|
130
|
+
additionalFields: 'jwt_additional_fields',
|
|
131
|
+
crossTabSession: 'cross_tab_session',
|
|
132
|
+
});
|
|
133
|
+
transferExistingProperties(productData.ci, riskActivity.additional, {
|
|
134
|
+
hashedUsername: 'user',
|
|
135
|
+
hashedPassword: 'pass',
|
|
136
|
+
ciVersion: 'ci_version',
|
|
137
|
+
ssoStep: 'sso_step',
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
addCustomParamsToAdditional(riskActivity, context) {
|
|
141
|
+
if (context.customParameters) {
|
|
142
|
+
Object.assign(riskActivity.additional, context.customParameters);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
addTokenDataToAdditional(riskActivity, { token, mobileData }) {
|
|
146
|
+
if (token) {
|
|
147
|
+
if (token.isValid()) {
|
|
148
|
+
riskActivity.additional.px_cookie = token.getPayloadString();
|
|
149
|
+
riskActivity.additional.px_cookie_hmac = token.hmac;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
riskActivity.additional.px_orig_cookie = token.getTokenString();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (mobileData) {
|
|
156
|
+
transferExistingProperties(mobileData, riskActivity.additional, {
|
|
157
|
+
originalToken: 'original_token',
|
|
158
|
+
decodedOriginalToken: 'px_decoded_original_token',
|
|
159
|
+
});
|
|
160
|
+
if (mobileData.originalTokenParseResult === TokenParseResult.DECRYPTION_FAILED) {
|
|
161
|
+
riskActivity.additional.original_token_error = 'cookie_decryption_failed';
|
|
162
|
+
}
|
|
163
|
+
else if (mobileData.originalTokenParseResult === TokenParseResult.VALIDATION_FAILED) {
|
|
164
|
+
riskActivity.additional.original_token_error = 'cookie_validation_failed';
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
formatRiskHeadersField(headers) {
|
|
169
|
+
const headersWithoutSensitive = removeSensitiveHeaders(headers, this.config.sensitiveHeaders);
|
|
170
|
+
return Object.entries(headersWithoutSensitive).flatMap(([key, values]) => values.map((value) => ({
|
|
171
|
+
name: key,
|
|
172
|
+
value: value,
|
|
173
|
+
})));
|
|
174
|
+
}
|
|
175
|
+
sendRiskActivity(riskActivity, riskApiData) {
|
|
176
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
const url = this.getRiskUrl();
|
|
178
|
+
const headers = this.getRiskHeaders();
|
|
179
|
+
const body = JSON.stringify(riskActivity);
|
|
180
|
+
const method = HttpMethod.POST;
|
|
181
|
+
const riskRequest = new OutgoingRequestImpl({ url, method, headers, body });
|
|
182
|
+
this.config.logger.debug(`sending risk api to ${url}`);
|
|
183
|
+
const startTime = Date.now();
|
|
184
|
+
const response = yield this.httpClient.send(riskRequest, { timeoutMs: this.config.s2sTimeout });
|
|
185
|
+
const endTime = Date.now();
|
|
186
|
+
riskApiData.riskApiCallResult = RiskApiCallResult.SUCCESSFUL;
|
|
187
|
+
riskApiData.riskRtt = endTime - startTime;
|
|
188
|
+
return response;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
getRiskUrl() {
|
|
192
|
+
return `${this.config.backendScoreApiUrl}${RISK_API_ENDPOINT}`;
|
|
193
|
+
}
|
|
194
|
+
getRiskHeaders() {
|
|
195
|
+
return {
|
|
196
|
+
[CONTENT_TYPE_HEADER_NAME]: [ContentType.APPLICATION_JSON],
|
|
197
|
+
[AUTHORIZATION_HEADER_NAME]: [getAuthorizationHeader(this.config.authToken)],
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
handleS2STimeout(riskApiData) {
|
|
201
|
+
riskApiData.riskApiCallResult = RiskApiCallResult.TIMEOUT;
|
|
202
|
+
return riskApiData;
|
|
203
|
+
}
|
|
204
|
+
handleS2SError(riskApiData, response, error) {
|
|
205
|
+
var _a, _b, _c;
|
|
206
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
207
|
+
riskApiData.riskApiCallResult = RiskApiCallResult.ERROR;
|
|
208
|
+
riskApiData.errorReason = S2SErrorReason.UNKNOWN_ERROR;
|
|
209
|
+
if (response || riskApiData.riskResponse) {
|
|
210
|
+
riskApiData.errorHttpStatus = response.status;
|
|
211
|
+
riskApiData.errorMessage = ((_a = riskApiData.riskResponse) === null || _a === void 0 ? void 0 : _a.message) || `response body: ${yield response.text()}`;
|
|
212
|
+
if (response.status === 200) {
|
|
213
|
+
if (((_b = riskApiData.riskResponse) === null || _b === void 0 ? void 0 : _b.status) === RiskStatus.FAILURE) {
|
|
214
|
+
riskApiData.errorReason = S2SErrorReason.REQUEST_FAILED_ON_SERVER;
|
|
215
|
+
}
|
|
216
|
+
else if (!(yield ((_c = riskApiData.riskResponse) === null || _c === void 0 ? void 0 : _c.validate()))) {
|
|
217
|
+
riskApiData.errorReason = S2SErrorReason.INVALID_RESPONSE;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else if (response.status >= 400 && response.status < 500) {
|
|
221
|
+
riskApiData.errorReason = S2SErrorReason.BAD_REQUEST;
|
|
222
|
+
}
|
|
223
|
+
else if (response.status >= 500 && response.status < 600) {
|
|
224
|
+
riskApiData.errorReason = S2SErrorReason.SERVER_ERROR;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (error) {
|
|
228
|
+
const errorMessage = `${error}`;
|
|
229
|
+
const existingMessage = riskApiData.errorMessage;
|
|
230
|
+
riskApiData.errorMessage = existingMessage ? `${existingMessage}, ${errorMessage}` : errorMessage;
|
|
231
|
+
}
|
|
232
|
+
return riskApiData;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IConfiguration } from '../../config';
|
|
2
|
+
import { IHttpClient, IIncomingResponse } from '../../http';
|
|
3
|
+
import { IRiskResponse } from '../risk_response';
|
|
4
|
+
import { PostRiskApiClientBase } from './PostRiskApiClientBase';
|
|
5
|
+
export declare class PostRiskApiClientV2<Req, Res> extends PostRiskApiClientBase<Req, Res> {
|
|
6
|
+
constructor(config: IConfiguration<Req, Res>, httpClient: IHttpClient);
|
|
7
|
+
protected createRiskResponse(response: IIncomingResponse): IRiskResponse;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DefaultRiskResponseV2 } from '../risk_response';
|
|
2
|
+
import { PostRiskApiClientBase } from './PostRiskApiClientBase';
|
|
3
|
+
export class PostRiskApiClientV2 extends PostRiskApiClientBase {
|
|
4
|
+
constructor(config, httpClient) {
|
|
5
|
+
super(config, httpClient);
|
|
6
|
+
}
|
|
7
|
+
createRiskResponse(response) {
|
|
8
|
+
return new DefaultRiskResponseV2(response);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PostRiskApiClientBase } from './PostRiskApiClientBase';
|
|
2
|
+
import { IHttpClient, IIncomingResponse } from '../../http';
|
|
3
|
+
import { IRiskResponse } from '../risk_response';
|
|
4
|
+
import { IConfiguration } from '../../config';
|
|
5
|
+
export declare class PostRiskApiClientV3<Req, Res> extends PostRiskApiClientBase<Req, Res> {
|
|
6
|
+
constructor(config: IConfiguration<Req, Res>, httpClient: IHttpClient);
|
|
7
|
+
protected createRiskResponse(response: IIncomingResponse): IRiskResponse;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PostRiskApiClientBase } from './PostRiskApiClientBase';
|
|
2
|
+
import { DefaultRiskResponseV3 } from '../risk_response';
|
|
3
|
+
export class PostRiskApiClientV3 extends PostRiskApiClientBase {
|
|
4
|
+
constructor(config, httpClient) {
|
|
5
|
+
super(config, httpClient);
|
|
6
|
+
}
|
|
7
|
+
createRiskResponse(response) {
|
|
8
|
+
return new DefaultRiskResponseV3(response);
|
|
9
|
+
}
|
|
10
|
+
}
|
package/lib/risk_api/index.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { RiskActivity } from './model/RiskActivity';
|
|
5
|
-
export { IRiskResponseHandler } from './risk_response_handler/IRiskResponseHandler';
|
|
6
|
-
export { RiskResponseHandlerBase } from './risk_response_handler/RiskResponseHandlerBase';
|
|
7
|
-
export { RiskResponseV2Handler } from './risk_response_handler/RiskResponseV2Handler';
|
|
8
|
-
export { RiskResponseV3Handler } from './risk_response_handler/RiskResponseV3Handler';
|
|
9
|
-
export { S2SErrorHandler } from './S2SErrorHandler';
|
|
10
|
-
export { PostRiskApiClient } from './PostRiskApiClient';
|
|
11
|
-
export { S2SCallReason } from './S2SCallReason';
|
|
12
|
-
export { S2SErrorReason } from './S2SErrorReason';
|
|
1
|
+
export * from './model';
|
|
2
|
+
export * from './risk_response';
|
|
3
|
+
export * from './client';
|
|
13
4
|
export * from './constants';
|
package/lib/risk_api/index.js
CHANGED
|
@@ -1,34 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.S2SErrorReason = exports.S2SCallReason = exports.PostRiskApiClient = exports.S2SErrorHandler = exports.RiskResponseV3Handler = exports.RiskResponseV2Handler = exports.RiskResponseHandlerBase = exports.RiskStatus = void 0;
|
|
18
|
-
var RiskStatus_1 = require("./model/RiskStatus");
|
|
19
|
-
Object.defineProperty(exports, "RiskStatus", { enumerable: true, get: function () { return RiskStatus_1.RiskStatus; } });
|
|
20
|
-
var RiskResponseHandlerBase_1 = require("./risk_response_handler/RiskResponseHandlerBase");
|
|
21
|
-
Object.defineProperty(exports, "RiskResponseHandlerBase", { enumerable: true, get: function () { return RiskResponseHandlerBase_1.RiskResponseHandlerBase; } });
|
|
22
|
-
var RiskResponseV2Handler_1 = require("./risk_response_handler/RiskResponseV2Handler");
|
|
23
|
-
Object.defineProperty(exports, "RiskResponseV2Handler", { enumerable: true, get: function () { return RiskResponseV2Handler_1.RiskResponseV2Handler; } });
|
|
24
|
-
var RiskResponseV3Handler_1 = require("./risk_response_handler/RiskResponseV3Handler");
|
|
25
|
-
Object.defineProperty(exports, "RiskResponseV3Handler", { enumerable: true, get: function () { return RiskResponseV3Handler_1.RiskResponseV3Handler; } });
|
|
26
|
-
var S2SErrorHandler_1 = require("./S2SErrorHandler");
|
|
27
|
-
Object.defineProperty(exports, "S2SErrorHandler", { enumerable: true, get: function () { return S2SErrorHandler_1.S2SErrorHandler; } });
|
|
28
|
-
var PostRiskApiClient_1 = require("./PostRiskApiClient");
|
|
29
|
-
Object.defineProperty(exports, "PostRiskApiClient", { enumerable: true, get: function () { return PostRiskApiClient_1.PostRiskApiClient; } });
|
|
30
|
-
var S2SCallReason_1 = require("./S2SCallReason");
|
|
31
|
-
Object.defineProperty(exports, "S2SCallReason", { enumerable: true, get: function () { return S2SCallReason_1.S2SCallReason; } });
|
|
32
|
-
var S2SErrorReason_1 = require("./S2SErrorReason");
|
|
33
|
-
Object.defineProperty(exports, "S2SErrorReason", { enumerable: true, get: function () { return S2SErrorReason_1.S2SErrorReason; } });
|
|
34
|
-
__exportStar(require("./constants"), exports);
|
|
1
|
+
export * from './model';
|
|
2
|
+
export * from './risk_response';
|
|
3
|
+
export * from './client';
|
|
4
|
+
export * from './constants';
|
|
@@ -2,7 +2,7 @@ import { ModuleMode, VidSource } from '../../utils';
|
|
|
2
2
|
import { TokenOrigin } from '../../risk_token';
|
|
3
3
|
import { CustomParameters } from '../../custom_parameters';
|
|
4
4
|
import { GraphQLData } from '../../graphql/';
|
|
5
|
-
import {
|
|
5
|
+
import { CredentialIntelligenceVersion, SsoStep } from '../../products';
|
|
6
6
|
export declare type HeaderEntry = {
|
|
7
7
|
name: string;
|
|
8
8
|
value: string;
|
|
@@ -15,7 +15,7 @@ export declare type RiskRequestData = {
|
|
|
15
15
|
export declare type RiskAdditionalData = {
|
|
16
16
|
request_id: string;
|
|
17
17
|
module_version: string;
|
|
18
|
-
s2s_call_reason:
|
|
18
|
+
s2s_call_reason: string;
|
|
19
19
|
risk_mode: ModuleMode;
|
|
20
20
|
http_method: string;
|
|
21
21
|
http_version?: string;
|
|
@@ -42,6 +42,10 @@ export declare type RiskAdditionalData = {
|
|
|
42
42
|
app_user_id?: string;
|
|
43
43
|
jwt_additional_fields?: string[];
|
|
44
44
|
graphql_operations?: GraphQLData[];
|
|
45
|
+
user?: string;
|
|
46
|
+
pass?: string;
|
|
47
|
+
ci_version?: CredentialIntelligenceVersion;
|
|
48
|
+
sso_step?: SsoStep;
|
|
45
49
|
} & CustomParameters;
|
|
46
50
|
export declare type RiskActivity = {
|
|
47
51
|
vid?: string;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var RiskApiCallResult;
|
|
2
|
+
(function (RiskApiCallResult) {
|
|
3
|
+
RiskApiCallResult[RiskApiCallResult["NONE"] = -1] = "NONE";
|
|
4
|
+
RiskApiCallResult[RiskApiCallResult["SUCCESSFUL"] = 0] = "SUCCESSFUL";
|
|
5
|
+
RiskApiCallResult[RiskApiCallResult["ERROR"] = 1] = "ERROR";
|
|
6
|
+
RiskApiCallResult[RiskApiCallResult["TIMEOUT"] = 2] = "TIMEOUT";
|
|
7
|
+
})(RiskApiCallResult || (RiskApiCallResult = {}));
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RiskStatus = void 0;
|
|
4
|
-
var RiskStatus;
|
|
1
|
+
export var RiskStatus;
|
|
5
2
|
(function (RiskStatus) {
|
|
6
3
|
RiskStatus[RiskStatus["FAILURE"] = -1] = "FAILURE";
|
|
7
4
|
RiskStatus[RiskStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
8
|
-
})(RiskStatus
|
|
5
|
+
})(RiskStatus || (RiskStatus = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.S2SErrorReason = void 0;
|
|
4
|
-
var S2SErrorReason;
|
|
1
|
+
export var S2SErrorReason;
|
|
5
2
|
(function (S2SErrorReason) {
|
|
6
3
|
S2SErrorReason["UNABLE_TO_SEND_REQUEST"] = "unable_to_send_request";
|
|
7
4
|
S2SErrorReason["BAD_REQUEST"] = "bad_request";
|
|
@@ -9,4 +6,4 @@ var S2SErrorReason;
|
|
|
9
6
|
S2SErrorReason["INVALID_RESPONSE"] = "invalid_response";
|
|
10
7
|
S2SErrorReason["REQUEST_FAILED_ON_SERVER"] = "request_failed_on_server";
|
|
11
8
|
S2SErrorReason["UNKNOWN_ERROR"] = "unknown_error";
|
|
12
|
-
})(S2SErrorReason
|
|
9
|
+
})(S2SErrorReason || (S2SErrorReason = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AsyncOrSync } from 'ts-essentials';
|
|
2
|
+
import { BlockAction } from '../../blocker';
|
|
3
|
+
import { PXDE } from '../../pxde';
|
|
4
|
+
import { RiskStatus } from '../model';
|
|
5
|
+
export interface IRiskResponse {
|
|
6
|
+
readonly status: RiskStatus;
|
|
7
|
+
readonly score: number;
|
|
8
|
+
readonly action: BlockAction;
|
|
9
|
+
readonly uuid: string;
|
|
10
|
+
readonly pxhd?: string;
|
|
11
|
+
readonly pxhdDomain?: string;
|
|
12
|
+
readonly message?: string;
|
|
13
|
+
readonly dataEnrichment?: PXDE;
|
|
14
|
+
validate(): AsyncOrSync<boolean>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|